2013-08-15 19:48:14 +01:00
|
|
|
{ stdenv, fetchurl, pkgconfig, zlib, expat, openssl
|
|
|
|
, libjpeg, libpng, libtiff, freetype, fontconfig, lcms2, libpaper, jbig2dec
|
|
|
|
, libiconvOrEmpty
|
|
|
|
, x11Support ? false, x11 ? null
|
2009-01-17 13:08:51 +00:00
|
|
|
, cupsSupport ? false, cups ? null
|
2011-05-24 16:35:38 +01:00
|
|
|
, gnuFork ? true
|
2005-08-30 14:50:14 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
assert x11Support -> x11 != null;
|
2009-01-17 13:08:51 +00:00
|
|
|
assert cupsSupport -> cups != null;
|
2005-04-29 14:23:15 +01:00
|
|
|
|
2011-05-24 16:35:38 +01:00
|
|
|
let
|
2013-01-31 12:21:21 +00:00
|
|
|
meta_common = {
|
2012-09-06 17:34:18 +01:00
|
|
|
homepage = "http://www.gnu.org/software/ghostscript/";
|
2014-08-24 15:21:08 +01:00
|
|
|
description = "PostScript interpreter (GNU version)";
|
2010-09-17 15:46:49 +01:00
|
|
|
|
2011-05-24 16:35:38 +01: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.
|
|
|
|
'';
|
|
|
|
|
2014-06-19 05:19:00 +01:00
|
|
|
license = stdenv.lib.licenses.gpl3Plus;
|
2009-01-17 13:08:51 +00:00
|
|
|
|
2011-05-24 16:35:38 +01:00
|
|
|
platforms = stdenv.lib.platforms.all;
|
2013-08-16 22:44:33 +01:00
|
|
|
maintainers = [ stdenv.lib.maintainers.viric ];
|
2005-04-29 14:23:15 +01:00
|
|
|
};
|
|
|
|
|
2012-09-06 17:32:59 +01:00
|
|
|
gnuForkSrc = rec {
|
2012-01-03 17:50:10 +00:00
|
|
|
name = "ghostscript-9.04.1";
|
2011-05-24 16:35:38 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://gnu/ghostscript/gnu-${name}.tar.bz2";
|
2012-01-03 17:50:10 +00:00
|
|
|
sha256 = "0zqa6ggbkdqiszsywgrra4ij0sddlmrfa50bx2mh568qid4ga0a2";
|
2011-05-24 16:35:38 +01:00
|
|
|
};
|
|
|
|
|
2013-01-31 12:21:21 +00:00
|
|
|
meta = meta_common;
|
2012-03-08 22:28:26 +00:00
|
|
|
patches = [ ./purity.patch ];
|
2011-05-24 16:35:38 +01:00
|
|
|
};
|
|
|
|
|
2013-01-29 15:40:26 +00:00
|
|
|
mainlineSrc = rec {
|
2013-09-26 16:00:12 +01:00
|
|
|
name = "ghostscript-9.06";
|
2011-05-24 16:35:38 +01:00
|
|
|
src = fetchurl {
|
2013-01-29 15:40:26 +00:00
|
|
|
url = "http://downloads.ghostscript.com/public/${name}.tar.bz2";
|
2013-09-26 16:00:12 +01:00
|
|
|
sha256 = "014f10rxn4ihvcr1frby4szd1jvkrwvmdhnbivpp55c9fssx3b05";
|
2011-05-24 16:35:38 +01:00
|
|
|
};
|
2013-01-31 12:21:21 +00:00
|
|
|
meta = meta_common // {
|
2012-09-06 17:34:18 +01:00
|
|
|
homepage = "http://www.ghostscript.com/";
|
2014-08-24 15:21:08 +01:00
|
|
|
description = "PostScript interpreter (mainline version)";
|
2011-05-24 16:35:38 +01:00
|
|
|
};
|
2012-03-09 17:15:11 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
2013-08-15 19:48:14 +01:00
|
|
|
rm -R libpng jpeg lcms{,2} tiff freetype jbig2dec expat openjpeg
|
2013-01-29 15:40:26 +00: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 17:15:11 +00:00
|
|
|
'';
|
2013-01-29 15:40:26 +00:00
|
|
|
patches = [];
|
2011-05-24 16:35:38 +01:00
|
|
|
};
|
|
|
|
|
2012-09-06 17:32:59 +01:00
|
|
|
variant = if gnuFork then gnuForkSrc else mainlineSrc;
|
2011-05-24 16:35:38 +01:00
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
inherit (variant) name src meta;
|
|
|
|
|
2005-04-29 14:23:15 +01:00
|
|
|
fonts = [
|
|
|
|
(fetchurl {
|
2013-01-29 15:40:26 +00:00
|
|
|
url = "mirror://sourceforge/gs-fonts/ghostscript-fonts-std-8.11.tar.gz";
|
|
|
|
sha256 = "00f4l10xd826kak51wsmaz69szzm2wp8a41jasr4jblz25bg7dhf";
|
2008-07-17 20:37:18 +01:00
|
|
|
})
|
|
|
|
(fetchurl {
|
2012-09-06 17:34:18 +01:00
|
|
|
url = "mirror://gnu/ghostscript/gnu-gs-fonts-other-6.0.tar.gz";
|
2008-07-17 20:37:18 +01:00
|
|
|
sha256 = "1cxaah3r52qq152bbkiyj2f7dx1rf38vsihlhjmrvzlr8v6cqil1";
|
2005-04-29 14:23:15 +01:00
|
|
|
})
|
|
|
|
# ... add other fonts here
|
|
|
|
];
|
|
|
|
|
2013-09-26 16:00:12 +01:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
buildInputs =
|
|
|
|
[ pkgconfig zlib expat openssl
|
|
|
|
libjpeg libpng libtiff freetype fontconfig lcms2 libpaper jbig2dec
|
|
|
|
]
|
|
|
|
++ stdenv.lib.optional x11Support x11
|
2013-01-29 15:40:26 +00:00
|
|
|
++ stdenv.lib.optional cupsSupport cups
|
2013-06-13 06:52:55 +01:00
|
|
|
++ libiconvOrEmpty
|
2013-01-29 15:40:26 +00:00
|
|
|
# [] # maybe sometimes jpeg2000 support
|
|
|
|
;
|
2005-04-29 14:23:15 +01:00
|
|
|
|
2010-09-20 21:46:27 +01:00
|
|
|
CFLAGS = "-fPIC";
|
2012-03-16 14:27:58 +00:00
|
|
|
NIX_LDFLAGS =
|
|
|
|
"-lz -rpath${ if stdenv.isDarwin then " " else "="}${freetype}/lib";
|
2012-01-03 17:50:10 +00:00
|
|
|
|
2012-03-08 22:28:26 +00:00
|
|
|
patches = variant.patches ++ [ ./urw-font-files.patch ];
|
2010-09-20 21:46:27 +01:00
|
|
|
|
2012-01-03 17:50:10 +00: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 17:15:11 +00:00
|
|
|
'' + stdenv.lib.optionalString (variant ? preConfigure) variant.preConfigure;
|
2012-01-03 17:50:10 +00:00
|
|
|
|
2013-09-26 16:00:12 +01: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 20:37:18 +01:00
|
|
|
|
|
|
|
doCheck = true;
|
2012-01-03 17:50:10 +00:00
|
|
|
|
2012-01-11 23:14:12 +00:00
|
|
|
installTargets="install soinstall";
|
2012-01-04 00:26:48 +00:00
|
|
|
|
2013-01-29 15:40:26 +00:00
|
|
|
# ToDo: web says the fonts should be already included
|
2012-01-03 17:50:10 +00:00
|
|
|
postInstall = ''
|
|
|
|
for i in $fonts; do
|
|
|
|
(cd $out/share/ghostscript && tar xvfz $i)
|
|
|
|
done
|
|
|
|
'';
|
2005-04-29 14:23:15 +01:00
|
|
|
}
|