Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-18.03 128 lines 3.9 kB view raw
1{ stdenv, lib, fetchurl, fetchpatch, pkgconfig, zlib, expat, openssl, autoconf 2, libjpeg, libpng, libtiff, freetype, fontconfig, libpaper, jbig2dec 3, libiconv, ijs 4, x11Support ? false, xlibsWrapper ? null 5, cupsSupport ? false, cups ? null 6}: 7 8assert x11Support -> xlibsWrapper != null; 9assert cupsSupport -> cups != null; 10let 11 version = "9.${ver_min}"; 12 ver_min = "25"; 13 sha512 = "18pcqzva7pq2a9mmqf9pq8x4winb6qmzni49vq2qx50k60rwyv1kdmixik3ym2bpj5p1j8g0vb47w7w2cf4lba5q583ylpd8rshn73s"; 14 15 fonts = stdenv.mkDerivation { 16 name = "ghostscript-fonts"; 17 18 srcs = [ 19 (fetchurl { 20 url = "mirror://sourceforge/gs-fonts/ghostscript-fonts-std-8.11.tar.gz"; 21 sha256 = "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf"; 22 }) 23 (fetchurl { 24 url = "mirror://gnu/ghostscript/gnu-gs-fonts-other-6.0.tar.gz"; 25 sha256 = "1cxaah3r52qq152bbkiyj2f7dx1rf38vsihlhjmrvzlr8v6cqil1"; 26 }) 27 # ... add other fonts here 28 ]; 29 30 installPhase = '' 31 mkdir "$out" 32 mv -v * "$out/" 33 ''; 34 }; 35 36in 37stdenv.mkDerivation rec { 38 name = "ghostscript-${version}"; 39 40 src = fetchurl { 41 url = "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs9${ver_min}/${name}.tar.xz"; 42 inherit sha512; 43 }; 44 45 patches = [ 46 ./urw-font-files.patch 47 ./doc-no-ref.diff 48 ]; 49 50 outputs = [ "out" "man" "doc" ]; 51 52 enableParallelBuilding = true; 53 54 nativeBuildInputs = [ pkgconfig autoconf ]; 55 buildInputs = 56 [ zlib expat openssl 57 libjpeg libpng libtiff freetype fontconfig libpaper jbig2dec 58 libiconv ijs 59 ] 60 ++ lib.optional x11Support xlibsWrapper 61 ++ lib.optional cupsSupport cups 62 ; 63 # No lcms2; upstream "is in process of forking it" and thus won't use one from a library. 64 65 preConfigure = '' 66 # requires in-tree (heavily patched) openjpeg 67 rm -rf jpeg libpng zlib jasper expat tiff lcms{,2} jbig2dec freetype cups/libs ijs 68 69 sed "s@if ( test -f \$(INCLUDE)[^ ]* )@if ( true )@; s@INCLUDE=/usr/include@INCLUDE=/no-such-path@" -i base/unix-aux.mak 70 sed "s@^ZLIBDIR=.*@ZLIBDIR=${zlib.dev}/include@" -i configure.ac 71 72 autoconf 73 '' + lib.optionalString cupsSupport '' 74 configureFlags="$configureFlags --with-cups-serverbin=$out/lib/cups --with-cups-serverroot=$out/etc/cups --with-cups-datadir=$out/share/cups" 75 ''; 76 77 configureFlags = 78 [ "--with-system-libtiff" 79 "--enable-dynamic" 80 ] ++ lib.optional x11Support "--with-x" 81 ++ lib.optional cupsSupport "--enable-cups"; 82 83 doCheck = true; 84 85 # don't build/install statically linked bin/gs 86 buildFlags = [ "so" ]; 87 installTargets = [ "soinstall" ]; 88 89 postInstall = '' 90 ln -s gsc "$out"/bin/gs 91 92 cp -r Resource "$out/share/ghostscript/${version}" 93 94 mkdir -p "$doc/share/doc/ghostscript" 95 mv "$doc/share/doc/${version}" "$doc/share/doc/ghostscript/" 96 97 ln -s "${fonts}" "$out/share/ghostscript/fonts" 98 '' + stdenv.lib.optionalString stdenv.isDarwin '' 99 for file in $out/lib/*.dylib* ; do 100 install_name_tool -id "$file" $file 101 done 102 ''; 103 104 preFixup = lib.optionalString stdenv.isDarwin '' 105 install_name_tool -change libgs.dylib.${version} $out/lib/libgs.dylib.${version} $out/bin/gs 106 ''; 107 108 passthru = { inherit version; }; 109 110 meta = { 111 homepage = https://www.ghostscript.com/; 112 description = "PostScript interpreter (mainline version)"; 113 114 longDescription = '' 115 Ghostscript is the name of a set of tools that provides (i) an 116 interpreter for the PostScript language and the PDF file format, 117 (ii) a set of C procedures (the Ghostscript library) that 118 implement the graphics capabilities that appear as primitive 119 operations in the PostScript language, and (iii) a wide variety 120 of output drivers for various file formats and printers. 121 ''; 122 123 license = stdenv.lib.licenses.agpl3; 124 125 platforms = stdenv.lib.platforms.all; 126 maintainers = [ stdenv.lib.maintainers.viric ]; 127 }; 128}