summary refs log tree commit diff
path: root/pkgs/tools/text/sgml/linuxdoc-tools/default.nix
blob: dad9975ebf12d957aabfdd533baf834e08755f32 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{ stdenv, lib, makeWrapper, fetchFromGitLab, perl, flex
, gnused, coreutils, which, opensp, groff, texlive, texinfo, withLatex ? false
}:

stdenv.mkDerivation rec {
  pname = "linuxdoc-tools";
  version = "0.9.83";

  src = fetchFromGitLab {
    owner = "agmartin";
    repo = "linuxdoc-tools";
    rev = version;
    sha256 = "sha256-1F3MDYJ9UH7ypgTSfYZV59PfLirlTmw6XBMEnz5Jtyk=";
  };

  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 ];
  };
}