@@ -1,4 +1,7 @@
1−{ stdenv, fetchurl, ghostscript, perl, groff }:
1+{ stdenv, fetchurl, perl, groff
2+, ghostscript #for postscript and html output
3+, psutils, netpbm #for html output
4+}:
25
36stdenv.mkDerivation rec {
47 name = "groff-1.22.3";
@@ -12,7 +15,21 @@ stdenv.mkDerivation rec {
1215
1316 enableParallelBuilding = false;
1417
15− buildInputs = [ ghostscript ];
18+ postPatch = stdenv.lib.optionalString (psutils != null) ''
19+ substituteInPlace src/preproc/html/pre-html.cpp \
20+ --replace "psselect" "${psutils}/bin/psselect"
21+ '' + stdenv.lib.optionalString (netpbm != null) ''
22+ substituteInPlace src/preproc/html/pre-html.cpp \
23+ --replace "pnmcut" "${netpbm}/bin/pnmcut" \
24+ --replace "pnmcrop" "${netpbm}/bin/pnmcrop" \
25+ --replace "pnmtopng" "${netpbm}/bin/pnmtopng"
26+ substituteInPlace tmac/www.tmac \
27+ --replace "pnmcrop" "${netpbm}/bin/pnmcrop" \
28+ --replace "pngtopnm" "${netpbm}/bin/pngtopnm" \
29+ --replace "@PNMTOPS_NOSETPAGE@" "${netpbm}/bin/pnmtops -nosetpage"
30+ '';
31+
32+ buildInputs = [ ghostscript psutils netpbm ];
1633 nativeBuildInputs = [ perl ];
1734
1835 # Builds running without a chroot environment may detect the presence
@@ -20,7 +37,11 @@ stdenv.mkDerivation rec {
2037 # package. To avoid this issue, X11 support is explicitly disabled.
2138 # Note: If we ever want to *enable* X11 support, then we'll probably
2239 # have to pass "--with-appresdir", too.
23− configureFlags = "--without-x";
40+ configureFlags = [
41+ "--without-x"
42+ ] ++ stdenv.lib.optionals (ghostscript != null) [
43+ "--with-gs=${ghostscript}/bin/gs"
44+ ];
2445
2546 doCheck = true;
2647