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