about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/text/groff/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/text/groff/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/text/groff/default.nix33
1 files changed, 24 insertions, 9 deletions
diff --git a/nixpkgs/pkgs/tools/text/groff/default.nix b/nixpkgs/pkgs/tools/text/groff/default.nix
index a38251557c09..ae250f2efeea 100644
--- a/nixpkgs/pkgs/tools/text/groff/default.nix
+++ b/nixpkgs/pkgs/tools/text/groff/default.nix
@@ -1,10 +1,14 @@
 { lib, stdenv, fetchurl, fetchpatch, perl
-, enableGhostscript ? false, ghostscript # for postscript and html output
+, enableGhostscript ? false
+, ghostscript, gawk, libX11, libXaw, libXt, libXmu # for postscript and html output
 , enableHtml ? false, psutils, netpbm # for html output
+, enableIconv ? false, iconv
+, enableLibuchardet ? false, libuchardet # for detecting input file encoding in preconv(1)
 , buildPackages
 , autoreconfHook
 , pkg-config
 , texinfo
+, bison
 , bash
 }:
 
@@ -21,6 +25,7 @@ stdenv.mkDerivation rec {
 
   # Parallel build is failing for missing depends. Known upstream as:
   #   https://savannah.gnu.org/bugs/?62084
+  #   fixed, planned release: 1.23.0
   enableParallelBuilding = false;
 
   patches = [
@@ -44,28 +49,38 @@ stdenv.mkDerivation rec {
       --replace "pnmcut" "${lib.getBin netpbm}/bin/pnmcut" \
       --replace "pnmcrop" "${lib.getBin netpbm}/bin/pnmcrop" \
       --replace "pnmtopng" "${lib.getBin netpbm}/bin/pnmtopng"
-    substituteInPlace tmac/www.tmac \
+    substituteInPlace tmac/www.tmac.in \
       --replace "pnmcrop" "${lib.getBin netpbm}/bin/pnmcrop" \
       --replace "pngtopnm" "${lib.getBin netpbm}/bin/pngtopnm" \
       --replace "@PNMTOPS_NOSETPAGE@" "${lib.getBin netpbm}/bin/pnmtops -nosetpage"
+    substituteInPlace contrib/groffer/roff2.pl \
+      --replace "'gs'" "'${lib.getBin ghostscript}/bin/gs'"
+    substituteInPlace contrib/pdfmark/pdfroff.sh \
+      --replace '$GROFF_GHOSTSCRIPT_INTERPRETER' "${lib.getBin ghostscript}/bin/gs" \
+      --replace '$GROFF_AWK_INTERPRETER' "${lib.getBin gawk}/bin/gawk"
   '';
 
   strictDeps = true;
-  nativeBuildInputs = [ autoreconfHook pkg-config texinfo ];
+  nativeBuildInputs = [ autoreconfHook pkg-config texinfo ]
+    # Required due to the patch that changes .ypp files.
+    ++ lib.optional (stdenv.cc.isClang && lib.versionAtLeast stdenv.cc.version "9") bison;
   buildInputs = [ perl bash ]
-    ++ lib.optionals enableGhostscript [ ghostscript ]
-    ++ lib.optionals enableHtml [ psutils netpbm ];
+    ++ lib.optionals enableGhostscript [ ghostscript gawk libX11 libXaw libXt libXmu ]
+    ++ lib.optionals enableHtml [ psutils netpbm ]
+    ++ lib.optionals enableIconv [ iconv ]
+    ++ lib.optionals enableLibuchardet [ libuchardet ];
 
   # Builds running without a chroot environment may detect the presence
   # of /usr/X11 in the host system, leading to an impure build of the
   # package. To avoid this issue, X11 support is explicitly disabled.
-  # Note: If we ever want to *enable* X11 support, then we'll probably
-  # have to pass "--with-appresdir", too.
-  configureFlags = [
+  configureFlags = lib.optionals (!enableGhostscript) [
     "--without-x"
+  ] ++ [
     "ac_cv_path_PERL=${buildPackages.perl}/bin/perl"
   ] ++ lib.optionals enableGhostscript [
-    "--with-gs=${ghostscript}/bin/gs"
+    "--with-gs=${lib.getBin ghostscript}/bin/gs"
+    "--with-awk=${lib.getBin gawk}/bin/gawk"
+    "--with-appresdir=${placeholder "out"}/lib/X11/app-defaults"
   ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
     "gl_cv_func_signbit=yes"
   ];