groff: Fix ghostscript and html output, add X11 support

This commit is contained in:
Michael Raitza 2023-03-23 16:47:52 +01:00
parent eefb2ef603
commit ee4ed75727

View file

@ -1,5 +1,6 @@
{ lib, stdenv, fetchurl, fetchpatch, perl { 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 , enableHtml ? false, psutils, netpbm # for html output
, enableIconv ? false, iconv , enableIconv ? false, iconv
, enableLibuchardet ? false, libuchardet # for detecting input file encoding in preconv(1) , 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: # Parallel build is failing for missing depends. Known upstream as:
# https://savannah.gnu.org/bugs/?62084 # https://savannah.gnu.org/bugs/?62084
# fixed, planned release: 1.23.0
enableParallelBuilding = false; enableParallelBuilding = false;
patches = [ patches = [
@ -47,10 +49,15 @@ stdenv.mkDerivation rec {
--replace "pnmcut" "${lib.getBin netpbm}/bin/pnmcut" \ --replace "pnmcut" "${lib.getBin netpbm}/bin/pnmcut" \
--replace "pnmcrop" "${lib.getBin netpbm}/bin/pnmcrop" \ --replace "pnmcrop" "${lib.getBin netpbm}/bin/pnmcrop" \
--replace "pnmtopng" "${lib.getBin netpbm}/bin/pnmtopng" --replace "pnmtopng" "${lib.getBin netpbm}/bin/pnmtopng"
substituteInPlace tmac/www.tmac \ substituteInPlace tmac/www.tmac.in \
--replace "pnmcrop" "${lib.getBin netpbm}/bin/pnmcrop" \ --replace "pnmcrop" "${lib.getBin netpbm}/bin/pnmcrop" \
--replace "pngtopnm" "${lib.getBin netpbm}/bin/pngtopnm" \ --replace "pngtopnm" "${lib.getBin netpbm}/bin/pngtopnm" \
--replace "@PNMTOPS_NOSETPAGE@" "${lib.getBin netpbm}/bin/pnmtops -nosetpage" --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; strictDeps = true;
@ -58,7 +65,7 @@ stdenv.mkDerivation rec {
# Required due to the patch that changes .ypp files. # Required due to the patch that changes .ypp files.
++ lib.optional (stdenv.cc.isClang && lib.versionAtLeast stdenv.cc.version "9") bison; ++ lib.optional (stdenv.cc.isClang && lib.versionAtLeast stdenv.cc.version "9") bison;
buildInputs = [ perl bash ] buildInputs = [ perl bash ]
++ lib.optionals enableGhostscript [ ghostscript ] ++ lib.optionals enableGhostscript [ ghostscript gawk libX11 libXaw libXt libXmu ]
++ lib.optionals enableHtml [ psutils netpbm ] ++ lib.optionals enableHtml [ psutils netpbm ]
++ lib.optionals enableIconv [ iconv ] ++ lib.optionals enableIconv [ iconv ]
++ lib.optionals enableLibuchardet [ libuchardet ]; ++ lib.optionals enableLibuchardet [ libuchardet ];
@ -66,13 +73,14 @@ stdenv.mkDerivation rec {
# Builds running without a chroot environment may detect the presence # Builds running without a chroot environment may detect the presence
# of /usr/X11 in the host system, leading to an impure build of the # of /usr/X11 in the host system, leading to an impure build of the
# package. To avoid this issue, X11 support is explicitly disabled. # package. To avoid this issue, X11 support is explicitly disabled.
# Note: If we ever want to *enable* X11 support, then we'll probably configureFlags = lib.optionals (!enableGhostscript) [
# have to pass "--with-appresdir", too.
configureFlags = [
"--without-x" "--without-x"
] ++ [
"ac_cv_path_PERL=${buildPackages.perl}/bin/perl" "ac_cv_path_PERL=${buildPackages.perl}/bin/perl"
] ++ lib.optionals enableGhostscript [ ] ++ 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) [ ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
"gl_cv_func_signbit=yes" "gl_cv_func_signbit=yes"
]; ];