Unverified Commit 50fca07b authored by Alexis Hildebrandt's avatar Alexis Hildebrandt Committed by Michael Daniels
Browse files

groff: 1.23.0 -> 1.24.1

parent 6700d238
Loading
Loading
Loading
Loading
+28 −33
Original line number Diff line number Diff line
@@ -27,19 +27,13 @@

stdenv.mkDerivation (finalAttrs: {
  pname = "groff";
  version = "1.23.0";
  version = "1.24.1";

  src = fetchurl {
    url = "mirror://gnu/groff/groff-${finalAttrs.version}.tar.gz";
    hash = "sha256-a5dX9ZK3UYtJAutq9+VFcL3Mujeocf3bLTCuOGNRHBM=";
    hash = "sha256-dOKBl5W2r/QxrqyYPWOpyJaO6roqLrp9+LpMe0Hnz9g=";
  };

  patches = [
    # Backport e49b934 "Fix underspecified `getenv()` prototype." for non-glibc systems with C23
    # This can be dropped in the next release, when the local getopt implementation in libgroff is removed
    ./fix-underspecified-getenv-prototype.patch
  ];

  outputs = [
    "out"
    "man"
@@ -51,25 +45,19 @@ stdenv.mkDerivation (finalAttrs: {
  enableParallelBuilding = true;

  postPatch = ''
    # BASH_PROG gets replaced with a path to the build bash which doesn't get automatically patched by patchShebangs
    # POSIX_SHELL_PROG gets replaced with a path to the build bash which doesn't get automatically patched by patchShebangs
    substituteInPlace contrib/gdiffmk/gdiffmk.sh \
      --replace "@BASH_PROG@" "/bin/sh"
      --replace-fail "@POSIX_SHELL_PROG@" "/bin/sh"
  ''
  + lib.optionalString enableHtml ''
    substituteInPlace src/preproc/html/pre-html.cpp \
      --replace "psselect" "${psutils}/bin/psselect" \
      --replace "pnmcut" "${lib.getBin netpbm}/bin/pnmcut" \
      --replace "pnmcrop" "${lib.getBin netpbm}/bin/pnmcrop" \
      --replace "pnmtopng" "${lib.getBin netpbm}/bin/pnmtopng"
      --replace-fail "pamcut" "${lib.getExe' netpbm "pamcut"}" \
      --replace-fail "pnmcrop" "${lib.getExe' netpbm "pnmcrop"}" \
      --replace-fail "pnmtopng" "${lib.getExe' netpbm "pnmtopng"}"
    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"
  ''
  + lib.optionalString (enableGhostscript || enableHtml) ''
    substituteInPlace contrib/pdfmark/pdfroff.sh \
      --replace '$GROFF_GHOSTSCRIPT_INTERPRETER' "${lib.getBin ghostscript}/bin/gs" \
      --replace '$GROFF_AWK_INTERPRETER' "${lib.getBin gawk}/bin/gawk"
      --replace-fail "pnmcrop" "${lib.getExe' netpbm "pnmcrop"}" \
      --replace-fail "pngtopnm" "${lib.getExe' netpbm "pngtopnm"}" \
      --replace-fail "@PNMTOPS_NOSETPAGE@" "${lib.getExe' netpbm "pnmtops"} -nosetpage"
  '';

  strictDeps = true;
@@ -108,25 +96,38 @@ stdenv.mkDerivation (finalAttrs: {
    ]
    ++ [
      "ac_cv_path_PERL=${buildPackages.perl}/bin/perl"
      "--enable-year2038"
    ]
    ++ lib.optionals enableGhostscript [
      "--with-gs=${lib.getBin ghostscript}/bin/gs"
      "--with-awk=${lib.getBin gawk}/bin/gawk"
      "--with-appresdir=${placeholder "out"}/lib/X11/app-defaults"
      "--with-gs=${lib.getExe ghostscript}"
      "--with-appdefdir=${placeholder "out"}/lib/X11/app-defaults"
    ]
    ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
      "gl_cv_func_signbit=yes"
    ];

  postConfigure = ''
    # Move mom docs instead of linking them to avoid dangling symlinks
    substituteInPlace Makefile \
      --replace-fail '$(LN_S) $(exampledir)' 'mv $(exampledir)'
  '';

  makeFlags = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
    # Trick to get the build system find the proper 'native' groff
    # http://www.mail-archive.com/bug-groff@gnu.org/msg01335.html
    "GROFF_BIN_PATH=${buildPackages.groff}/bin"
    "GROFFBIN=${buildPackages.groff}/bin/groff"
    "GROFF_BIN_PATH=${lib.getBin buildPackages.groff}/bin"
    "GROFFBIN=${lib.getExe buildPackages.groff}"
  ];

  doCheck = true;

  preCheck = ''
    # The neqn-smoke-test fails on nixpkgs because neqn exec's eqn,
    # but eqn, isn't in the PATH in the nixpkgs test env, to remedy
    # that GROFF_BIN_PATH is set as follows:
    export GROFF_BIN_PATH=.
  '';

  postInstall = ''
    for f in 'man.local' 'mdoc.local'; do
        cat '${./site.tmac}' >>"$out/share/groff/site-tmac/$f"
@@ -146,16 +147,10 @@ stdenv.mkDerivation (finalAttrs: {
    moveToOutput bin/afmtodit $perl
    moveToOutput bin/gperl $perl
    moveToOutput bin/chem $perl

    moveToOutput bin/gpinyin $perl
    moveToOutput lib/groff/gpinyin $perl
    substituteInPlace $perl/bin/gpinyin \
      --replace $out/lib/groff/gpinyin $perl/lib/groff/gpinyin

    moveToOutput bin/grog $perl
    moveToOutput lib/groff/grog $perl
    substituteInPlace $perl/bin/grog \
      --replace $out/lib/groff/grog $perl/lib/groff/grog

    find $perl/ -type f -print0 | xargs --null sed -i 's|${buildPackages.perl}|${perl}|'
  '';