1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-22 21:50:55 +00:00
nixpkgs/pkgs/tools/graphics/netpbm/default.nix

71 lines
2.3 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchsvn, pkgconfig, libjpeg, libpng, flex, zlib, perl, libxml2
, makeWrapper, libtiff
, enableX11 ? false, libX11 }:
2019-08-13 22:52:01 +01:00
stdenv.mkDerivation {
# Determine version and revision from:
# https://sourceforge.net/p/netpbm/code/HEAD/log/?path=/advanced
2018-06-22 19:31:54 +01:00
name = "netpbm-10.82.01";
src = fetchsvn {
2018-03-13 13:11:35 +00:00
url = "https://svn.code.sf.net/p/netpbm/code/advanced";
rev = "3264";
2018-06-22 19:31:54 +01:00
sha256 = "17fmyjbxp1l18rma7gb0m8wd9kx2iwhqs8dd6fpalsn2cr8mf8hf";
};
2013-12-25 10:08:19 +00:00
postPatch = /* CVE-2005-2471, from Arch */ ''
substituteInPlace converter/other/pstopnm.c \
--replace '"-DSAFER"' '"-DPARANOIDSAFER"'
'';
buildInputs =
[ pkgconfig flex zlib perl libpng libjpeg libxml2 makeWrapper libtiff ]
++ lib.optional enableX11 libX11;
2013-07-19 18:42:11 +01:00
configurePhase = ''
cp config.mk.in config.mk
echo "STATICLIB_TOO = n" >> config.mk
2013-07-19 18:42:11 +01:00
substituteInPlace "config.mk" \
--replace "TIFFLIB = NONE" "TIFFLIB = ${libtiff.out}/lib/libtiff.so" \
--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"
'' + 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 18:42:11 +01:00
'';
preBuild = ''
2013-07-19 18:42:11 +01:00
export LDFLAGS="-lz"
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"
touch lib/standardppmdfont.c
'';
enableParallelBuilding = false;
installPhase = ''
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/
# 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
'';
meta = {
homepage = http://netpbm.sourceforge.net/;
description = "Toolkit for manipulation of graphic images";
license = "GPL,free";
platforms = with stdenv.lib.platforms; linux ++ darwin;
};
}