1{
2 stdenv,
3 lib,
4 makeWrapper,
5 fetchFromGitLab,
6 perl,
7 flex,
8 gnused,
9 coreutils,
10 which,
11 opensp,
12 groff,
13 texliveMedium,
14 texinfo,
15 withLatex ? false,
16}:
17
18stdenv.mkDerivation rec {
19 pname = "linuxdoc-tools";
20 version = "0.9.86";
21
22 src = fetchFromGitLab {
23 owner = "agmartin";
24 repo = "linuxdoc-tools";
25 rev = version;
26 hash = "sha256-AsTlrjTYuuLB2jF0zKPVrxOZ2ygUIyMJFV6qDd7ODwA=";
27 };
28
29 outputs = [
30 "out"
31 "man"
32 "doc"
33 ];
34
35 configureFlags = [
36 ("--enable-docs=txt info lyx html rtf" + lib.optionalString withLatex " pdf")
37 ];
38
39 LEX = "flex";
40
41 postInstall = ''
42 wrapProgram $out/bin/linuxdoc \
43 --prefix PATH : "${
44 lib.makeBinPath [
45 groff
46 opensp
47 ]
48 }:$out/bin" \
49 --prefix PERL5LIB : "$out/share/linuxdoc-tools/"
50 '';
51
52 doInstallCheck = true;
53
54 installCheckPhase = ''
55 pushd doc/example
56 substituteInPlace Makefile \
57 --replace "COMMAND=linuxdoc" "COMMAND=$out/bin/linuxdoc" \
58 ${lib.optionalString (!withLatex) "--replace '.tex .dvi .ps .pdf' ''"}
59 make
60 popd
61 '';
62
63 nativeBuildInputs = [
64 flex
65 which
66 makeWrapper
67 ];
68
69 buildInputs = [
70 opensp
71 groff
72 texinfo
73 perl
74 gnused
75 coreutils
76 ]
77 ++ lib.optionals withLatex [ texliveMedium ];
78
79 meta = with lib; {
80 description = "Toolset for processing LinuxDoc DTD SGML files";
81 longDescription = ''
82 A collection of text formatters which understands a LinuxDoc DTD SGML
83 source file. Each formatter (or "back-end") renders the source file into
84 a variety of output formats, including HTML, TeX, DVI, PostScript, plain
85 text, and groff source in manual-page format. The linuxdoc suite is
86 provided for backward compatibility, because there are still many useful
87 documents written in LinuxDoc DTD sgml source.
88 '';
89 homepage = "https://gitlab.com/agmartin/linuxdoc-tools";
90 license = with licenses; [
91 gpl3Plus
92 mit
93 sgmlug
94 ];
95 platforms = platforms.linux;
96 maintainers = with maintainers; [ p-h ];
97 };
98}