2020-02-20 08:53:04 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchsvn
|
2020-09-03 22:26:30 +02:00
|
|
|
, pkg-config
|
2020-02-20 08:53:04 +01:00
|
|
|
, libjpeg
|
|
|
|
, libpng
|
2020-09-06 16:34:31 +02:00
|
|
|
, jbigkit
|
2020-02-20 08:53:04 +01:00
|
|
|
, flex
|
|
|
|
, zlib
|
|
|
|
, perl
|
|
|
|
, libxml2
|
|
|
|
, makeWrapper
|
|
|
|
, libtiff
|
|
|
|
, enableX11 ? false
|
|
|
|
, libX11
|
2020-09-07 03:33:33 +02:00
|
|
|
, buildPackages
|
2020-02-20 08:53:04 +01:00
|
|
|
}:
|
2009-02-25 23:44:08 +01:00
|
|
|
|
2019-08-13 23:52:01 +02:00
|
|
|
stdenv.mkDerivation {
|
2017-02-18 04:17:34 +01:00
|
|
|
# Determine version and revision from:
|
|
|
|
# https://sourceforge.net/p/netpbm/code/HEAD/log/?path=/advanced
|
2021-08-12 20:41:54 +02:00
|
|
|
pname = "netpbm";
|
2021-10-27 13:16:54 +02:00
|
|
|
version = "10.96.2";
|
2009-02-25 23:44:08 +01:00
|
|
|
|
2020-02-26 00:41:09 +01:00
|
|
|
outputs = [ "bin" "out" "dev" ];
|
|
|
|
|
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";
|
2021-10-27 13:16:54 +02:00
|
|
|
rev = "4158";
|
|
|
|
sha256 = "NK8GXCvCEnbQJWvVngB5UMOVmfsiyU4Fq0JIY9UNSjo=";
|
2009-02-25 23:44:08 +01:00
|
|
|
};
|
|
|
|
|
2020-02-20 08:53:04 +01:00
|
|
|
nativeBuildInputs = [
|
2020-09-03 22:26:30 +02:00
|
|
|
pkg-config
|
2020-02-20 08:53:04 +01:00
|
|
|
flex
|
|
|
|
makeWrapper
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
zlib
|
|
|
|
perl
|
|
|
|
libpng
|
|
|
|
libjpeg
|
|
|
|
libxml2
|
|
|
|
libtiff
|
2020-09-06 16:34:31 +02:00
|
|
|
jbigkit
|
2020-02-20 08:53:04 +01:00
|
|
|
] ++ lib.optional enableX11 libX11;
|
2009-02-25 23:44:08 +01:00
|
|
|
|
2020-09-07 03:33:33 +02:00
|
|
|
|
|
|
|
strictDeps = true;
|
|
|
|
|
2020-09-03 22:26:30 +02:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2020-09-07 03:33:33 +02:00
|
|
|
# Environment variables
|
2021-01-15 10:19:50 +01:00
|
|
|
STRIPPROG = "${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip";
|
2020-09-07 03:33:33 +02:00
|
|
|
|
2020-09-03 22:26:30 +02:00
|
|
|
postPatch = ''
|
|
|
|
# Install libnetpbm.so symlink to correct destination
|
|
|
|
substituteInPlace lib/Makefile \
|
|
|
|
--replace '/sharedlink' '/lib'
|
|
|
|
'';
|
|
|
|
|
2013-07-19 19:42:11 +02:00
|
|
|
configurePhase = ''
|
2020-02-25 00:03:06 +01:00
|
|
|
runHook preConfigure
|
|
|
|
|
2013-07-19 19:42:11 +02:00
|
|
|
cp config.mk.in config.mk
|
2020-03-01 14:57:51 +01:00
|
|
|
|
|
|
|
# Disable building static library
|
|
|
|
echo "STATICLIB_TOO = N" >> config.mk
|
|
|
|
|
2020-09-07 03:33:33 +02:00
|
|
|
# Enable cross-compilation
|
2021-01-15 10:19:50 +01:00
|
|
|
echo 'AR = ${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar' >> config.mk
|
2020-09-07 03:33:33 +02:00
|
|
|
echo 'CC = ${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc' >> config.mk
|
|
|
|
echo 'CC_FOR_BUILD = ${buildPackages.stdenv.cc}/bin/${buildPackages.stdenv.cc.targetPrefix}cc' >> config.mk
|
|
|
|
echo 'LD_FOR_BUILD = $(CC_FOR_BUILD)' >> config.mk
|
2021-01-17 10:17:16 +01:00
|
|
|
echo 'PKG_CONFIG = ${buildPackages.pkg-config}/bin/${buildPackages.pkg-config.targetPrefix}pkg-config' >> config.mk
|
2021-01-15 10:19:50 +01:00
|
|
|
echo 'RANLIB = ${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib' >> config.mk
|
2020-09-07 03:33:33 +02:00
|
|
|
|
2020-03-01 14:57:51 +01:00
|
|
|
# Use libraries from Nixpkgs
|
|
|
|
echo "TIFFLIB = libtiff.so" >> config.mk
|
|
|
|
echo "TIFFLIB_NEEDS_JPEG = N" >> config.mk
|
|
|
|
echo "TIFFLIB_NEEDS_Z = N" >> config.mk
|
|
|
|
echo "JPEGLIB = libjpeg.so" >> config.mk
|
2020-09-06 16:34:31 +02:00
|
|
|
echo "JBIGLIB = libjbig.a" >> config.mk
|
|
|
|
# Insecure
|
|
|
|
echo "JASPERLIB = NONE" >> config.mk
|
2020-03-01 15:38:32 +01:00
|
|
|
|
|
|
|
# Fix path to rgb.txt
|
|
|
|
echo "RGB_DB_PATH = $out/share/netpbm/misc/rgb.txt" >> config.mk
|
2021-01-15 10:19:50 +01:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2016-12-16 10:30:50 +01:00
|
|
|
echo "LDSHLIB=-dynamiclib -install_name $out/lib/libnetpbm.\$(MAJ).dylib" >> config.mk
|
|
|
|
echo "NETPBMLIBTYPE = dylib" >> config.mk
|
|
|
|
echo "NETPBMLIBSUFFIX = dylib" >> config.mk
|
2020-09-03 21:34:07 +02:00
|
|
|
'' + ''
|
2020-02-25 00:03:06 +01:00
|
|
|
runHook postConfigure
|
2013-07-19 19:42:11 +02:00
|
|
|
'';
|
2009-02-25 23:44:08 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
2020-02-25 00:03:06 +01:00
|
|
|
runHook preInstall
|
|
|
|
|
2014-09-24 23:47:44 +02:00
|
|
|
make package pkgdir=$out
|
|
|
|
|
2020-02-24 22:21:55 +01:00
|
|
|
rm -rf $out/*_template $out/{pkginfo,README,VERSION} $out/man/web
|
2014-09-24 23:47:44 +02:00
|
|
|
|
|
|
|
mkdir -p $out/share/netpbm
|
|
|
|
mv $out/misc $out/share/netpbm/
|
2010-01-13 22:16:12 +01:00
|
|
|
|
2020-03-03 22:30:52 +01:00
|
|
|
moveToOutput bin "''${!outputBin}"
|
|
|
|
|
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
|
2020-03-03 22:30:52 +01:00
|
|
|
wrapProgram "''${!outputBin}/bin/$prog" --prefix PATH : "''${!outputBin}/bin"
|
2010-01-13 22:16:12 +01:00
|
|
|
done
|
2020-02-25 00:03:06 +01:00
|
|
|
|
|
|
|
runHook postInstall
|
2009-02-25 23:44:08 +01:00
|
|
|
'';
|
|
|
|
|
2020-02-24 22:21:27 +01:00
|
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
|
2009-02-25 23:44:08 +01:00
|
|
|
meta = {
|
2020-02-20 08:53:04 +01:00
|
|
|
homepage = "http://netpbm.sourceforge.net/";
|
2009-02-25 23:44:08 +01:00
|
|
|
description = "Toolkit for manipulation of graphic images";
|
2020-02-20 08:53:04 +01:00
|
|
|
license = lib.licenses.free; # http://netpbm.svn.code.sourceforge.net/p/netpbm/code/trunk/doc/copyright_summary
|
2021-01-15 10:19:50 +01:00
|
|
|
platforms = with lib.platforms; linux ++ darwin;
|
2009-02-25 23:44:08 +01:00
|
|
|
};
|
|
|
|
}
|