2013-01-29 16:40:26 +01:00
|
|
|
{ stdenv, fetchurl, libjpeg, libpng, libtiff, zlib, pkgconfig, fontconfig, openssl
|
|
|
|
, lcms2, freetype, libpaper, jbig2dec, expat
|
2005-08-30 15:50:14 +02:00
|
|
|
, x11Support, 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
|
|
|
|
meta = {
|
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;
|
|
|
|
maintainers = [ stdenv.lib.maintainers.ludo 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
|
|
|
};
|
|
|
|
|
|
|
|
inherit meta;
|
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 {
|
|
|
|
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";
|
|
|
|
sha256 = "014f10rxn4ihvcr1frby4szd1jvkrwvmdhnbivpp55c9fssx3b05";
|
2011-05-24 17:35:38 +02:00
|
|
|
};
|
|
|
|
meta = meta // {
|
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-01-29 16:40:26 +01:00
|
|
|
rm -R libpng jpeg lcms{,2} tiff freetype jbig2dec expat jasper openjpeg
|
|
|
|
|
|
|
|
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-01-29 16:40:26 +01:00
|
|
|
buildInputs = [
|
|
|
|
libjpeg libpng libtiff zlib pkgconfig fontconfig openssl lcms2
|
|
|
|
libpaper jbig2dec expat
|
|
|
|
] ++ stdenv.lib.optionals x11Support [x11 freetype]
|
|
|
|
++ stdenv.lib.optional cupsSupport cups
|
|
|
|
# [] # 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-01-29 13:32:55 +01:00
|
|
|
configureFlags = [ "--with-system-libtiff" ] ++
|
2012-01-12 00:14:07 +01:00
|
|
|
(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
|
|
|
}
|