2020-02-20 07:53:04 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchsvn
|
|
|
|
, pkgconfig
|
|
|
|
, libjpeg
|
|
|
|
, libpng
|
|
|
|
, flex
|
|
|
|
, zlib
|
|
|
|
, perl
|
|
|
|
, libxml2
|
|
|
|
, makeWrapper
|
|
|
|
, libtiff
|
|
|
|
, enableX11 ? false
|
|
|
|
, libX11
|
|
|
|
}:
|
2009-02-25 22:44:08 +00:00
|
|
|
|
2019-08-13 22:52:01 +01:00
|
|
|
stdenv.mkDerivation {
|
2017-02-18 03:17:34 +00:00
|
|
|
# Determine version and revision from:
|
|
|
|
# https://sourceforge.net/p/netpbm/code/HEAD/log/?path=/advanced
|
2020-02-24 21:21:55 +00:00
|
|
|
name = "netpbm-10.89.1";
|
2009-02-25 22:44:08 +00:00
|
|
|
|
2020-02-25 23:41:09 +00:00
|
|
|
outputs = [ "bin" "out" "dev" ];
|
|
|
|
|
2017-02-18 03:17:34 +00:00
|
|
|
src = fetchsvn {
|
2018-03-13 13:11:35 +00:00
|
|
|
url = "https://svn.code.sf.net/p/netpbm/code/advanced";
|
2020-02-24 21:21:55 +00:00
|
|
|
rev = "3735";
|
|
|
|
sha256 = "hRepEUBlf83p77Amjze+Qz7XTHhCuPdV01K/UabR89Q=";
|
2009-02-25 22:44:08 +00:00
|
|
|
};
|
|
|
|
|
2020-02-24 21:21:55 +00:00
|
|
|
postPatch = ''
|
|
|
|
# CVE-2005-2471, from Arch
|
2013-12-25 10:08:19 +00:00
|
|
|
substituteInPlace converter/other/pstopnm.c \
|
2020-02-22 13:28:32 +00:00
|
|
|
--replace '"-dSAFER"' '"-dPARANOIDSAFER"'
|
2020-02-24 21:21:55 +00:00
|
|
|
|
|
|
|
# Install libnetpbm.so symlink to correct destination
|
|
|
|
substituteInPlace lib/Makefile \
|
|
|
|
--replace '/sharedlink' '/lib'
|
2013-12-25 10:08:19 +00:00
|
|
|
'';
|
|
|
|
|
2020-02-20 07:53:04 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkgconfig
|
|
|
|
flex
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
zlib
|
|
|
|
perl
|
|
|
|
libpng
|
|
|
|
libjpeg
|
|
|
|
libxml2
|
|
|
|
libtiff
|
|
|
|
] ++ lib.optional enableX11 libX11;
|
2009-02-25 22:44:08 +00:00
|
|
|
|
2013-07-19 18:42:11 +01:00
|
|
|
configurePhase = ''
|
2020-02-24 23:03:06 +00:00
|
|
|
runHook preConfigure
|
|
|
|
|
2013-07-19 18:42:11 +01:00
|
|
|
cp config.mk.in config.mk
|
2014-09-24 22:47:44 +01:00
|
|
|
echo "STATICLIB_TOO = n" >> config.mk
|
2013-07-19 18:42:11 +01:00
|
|
|
substituteInPlace "config.mk" \
|
2016-01-24 07:29:42 +00:00
|
|
|
--replace "TIFFLIB = NONE" "TIFFLIB = ${libtiff.out}/lib/libtiff.so" \
|
2016-12-28 18:48:50 +00:00
|
|
|
--replace "TIFFHDR_DIR =" "TIFFHDR_DIR = ${libtiff.dev}/include" \
|
2020-02-25 23:14:24 +00:00
|
|
|
--replace "TIFFLIB_NEEDS_JPEG = Y" "TIFFLIB_NEEDS_JPEG = N" \
|
|
|
|
--replace "TIFFLIB_NEEDS_Z = Y" "TIFFLIB_NEEDS_Z = N" \
|
2016-12-28 18:48:50 +00:00
|
|
|
--replace "JPEGLIB = NONE" "JPEGLIB = ${libjpeg.out}/lib/libjpeg.so" \
|
|
|
|
--replace "JPEGHDR_DIR =" "JPEGHDR_DIR = ${libjpeg.dev}/include"
|
2020-02-20 07:53:04 +00:00
|
|
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
2016-12-16 09:30:50 +00:00
|
|
|
echo "LDSHLIB=-dynamiclib -install_name $out/lib/libnetpbm.\$(MAJ).dylib" >> config.mk
|
|
|
|
echo "NETPBMLIBTYPE = dylib" >> config.mk
|
|
|
|
echo "NETPBMLIBSUFFIX = dylib" >> config.mk
|
2020-02-24 23:03:06 +00:00
|
|
|
|
|
|
|
runHook postConfigure
|
2013-07-19 18:42:11 +01:00
|
|
|
'';
|
2009-02-25 22:44:08 +00:00
|
|
|
|
2010-01-13 21:16:12 +00:00
|
|
|
preBuild = ''
|
2013-07-19 18:42:11 +01:00
|
|
|
export LDFLAGS="-lz"
|
2010-01-13 21:16:12 +00: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 10:12:03 +01:00
|
|
|
touch lib/standardppmdfont.c
|
2010-01-13 21:16:12 +00:00
|
|
|
'';
|
2010-01-13 21:14:10 +00:00
|
|
|
|
2016-02-28 11:59:17 +00:00
|
|
|
enableParallelBuilding = false;
|
2013-07-23 10:12:03 +01:00
|
|
|
|
2009-02-25 22:44:08 +00:00
|
|
|
installPhase = ''
|
2020-02-24 23:03:06 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2014-09-24 22:47:44 +01:00
|
|
|
make package pkgdir=$out
|
|
|
|
|
2020-02-24 21:21:55 +00:00
|
|
|
rm -rf $out/*_template $out/{pkginfo,README,VERSION} $out/man/web
|
2014-09-24 22:47:44 +01:00
|
|
|
|
|
|
|
mkdir -p $out/share/netpbm
|
|
|
|
mv $out/misc $out/share/netpbm/
|
2010-01-13 21:16:12 +00: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
|
2020-02-24 23:03:06 +00:00
|
|
|
|
2020-02-25 23:41:09 +00:00
|
|
|
moveToOutput bin "''${!outputBin}"
|
|
|
|
|
2020-02-24 23:03:06 +00:00
|
|
|
runHook postInstall
|
2009-02-25 22:44:08 +00:00
|
|
|
'';
|
|
|
|
|
2020-02-24 21:21:27 +00:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2009-02-25 22:44:08 +00:00
|
|
|
meta = {
|
2020-02-20 07:53:04 +00:00
|
|
|
homepage = "http://netpbm.sourceforge.net/";
|
2009-02-25 22:44:08 +00:00
|
|
|
description = "Toolkit for manipulation of graphic images";
|
2020-02-20 07:53:04 +00:00
|
|
|
license = lib.licenses.free; # http://netpbm.svn.code.sourceforge.net/p/netpbm/code/trunk/doc/copyright_summary
|
2016-12-16 09:30:50 +00:00
|
|
|
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
2009-02-25 22:44:08 +00:00
|
|
|
};
|
|
|
|
}
|