2017-02-18 04:17:34 +01:00
|
|
|
{ lib, stdenv, fetchsvn, pkgconfig, libjpeg, libpng, flex, zlib, perl, libxml2
|
2014-09-24 23:47:44 +02:00
|
|
|
, makeWrapper, libtiff
|
|
|
|
, enableX11 ? false, libX11 }:
|
2009-02-25 23:44:08 +01:00
|
|
|
|
2014-09-24 23:47:44 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2017-02-18 04:17:34 +01:00
|
|
|
# Determine version and revision from:
|
|
|
|
# https://sourceforge.net/p/netpbm/code/HEAD/log/?path=/advanced
|
2018-06-22 20:31:54 +02:00
|
|
|
name = "netpbm-10.82.01";
|
2009-02-25 23:44:08 +01:00
|
|
|
|
2017-02-18 04:17:34 +01:00
|
|
|
src = fetchsvn {
|
2018-03-13 14:11:35 +01:00
|
|
|
url = "https://svn.code.sf.net/p/netpbm/code/advanced";
|
2018-06-22 20:31:54 +02:00
|
|
|
rev = 3264;
|
|
|
|
sha256 = "17fmyjbxp1l18rma7gb0m8wd9kx2iwhqs8dd6fpalsn2cr8mf8hf";
|
2009-02-25 23:44:08 +01:00
|
|
|
};
|
|
|
|
|
2013-12-25 11:08:19 +01:00
|
|
|
postPatch = /* CVE-2005-2471, from Arch */ ''
|
|
|
|
substituteInPlace converter/other/pstopnm.c \
|
|
|
|
--replace '"-DSAFER"' '"-DPARANOIDSAFER"'
|
|
|
|
'';
|
|
|
|
|
2014-09-24 23:47:44 +02:00
|
|
|
buildInputs =
|
|
|
|
[ pkgconfig flex zlib perl libpng libjpeg libxml2 makeWrapper libtiff ]
|
|
|
|
++ lib.optional enableX11 libX11;
|
2009-02-25 23:44:08 +01:00
|
|
|
|
2013-07-19 19:42:11 +02:00
|
|
|
configurePhase = ''
|
|
|
|
cp config.mk.in config.mk
|
2014-09-24 23:47:44 +02:00
|
|
|
echo "STATICLIB_TOO = n" >> config.mk
|
2013-07-19 19:42:11 +02:00
|
|
|
substituteInPlace "config.mk" \
|
2016-01-24 08:29:42 +01:00
|
|
|
--replace "TIFFLIB = NONE" "TIFFLIB = ${libtiff.out}/lib/libtiff.so" \
|
2016-12-28 19:48:50 +01:00
|
|
|
--replace "TIFFHDR_DIR =" "TIFFHDR_DIR = ${libtiff.dev}/include" \
|
|
|
|
--replace "JPEGLIB = NONE" "JPEGLIB = ${libjpeg.out}/lib/libjpeg.so" \
|
|
|
|
--replace "JPEGHDR_DIR =" "JPEGHDR_DIR = ${libjpeg.dev}/include"
|
2016-12-16 10:30:50 +01:00
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
|
|
|
echo "LDSHLIB=-dynamiclib -install_name $out/lib/libnetpbm.\$(MAJ).dylib" >> config.mk
|
|
|
|
echo "NETPBMLIBTYPE = dylib" >> config.mk
|
|
|
|
echo "NETPBMLIBSUFFIX = dylib" >> config.mk
|
2013-07-19 19:42:11 +02:00
|
|
|
'';
|
2009-02-25 23:44:08 +01:00
|
|
|
|
2010-01-13 22:16:12 +01:00
|
|
|
preBuild = ''
|
2013-07-19 19:42:11 +02:00
|
|
|
export LDFLAGS="-lz"
|
2010-01-13 22:16:12 +01:00
|
|
|
substituteInPlace "pm_config.in.h" \
|
|
|
|
--subst-var-by "rgbPath1" "$out/lib/rgb.txt" \
|
|
|
|
--subst-var-by "rgbPath2" "/var/empty/rgb.txt" \
|
|
|
|
--subst-var-by "rgbPath3" "/var/empty/rgb.txt"
|
2013-07-23 11:12:03 +02:00
|
|
|
touch lib/standardppmdfont.c
|
2010-01-13 22:16:12 +01:00
|
|
|
'';
|
2010-01-13 22:14:10 +01:00
|
|
|
|
2016-02-28 12:59:17 +01:00
|
|
|
enableParallelBuilding = false;
|
2013-07-23 11:12:03 +02:00
|
|
|
|
2009-02-25 23:44:08 +01:00
|
|
|
installPhase = ''
|
2014-09-24 23:47:44 +02:00
|
|
|
make package pkgdir=$out
|
|
|
|
|
|
|
|
rm -rf $out/link $out/*_template $out/{pkginfo,README,VERSION} $out/man/web
|
|
|
|
|
|
|
|
mkdir -p $out/share/netpbm
|
|
|
|
mv $out/misc $out/share/netpbm/
|
2010-01-13 22:16:12 +01:00
|
|
|
|
|
|
|
# wrap any scripts that expect other programs in the package to be in their PATH
|
|
|
|
for prog in ppmquant; do
|
|
|
|
wrapProgram "$out/bin/$prog" --prefix PATH : "$out/bin"
|
|
|
|
done
|
2009-02-25 23:44:08 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = http://netpbm.sourceforge.net/;
|
|
|
|
description = "Toolkit for manipulation of graphic images";
|
|
|
|
license = "GPL,free";
|
2016-12-16 10:30:50 +01:00
|
|
|
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
2009-02-25 23:44:08 +01:00
|
|
|
};
|
|
|
|
}
|