2013-08-15 20:48:14 +02:00
|
|
|
{ stdenv, fetchurl, pkgconfig, zlib, expat, openssl
|
|
|
|
, libjpeg, libpng, libtiff, freetype, fontconfig, lcms2, libpaper, jbig2dec
|
|
|
|
, libiconvOrEmpty
|
|
|
|
, x11Support ? false, x11 ? null
|
2009-01-17 14:08:51 +01:00
|
|
|
, cupsSupport ? false, cups ? null
|
2011-05-24 17:35:38 +02:00
|
|
|
, gnuFork ? true
|
2005-08-30 15:50:14 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert x11Support -> x11 != null;
|
2009-01-17 14:08:51 +01:00
|
|
|
assert cupsSupport -> cups != null;
|
2005-04-29 15:23:15 +02:00
|
|
|
|
2011-05-24 17:35:38 +02:00
|
|
|
let
|
2013-01-31 13:21:21 +01:00
|
|
|
meta_common = {
|
2012-09-06 18:34:18 +02:00
|
|
|
homepage = "http://www.gnu.org/software/ghostscript/";
|
2011-05-24 17:35:38 +02:00
|
|
|
description = "GNU Ghostscript, a PostScript interpreter";
|
2010-09-17 16:46:49 +02:00
|
|
|
|
2011-05-24 17:35:38 +02:00
|
|
|
longDescription = ''
|
|
|
|
Ghostscript is the name of a set of tools that provides (i) an
|
|
|
|
interpreter for the PostScript language and the PDF file format,
|
|
|
|
(ii) a set of C procedures (the Ghostscript library) that
|
|
|
|
implement the graphics capabilities that appear as primitive
|
|
|
|
operations in the PostScript language, and (iii) a wide variety
|
|
|
|
of output drivers for various file formats and printers.
|
|
|
|
'';
|
|
|
|
|
|
|
|
license = "GPLv3+";
|
2009-01-17 14:08:51 +01:00
|
|
|
|
2011-05-24 17:35:38 +02:00
|
|
|
platforms = stdenv.lib.platforms.all;
|
2013-08-16 23:44:33 +02:00
|
|
|
maintainers = [ stdenv.lib.maintainers.viric ];
|
2005-04-29 15:23:15 +02:00
|
|
|
};
|
|
|
|
|
2012-09-06 18:32:59 +02:00
|
|
|
gnuForkSrc = rec {
|
2012-01-03 18:50:10 +01:00
|
|
|
name = "ghostscript-9.04.1";
|
2011-05-24 17:35:38 +02:00
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://gnu/ghostscript/gnu-${name}.tar.bz2";
|
2012-01-03 18:50:10 +01:00
|
|
|
sha256 = "0zqa6ggbkdqiszsywgrra4ij0sddlmrfa50bx2mh568qid4ga0a2";
|
2011-05-24 17:35:38 +02:00
|
|
|
};
|
|
|
|
|
2013-01-31 13:21:21 +01:00
|
|
|
meta = meta_common;
|
2012-03-08 23:28:26 +01:00
|
|
|
patches = [ ./purity.patch ];
|
2011-05-24 17:35:38 +02:00
|
|
|
};
|
|
|
|
|
2013-01-29 16:40:26 +01:00
|
|
|
mainlineSrc = rec {
|
2013-09-26 17:00:12 +02:00
|
|
|
name = "ghostscript-9.06";
|
2011-05-24 17:35:38 +02:00
|
|
|
src = fetchurl {
|
2013-01-29 16:40:26 +01:00
|
|
|
url = "http://downloads.ghostscript.com/public/${name}.tar.bz2";
|
2013-09-26 17:00:12 +02:00
|
|
|
sha256 = "014f10rxn4ihvcr1frby4szd1jvkrwvmdhnbivpp55c9fssx3b05";
|
2011-05-24 17:35:38 +02:00
|
|
|
};
|
2013-01-31 13:21:21 +01:00
|
|
|
meta = meta_common // {
|
2012-09-06 18:34:18 +02:00
|
|
|
homepage = "http://www.ghostscript.com/";
|
2011-05-24 17:35:38 +02:00
|
|
|
description = "GPL Ghostscript, a PostScript interpreter";
|
|
|
|
};
|
2012-03-09 18:15:11 +01:00
|
|
|
|
|
|
|
preConfigure = ''
|
2013-08-15 20:48:14 +02:00
|
|
|
rm -R libpng jpeg lcms{,2} tiff freetype jbig2dec expat openjpeg
|
2013-01-29 16:40:26 +01:00
|
|
|
|
|
|
|
substituteInPlace base/unix-aux.mak --replace "INCLUDE=/usr/include" "INCLUDE=/no-such-path"
|
|
|
|
sed "s@if ( test -f \$(INCLUDE)[^ ]* )@if ( true )@" -i base/unix-aux.mak
|
2012-03-09 18:15:11 +01:00
|
|
|
'';
|
2013-01-29 16:40:26 +01:00
|
|
|
patches = [];
|
2011-05-24 17:35:38 +02:00
|
|
|
};
|
|
|
|
|
2012-09-06 18:32:59 +02:00
|
|
|
variant = if gnuFork then gnuForkSrc else mainlineSrc;
|
2011-05-24 17:35:38 +02:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
inherit (variant) name src meta;
|
|
|
|
|
2005-04-29 15:23:15 +02:00
|
|
|
fonts = [
|
|
|
|
(fetchurl {
|
2013-01-29 16:40:26 +01:00
|
|
|
url = "mirror://sourceforge/gs-fonts/ghostscript-fonts-std-8.11.tar.gz";
|
|
|
|
sha256 = "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf";
|
2008-07-17 21:37:18 +02:00
|
|
|
})
|
|
|
|
(fetchurl {
|
2012-09-06 18:34:18 +02:00
|
|
|
url = "mirror://gnu/ghostscript/gnu-gs-fonts-other-6.0.tar.gz";
|
2008-07-17 21:37:18 +02:00
|
|
|
sha256 = "1cxaah3r52qq152bbkiyj2f7dx1rf38vsihlhjmrvzlr8v6cqil1";
|
2005-04-29 15:23:15 +02:00
|
|
|
})
|
|
|
|
# ... add other fonts here
|
|
|
|
];
|
|
|
|
|
2013-09-26 17:00:12 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
[ pkgconfig zlib expat openssl
|
|
|
|
libjpeg libpng libtiff freetype fontconfig lcms2 libpaper jbig2dec
|
|
|
|
]
|
|
|
|
++ stdenv.lib.optional x11Support x11
|
2013-01-29 16:40:26 +01:00
|
|
|
++ stdenv.lib.optional cupsSupport cups
|
2013-06-13 07:52:55 +02:00
|
|
|
++ libiconvOrEmpty
|
2013-01-29 16:40:26 +01:00
|
|
|
# [] # maybe sometimes jpeg2000 support
|
|
|
|
;
|
2005-04-29 15:23:15 +02:00
|
|
|
|
2010-09-20 22:46:27 +02:00
|
|
|
CFLAGS = "-fPIC";
|
2012-03-16 15:27:58 +01:00
|
|
|
NIX_LDFLAGS =
|
|
|
|
"-lz -rpath${ if stdenv.isDarwin then " " else "="}${freetype}/lib";
|
2012-01-03 18:50:10 +01:00
|
|
|
|
2012-03-08 23:28:26 +01:00
|
|
|
patches = variant.patches ++ [ ./urw-font-files.patch ];
|
2010-09-20 22:46:27 +02:00
|
|
|
|
2012-01-03 18:50:10 +01:00
|
|
|
preConfigure = ''
|
|
|
|
# "ijs" is impure: it contains symlinks to /usr/share/automake etc.!
|
|
|
|
rm -rf ijs/ltmain.sh
|
|
|
|
|
|
|
|
# Don't install stuff in the Cups store path.
|
|
|
|
makeFlagsArray=(CUPSSERVERBIN=$out/lib/cups CUPSSERVERROOT=$out/etc/cups CUPSDATA=$out/share/cups)
|
2012-03-09 18:15:11 +01:00
|
|
|
'' + stdenv.lib.optionalString (variant ? preConfigure) variant.preConfigure;
|
2012-01-03 18:50:10 +01:00
|
|
|
|
2013-09-26 17:00:12 +02:00
|
|
|
configureFlags =
|
|
|
|
[ "--with-system-libtiff"
|
|
|
|
(if x11Support then "--with-x" else "--without-x")
|
|
|
|
(if cupsSupport then "--enable-cups --with-install-cups" else "--disable-cups")
|
|
|
|
];
|
2008-07-17 21:37:18 +02:00
|
|
|
|
|
|
|
doCheck = true;
|
2012-01-03 18:50:10 +01:00
|
|
|
|
2012-01-12 00:14:12 +01:00
|
|
|
installTargets="install soinstall";
|
2012-01-04 01:26:48 +01:00
|
|
|
|
2013-01-29 16:40:26 +01:00
|
|
|
# ToDo: web says the fonts should be already included
|
2012-01-03 18:50:10 +01:00
|
|
|
postInstall = ''
|
|
|
|
for i in $fonts; do
|
|
|
|
(cd $out/share/ghostscript && tar xvfz $i)
|
|
|
|
done
|
|
|
|
'';
|
2005-04-29 15:23:15 +02:00
|
|
|
}
|