about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorSergei Trofimovich <slyich@gmail.com>2023-03-23 17:06:19 +0000
committerGitHub <noreply@github.com>2023-03-23 17:06:19 +0000
commitfc12f918751166a6e73f70cf4f825907e65cb80f (patch)
tree3eda3f9c4cade38c170c408fd020be546f4facb5 /pkgs/tools
parent514a16e2eb9c79887ef0b47f45faccdde71df3c6 (diff)
parentee4ed757274fe821392eb66ad5f2d2022ffa966c (diff)
downloadnixlib-fc12f918751166a6e73f70cf4f825907e65cb80f.tar
nixlib-fc12f918751166a6e73f70cf4f825907e65cb80f.tar.gz
nixlib-fc12f918751166a6e73f70cf4f825907e65cb80f.tar.bz2
nixlib-fc12f918751166a6e73f70cf4f825907e65cb80f.tar.lz
nixlib-fc12f918751166a6e73f70cf4f825907e65cb80f.tar.xz
nixlib-fc12f918751166a6e73f70cf4f825907e65cb80f.tar.zst
nixlib-fc12f918751166a6e73f70cf4f825907e65cb80f.zip
Merge pull request #222750 from spacefrogg/groff-fixes
groff: Fix ghostscript and html output, add X11 support
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/text/groff/default.nix22
1 files changed, 15 insertions, 7 deletions
diff --git a/pkgs/tools/text/groff/default.nix b/pkgs/tools/text/groff/default.nix
index f6adca208fcf..ae250f2efeea 100644
--- a/pkgs/tools/text/groff/default.nix
+++ b/pkgs/tools/text/groff/default.nix
@@ -1,5 +1,6 @@
 { 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)
@@ -24,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 = [
@@ -47,10 +49,15 @@ 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;
@@ -58,7 +65,7 @@ stdenv.mkDerivation rec {
     # 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 enableGhostscript [ ghostscript gawk libX11 libXaw libXt libXmu ]
     ++ lib.optionals enableHtml [ psutils netpbm ]
     ++ lib.optionals enableIconv [ iconv ]
     ++ lib.optionals enableLibuchardet [ libuchardet ];
@@ -66,13 +73,14 @@ stdenv.mkDerivation rec {
   # 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"
   ];