From c3161d81bd54122c26021a26e3e571de86d593ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Philippe=20H=C3=BCrlimann?=
Date: Mon, 26 Dec 2022 18:49:44 +0100
Subject: [PATCH] linuxdoc-tools: init at 0.9.82
Heavily based on original work by xvuko
Co-authored-by: xvuko
---
lib/licenses.nix | 6 ++
.../text/sgml/linuxdoc-tools/default.nix | 62 +++++++++++++++++++
pkgs/top-level/all-packages.nix | 2 +
3 files changed, 70 insertions(+)
create mode 100644 pkgs/tools/text/sgml/linuxdoc-tools/default.nix
diff --git a/lib/licenses.nix b/lib/licenses.nix
index f54ab464357b..52956e52afa6 100644
--- a/lib/licenses.nix
+++ b/lib/licenses.nix
@@ -842,6 +842,12 @@ in mkLicense lset) ({
fullName = "SGI Free Software License B v2.0";
};
+ # Gentoo seems to treat it as a license:
+ # https://gitweb.gentoo.org/repo/gentoo.git/tree/licenses/SGMLUG?id=7d999af4a47bf55e53e54713d98d145f935935c1
+ sgmlug = {
+ fullName = "SGML UG SGML Parser Materials license";
+ };
+
sleepycat = {
spdxId = "Sleepycat";
fullName = "Sleepycat License";
diff --git a/pkgs/tools/text/sgml/linuxdoc-tools/default.nix b/pkgs/tools/text/sgml/linuxdoc-tools/default.nix
new file mode 100644
index 000000000000..8050d084e350
--- /dev/null
+++ b/pkgs/tools/text/sgml/linuxdoc-tools/default.nix
@@ -0,0 +1,62 @@
+{ stdenv, lib, makeWrapper, fetchFromGitLab, openjade, gnumake, perl, flex
+, gnused, coreutils, which, opensp, groff, texlive, texinfo, withLatex ? false
+}:
+
+stdenv.mkDerivation rec {
+ pname = "linuxdoc-tools";
+ version = "0.9.82";
+
+ src = fetchFromGitLab {
+ owner = "agmartin";
+ repo = "linuxdoc-tools";
+ rev = version;
+ sha256 = "17v9ilh79av4n94vk4m52aq57ykb9myffxd2qr8kb8b3xnq5d36z";
+ };
+
+ outputs = [ "out" "man" "doc" ];
+
+ configureFlags = [
+ ("--enable-docs=txt info lyx html rtf"
+ + lib.optionalString withLatex " pdf")
+ ];
+
+ LEX = "flex";
+
+ postInstall = ''
+ wrapProgram $out/bin/linuxdoc \
+ --prefix PATH : "${lib.makeBinPath [ groff opensp ]}:$out/bin" \
+ --prefix PERL5LIB : "$out/share/linuxdoc-tools/"
+ '';
+
+ doInstallCheck = true;
+
+ installCheckPhase = ''
+ pushd doc/example
+ substituteInPlace Makefile \
+ --replace "COMMAND=linuxdoc" "COMMAND=$out/bin/linuxdoc" \
+ ${lib.optionalString (!withLatex) "--replace '.tex .dvi .ps .pdf' ''"}
+ make
+ popd
+ '';
+
+ nativeBuildInputs = [ flex which makeWrapper ];
+
+ buildInputs = [ opensp groff texinfo perl gnused coreutils ]
+ ++ lib.optionals withLatex [ texlive.combined.scheme-medium ];
+
+ meta = with lib; {
+ description = "Toolset for processing LinuxDoc DTD SGML files";
+ longDescription = ''
+ A collection of text formatters which understands a LinuxDoc DTD SGML
+ source file. Each formatter (or "back-end") renders the source file into
+ a variety of output formats, including HTML, TeX, DVI, PostScript, plain
+ text, and groff source in manual-page format. The linuxdoc suite is
+ provided for backward compatibility, because there are still many useful
+ documents written in LinuxDoc DTD sgml source.
+ '';
+ homepage = "https://gitlab.com/agmartin/linuxdoc-tools";
+ license = with licenses; [ gpl3Plus mit sgmlug ];
+ platforms = platforms.linux;
+ maintainers = with maintainers; [ p-h ];
+ };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index b81d61fd6f6b..dff269af8f12 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -4928,6 +4928,8 @@ with pkgs;
linuxptp = callPackage ../os-specific/linux/linuxptp { };
+ linuxdoc-tools = callPackage ../tools/text/sgml/linuxdoc-tools { };
+
lisgd = callPackage ../tools/inputmethods/lisgd { };
lite = callPackage ../applications/editors/lite { };