at 18.09-beta 130 lines 4.9 kB view raw
1{ stdenv, fetchurl, perl 2, ghostscript #for postscript and html output 3, psutils, netpbm #for html output 4, buildPackages 5, autoreconfHook 6}: 7 8stdenv.mkDerivation rec { 9 name = "groff-${version}"; 10 version = "1.22.3"; 11 12 src = fetchurl { 13 url = "mirror://gnu/groff/${name}.tar.gz"; 14 sha256 = "1998v2kcs288d3y7kfxpvl369nqi06zbbvjzafyvyl3pr7bajj1s"; 15 }; 16 17 outputs = [ "out" "man" "doc" "info" "perl" ]; 18 19 enableParallelBuilding = false; 20 21 patches = [ ./look-for-ar.patch ]; 22 23 postPatch = stdenv.lib.optionalString (psutils != null) '' 24 substituteInPlace src/preproc/html/pre-html.cpp \ 25 --replace "psselect" "${psutils}/bin/psselect" 26 '' + stdenv.lib.optionalString (netpbm != null) '' 27 substituteInPlace src/preproc/html/pre-html.cpp \ 28 --replace "pnmcut" "${netpbm}/bin/pnmcut" \ 29 --replace "pnmcrop" "${netpbm}/bin/pnmcrop" \ 30 --replace "pnmtopng" "${netpbm}/bin/pnmtopng" 31 substituteInPlace tmac/www.tmac \ 32 --replace "pnmcrop" "${netpbm}/bin/pnmcrop" \ 33 --replace "pngtopnm" "${netpbm}/bin/pngtopnm" \ 34 --replace "@PNMTOPS_NOSETPAGE@" "${netpbm}/bin/pnmtops -nosetpage" 35 ''; 36 37 buildInputs = [ ghostscript psutils netpbm perl ]; 38 nativeBuildInputs = [ autoreconfHook ]; 39 40 # Builds running without a chroot environment may detect the presence 41 # of /usr/X11 in the host system, leading to an impure build of the 42 # package. To avoid this issue, X11 support is explicitly disabled. 43 # Note: If we ever want to *enable* X11 support, then we'll probably 44 # have to pass "--with-appresdir", too. 45 configureFlags = [ 46 "--without-x" 47 ] ++ stdenv.lib.optionals (ghostscript != null) [ 48 "--with-gs=${ghostscript}/bin/gs" 49 ] ++ stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ 50 "ac_cv_path_PERL=${buildPackages.perl}/bin/perl" 51 ]; 52 53 makeFlags = stdenv.lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ 54 # Trick to get the build system find the proper 'native' groff 55 # http://www.mail-archive.com/bug-groff@gnu.org/msg01335.html 56 "GROFF_BIN_PATH=${buildPackages.groff}/bin" 57 "GROFFBIN=${buildPackages.groff}/bin/groff" 58 ]; 59 60 doCheck = true; 61 62 # Remove example output with (random?) colors and creation date 63 # to avoid non-determinism in the output. 64 postInstall = '' 65 rm "$doc"/share/doc/groff/examples/hdtbl/*color*ps 66 find "$doc"/share/doc/groff/ -type f -print0 | xargs -0 sed -i -e 's/%%CreationDate: .*//' 67 for f in 'man.local' 'mdoc.local'; do 68 cat '${./site.tmac}' >>"$out/share/groff/site-tmac/$f" 69 done 70 71 moveToOutput bin/gropdf $perl 72 moveToOutput bin/pdfmom $perl 73 moveToOutput bin/roff2text $perl 74 moveToOutput bin/roff2pdf $perl 75 moveToOutput bin/roff2ps $perl 76 moveToOutput bin/roff2dvi $perl 77 moveToOutput bin/roff2ps $perl 78 moveToOutput bin/roff2html $perl 79 moveToOutput bin/glilypond $perl 80 moveToOutput bin/mmroff $perl 81 moveToOutput bin/roff2x $perl 82 moveToOutput bin/afmtodit $perl 83 moveToOutput bin/gperl $perl 84 moveToOutput bin/chem $perl 85 moveToOutput share/groff/${version}/font/devpdf $perl 86 87 # idk if this is needed, but Fedora does it 88 moveToOutput share/groff/${version}/tmac/pdf.tmac $perl 89 90 moveToOutput bin/gpinyin $perl 91 moveToOutput lib/groff/gpinyin $perl 92 substituteInPlace $perl/bin/gpinyin \ 93 --replace $out/lib/groff/gpinyin $perl/lib/groff/gpinyin 94 95 moveToOutput bin/groffer $perl 96 moveToOutput lib/groff/groffer $perl 97 substituteInPlace $perl/bin/groffer \ 98 --replace $out/lib/groff/groffer $perl/lib/groff/groffer 99 100 moveToOutput bin/grog $perl 101 moveToOutput lib/groff/grog $perl 102 substituteInPlace $perl/bin/grog \ 103 --replace $out/lib/groff/grog $perl/lib/groff/grog 104 105 '' + stdenv.lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) '' 106 find $perl/ -type f -print0 | xargs --null sed -i 's|${buildPackages.perl}|${perl}|' 107 ''; 108 109 meta = with stdenv.lib; { 110 homepage = http://www.gnu.org/software/groff/; 111 description = "GNU Troff, a typesetting package that reads plain text and produces formatted output"; 112 license = licenses.gpl3Plus; 113 platforms = platforms.all; 114 maintainers = with maintainers; [ pSub ]; 115 116 longDescription = '' 117 groff is the GNU implementation of troff, a document formatting 118 system. Included in this release are implementations of troff, 119 pic, eqn, tbl, grn, refer, -man, -mdoc, -mom, and -ms macros, 120 and drivers for PostScript, TeX dvi format, HP LaserJet 4 121 printers, Canon CAPSL printers, HTML and XHTML format (beta 122 status), and typewriter-like devices. Also included is a 123 modified version of the Berkeley -me macros, the enhanced 124 version gxditview of the X11 xditview previewer, and an 125 implementation of the -mm macros. 126 ''; 127 128 outputsToInstall = [ "out" "perl" ]; 129 }; 130}