2020-11-19 07:37:54 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, perl
|
2023-03-23 15:47:52 +00:00
|
|
|
, enableGhostscript ? false
|
|
|
|
, ghostscript, gawk, libX11, libXaw, libXt, libXmu # for postscript and html output
|
2022-07-29 21:05:11 +00:00
|
|
|
, enableHtml ? false, psutils, netpbm # for html output
|
2023-02-07 10:27:11 +00:00
|
|
|
, enableIconv ? false, iconv
|
|
|
|
, enableLibuchardet ? false, libuchardet # for detecting input file encoding in preconv(1)
|
2017-04-24 00:01:56 +00:00
|
|
|
, buildPackages
|
2017-12-10 05:17:26 +00:00
|
|
|
, autoreconfHook
|
2021-01-17 09:17:16 +00:00
|
|
|
, pkg-config
|
2019-10-06 05:01:29 +00:00
|
|
|
, texinfo
|
2023-01-19 13:28:31 +00:00
|
|
|
, bison
|
2022-04-20 00:12:13 +00:00
|
|
|
, bash
|
2016-09-12 15:26:28 +00:00
|
|
|
}:
|
2009-01-10 23:35:15 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "groff";
|
2023-07-06 09:26:14 +00:00
|
|
|
version = "1.23.0";
|
2005-08-21 13:59:04 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-08-15 12:41:18 +00:00
|
|
|
url = "mirror://gnu/groff/${pname}-${version}.tar.gz";
|
2023-07-06 09:26:14 +00:00
|
|
|
hash = "sha256-a5dX9ZK3UYtJAutq9+VFcL3Mujeocf3bLTCuOGNRHBM=";
|
2009-01-10 23:35:15 +00:00
|
|
|
};
|
|
|
|
|
2017-07-11 14:54:40 +00:00
|
|
|
outputs = [ "out" "man" "doc" "info" "perl" ];
|
2015-07-26 11:58:19 +00:00
|
|
|
|
2023-07-06 09:26:14 +00:00
|
|
|
enableParallelBuilding = true;
|
2019-11-09 03:00:35 +00:00
|
|
|
|
2022-04-20 00:12:13 +00:00
|
|
|
postPatch = ''
|
|
|
|
# BASH_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"
|
2022-07-29 21:05:11 +00:00
|
|
|
'' + lib.optionalString enableHtml ''
|
2016-09-12 15:26:28 +00:00
|
|
|
substituteInPlace src/preproc/html/pre-html.cpp \
|
2022-07-29 21:05:11 +00:00
|
|
|
--replace "psselect" "${psutils}/bin/psselect" \
|
2021-01-15 09:19:50 +00:00
|
|
|
--replace "pnmcut" "${lib.getBin netpbm}/bin/pnmcut" \
|
|
|
|
--replace "pnmcrop" "${lib.getBin netpbm}/bin/pnmcrop" \
|
|
|
|
--replace "pnmtopng" "${lib.getBin netpbm}/bin/pnmtopng"
|
2023-03-23 15:47:52 +00:00
|
|
|
substituteInPlace tmac/www.tmac.in \
|
2021-01-15 09:19:50 +00:00
|
|
|
--replace "pnmcrop" "${lib.getBin netpbm}/bin/pnmcrop" \
|
|
|
|
--replace "pngtopnm" "${lib.getBin netpbm}/bin/pngtopnm" \
|
|
|
|
--replace "@PNMTOPS_NOSETPAGE@" "${lib.getBin netpbm}/bin/pnmtops -nosetpage"
|
2023-07-06 09:26:14 +00:00
|
|
|
'' + lib.optionalString (enableGhostscript || enableHtml) ''
|
2023-03-23 15:47:52 +00:00
|
|
|
substituteInPlace contrib/pdfmark/pdfroff.sh \
|
|
|
|
--replace '$GROFF_GHOSTSCRIPT_INTERPRETER' "${lib.getBin ghostscript}/bin/gs" \
|
|
|
|
--replace '$GROFF_AWK_INTERPRETER' "${lib.getBin gawk}/bin/gawk"
|
2016-09-12 15:26:28 +00:00
|
|
|
'';
|
|
|
|
|
2022-04-20 00:12:13 +00:00
|
|
|
strictDeps = true;
|
2023-01-19 13:28:31 +00:00
|
|
|
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;
|
2022-07-29 21:05:11 +00:00
|
|
|
buildInputs = [ perl bash ]
|
2023-03-23 15:47:52 +00:00
|
|
|
++ lib.optionals enableGhostscript [ ghostscript gawk libX11 libXaw libXt libXmu ]
|
2023-02-07 10:27:11 +00:00
|
|
|
++ lib.optionals enableHtml [ psutils netpbm ]
|
|
|
|
++ lib.optionals enableIconv [ iconv ]
|
|
|
|
++ lib.optionals enableLibuchardet [ libuchardet ];
|
2009-01-10 23:35:15 +00:00
|
|
|
|
2013-06-11 09:55:52 +00:00
|
|
|
# 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.
|
2023-03-23 15:47:52 +00:00
|
|
|
configureFlags = lib.optionals (!enableGhostscript) [
|
2016-09-12 15:26:28 +00:00
|
|
|
"--without-x"
|
2023-03-23 15:47:52 +00:00
|
|
|
] ++ [
|
2021-10-22 20:17:45 +00:00
|
|
|
"ac_cv_path_PERL=${buildPackages.perl}/bin/perl"
|
2022-07-29 21:05:11 +00:00
|
|
|
] ++ lib.optionals enableGhostscript [
|
2023-03-23 15:47:52 +00:00
|
|
|
"--with-gs=${lib.getBin ghostscript}/bin/gs"
|
|
|
|
"--with-awk=${lib.getBin gawk}/bin/gawk"
|
|
|
|
"--with-appresdir=${placeholder "out"}/lib/X11/app-defaults"
|
2021-01-15 09:19:50 +00:00
|
|
|
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
2020-12-25 00:00:00 +00:00
|
|
|
"gl_cv_func_signbit=yes"
|
2016-09-12 15:26:28 +00:00
|
|
|
];
|
2013-06-11 09:55:52 +00:00
|
|
|
|
2021-01-15 09:19:50 +00:00
|
|
|
makeFlags = lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
2010-08-21 16:54:24 +00:00
|
|
|
# Trick to get the build system find the proper 'native' groff
|
|
|
|
# http://www.mail-archive.com/bug-groff@gnu.org/msg01335.html
|
2018-05-10 17:46:38 +00:00
|
|
|
"GROFF_BIN_PATH=${buildPackages.groff}/bin"
|
|
|
|
"GROFFBIN=${buildPackages.groff}/bin/groff"
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = true;
|
2010-08-21 16:54:24 +00:00
|
|
|
|
2014-04-09 13:09:06 +00:00
|
|
|
postInstall = ''
|
2017-07-02 01:50:44 +00:00
|
|
|
for f in 'man.local' 'mdoc.local'; do
|
|
|
|
cat '${./site.tmac}' >>"$out/share/groff/site-tmac/$f"
|
|
|
|
done
|
2017-07-11 14:54:40 +00:00
|
|
|
|
|
|
|
moveToOutput bin/gropdf $perl
|
|
|
|
moveToOutput bin/pdfmom $perl
|
|
|
|
moveToOutput bin/roff2text $perl
|
|
|
|
moveToOutput bin/roff2pdf $perl
|
|
|
|
moveToOutput bin/roff2ps $perl
|
|
|
|
moveToOutput bin/roff2dvi $perl
|
|
|
|
moveToOutput bin/roff2ps $perl
|
|
|
|
moveToOutput bin/roff2html $perl
|
|
|
|
moveToOutput bin/glilypond $perl
|
|
|
|
moveToOutput bin/mmroff $perl
|
|
|
|
moveToOutput bin/roff2x $perl
|
|
|
|
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
|
|
|
|
|
2018-03-01 14:11:07 +00:00
|
|
|
find $perl/ -type f -print0 | xargs --null sed -i 's|${buildPackages.perl}|${perl}|'
|
2016-04-20 18:36:26 +00:00
|
|
|
'';
|
2014-04-09 13:09:06 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://www.gnu.org/software/groff/";
|
2009-01-10 23:35:15 +00:00
|
|
|
description = "GNU Troff, a typesetting package that reads plain text and produces formatted output";
|
2014-11-19 07:46:19 +00:00
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ pSub ];
|
2009-01-10 23:35:15 +00:00
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
groff is the GNU implementation of troff, a document formatting
|
|
|
|
system. Included in this release are implementations of troff,
|
|
|
|
pic, eqn, tbl, grn, refer, -man, -mdoc, -mom, and -ms macros,
|
|
|
|
and drivers for PostScript, TeX dvi format, HP LaserJet 4
|
|
|
|
printers, Canon CAPSL printers, HTML and XHTML format (beta
|
|
|
|
status), and typewriter-like devices. Also included is a
|
|
|
|
modified version of the Berkeley -me macros, the enhanced
|
|
|
|
version gxditview of the X11 xditview previewer, and an
|
|
|
|
implementation of the -mm macros.
|
|
|
|
'';
|
2017-07-11 14:54:40 +00:00
|
|
|
|
|
|
|
outputsToInstall = [ "out" "perl" ];
|
2005-08-21 13:59:04 +00:00
|
|
|
};
|
|
|
|
}
|