1{
2 fetchurl,
3 lib,
4 stdenv,
5 texinfo,
6 perlPackages,
7 groff,
8 libxml2,
9 libxslt,
10 gnused,
11 libiconv,
12 iconv,
13 opensp,
14 docbook_xml_dtd_43,
15 bash,
16 makeWrapper,
17}:
18
19stdenv.mkDerivation rec {
20 pname = "docbook2X";
21 version = "0.8.8";
22
23 src = fetchurl {
24 url = "mirror://sourceforge/docbook2x/docbook2X-${version}.tar.gz";
25 sha256 = "0ifwzk99rzjws0ixzimbvs83x6cxqk1xzmg84wa1p7bs6rypaxs0";
26 };
27
28 # This patch makes sure that `docbook2texi --to-stdout' actually
29 # writes its output to stdout instead of creating a file.
30 patches = [ ./db2x_texixml-to-stdout.patch ];
31
32 strictDeps = true;
33 nativeBuildInputs = [
34 makeWrapper
35 perlPackages.perl
36 texinfo
37 libxslt
38 iconv
39 ];
40 buildInputs = [
41 groff
42 libxml2
43 opensp
44 libiconv
45 bash
46 ]
47 ++ (with perlPackages; [
48 perl
49 XMLSAX
50 XMLParser
51 XMLNamespaceSupport
52 ]);
53
54 # configure tries to find osx in PATH and hardcodes the resulting path
55 # (if any) on the Perl code. this fails under strictDeps, so override
56 # the autoconf test:
57 OSX = "${opensp}/bin/osx";
58
59 postConfigure = ''
60 # Broken substitution is used for `perl/config.pl', which leaves literal
61 # `$prefix' in it.
62 substituteInPlace "perl/config.pl" \
63 --replace '${"\$" + "{prefix}"}' "$out"
64 '';
65
66 doCheck = false; # fails a lot of tests
67
68 postInstall = ''
69 perlPrograms="db2x_manxml db2x_texixml db2x_xsltproc
70 docbook2man docbook2texi";
71 for i in $perlPrograms
72 do
73 # XXX: We work around the fact that `wrapProgram' doesn't support
74 # spaces below by inserting escaped backslashes.
75 wrapProgram $out/bin/$i \
76 --prefix PERL5LIB : ${
77 with perlPackages;
78 makeFullPerlPath [
79 XMLSAX
80 XMLParser
81 XMLNamespaceSupport
82 ]
83 } \
84 --prefix XML_CATALOG_FILES "\ " \
85 "$out/share/docbook2X/dtd/catalog.xml\ $out/share/docbook2X/xslt/catalog.xml\ ${docbook_xml_dtd_43}/xml/dtd/docbook/catalog.xml"
86 done
87
88 wrapProgram $out/bin/sgml2xml-isoent --prefix PATH : \
89 "${gnused}/bin"
90 '';
91
92 meta = with lib; {
93 longDescription = ''
94 docbook2X is a software package that converts DocBook documents
95 into the traditional Unix man page format and the GNU Texinfo
96 format.
97 '';
98 license = licenses.mit;
99 homepage = "https://docbook2x.sourceforge.net/";
100 platforms = platforms.all;
101 };
102}