about summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorMichael Raitza <spacefrogg-devel@meterriblecrew.net>2023-03-23 16:47:52 +0100
committerMichael Raitza <spacefrogg-devel@meterriblecrew.net>2023-03-23 17:57:56 +0100
commitee4ed757274fe821392eb66ad5f2d2022ffa966c (patch)
tree7b571800852314dc30352692fc6b6e059f389ffa /pkgs/tools
parenteefb2ef60347f65d29047f69e252aec6278913a0 (diff)
downloadnixlib-ee4ed757274fe821392eb66ad5f2d2022ffa966c.tar
nixlib-ee4ed757274fe821392eb66ad5f2d2022ffa966c.tar.gz
nixlib-ee4ed757274fe821392eb66ad5f2d2022ffa966c.tar.bz2
nixlib-ee4ed757274fe821392eb66ad5f2d2022ffa966c.tar.lz
nixlib-ee4ed757274fe821392eb66ad5f2d2022ffa966c.tar.xz
nixlib-ee4ed757274fe821392eb66ad5f2d2022ffa966c.tar.zst
nixlib-ee4ed757274fe821392eb66ad5f2d2022ffa966c.zip
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"
   ];