Merge pull request #97045 from jtojnar/netpbm-10.91.2

This commit is contained in:
Jan Tojnar 2020-10-05 22:25:51 +02:00 committed by GitHub
commit b0f40bef4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 7 deletions

View file

@ -8,15 +8,23 @@ stdenv.mkDerivation rec {
sha256 = "0cnrcdr1dwp7h7m0a56qw09bv08krb37mpf7cml5sjdgpyv0cwfy";
};
makeFlags = [
"CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc"
"AR=${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar"
"RANLIB=${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib"
];
postPatch = ''
sed -i 's/^\(CFLAGS.*\)$/\1 -fPIC/' Makefile
'' + stdenv.lib.optionalString stdenv.cc.isClang ''
for f in Makefile libjbig/Makefile pbmtools/Makefile; do
substituteInPlace $f --replace "CC = gcc" "CC = clang"
sed -i -E 's/\bar /$(AR) /g;s/\branlib /$(RANLIB) /g' "$f"
done
'';
installPhase = ''
runHook preInstall
install -D -m644 libjbig/libjbig.a $out/lib/libjbig.a
install -D -m644 libjbig/libjbig85.a $out/lib/libjbig85.a
install -D -m644 libjbig/jbig.h $out/include/jbig.h
@ -30,12 +38,14 @@ stdenv.mkDerivation rec {
install -D -m755 pbmtools/pbmtojbg $out/bin/pbmtojbg
install -D -m755 pbmtools/jbgtopbm85 $out/bin/jbgtopbm85
install -D -m755 pbmtools/pbmtojbg85 $out/bin/pbmtojbg85
runHook postInstall
'';
meta = with stdenv.lib; {
homepage = "http://www.cl.cam.ac.uk/~mgk25/jbigkit/";
description = "A software implementation of the JBIG1 data compression standard";
license = licenses.gpl2;
license = licenses.gpl2Plus;
platforms = platforms.all;
};
}

View file

@ -4,6 +4,7 @@
, pkg-config
, libjpeg
, libpng
, jbigkit
, flex
, zlib
, perl
@ -12,19 +13,20 @@
, libtiff
, enableX11 ? false
, libX11
, buildPackages
}:
stdenv.mkDerivation {
# Determine version and revision from:
# https://sourceforge.net/p/netpbm/code/HEAD/log/?path=/advanced
name = "netpbm-10.89.1";
name = "netpbm-10.92.0";
outputs = [ "bin" "out" "dev" ];
src = fetchsvn {
url = "https://svn.code.sf.net/p/netpbm/code/advanced";
rev = "3735";
sha256 = "1m7ks6k53gsjsdazgf22g16dfgj3pqvqy9mhxzlwszv5808sj5w5";
rev = "3972";
sha256 = "09fpy4n4f867j23pr3b719wpvp8hjrr4drxp0r1csw74p8j6vfy3";
};
nativeBuildInputs = [
@ -40,10 +42,17 @@ stdenv.mkDerivation {
libjpeg
libxml2
libtiff
jbigkit
] ++ lib.optional enableX11 libX11;
strictDeps = true;
enableParallelBuilding = true;
# Environment variables
STRIPPROG = "${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip";
postPatch = ''
# Install libnetpbm.so symlink to correct destination
substituteInPlace lib/Makefile \
@ -58,11 +67,22 @@ stdenv.mkDerivation {
# Disable building static library
echo "STATICLIB_TOO = N" >> config.mk
# Enable cross-compilation
echo 'AR = ${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar' >> config.mk
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
echo 'PKG_CONFIG = ${buildPackages.pkgconfig}/bin/${buildPackages.pkgconfig.targetPrefix}pkg-config' >> config.mk
echo 'RANLIB = ${stdenv.lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib' >> config.mk
# 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
echo "JBIGLIB = libjbig.a" >> config.mk
# Insecure
echo "JASPERLIB = NONE" >> config.mk
# Fix path to rgb.txt
echo "RGB_DB_PATH = $out/share/netpbm/misc/rgb.txt" >> config.mk
@ -70,7 +90,7 @@ stdenv.mkDerivation {
echo "LDSHLIB=-dynamiclib -install_name $out/lib/libnetpbm.\$(MAJ).dylib" >> config.mk
echo "NETPBMLIBTYPE = dylib" >> config.mk
echo "NETPBMLIBSUFFIX = dylib" >> config.mk
'' + ''
runHook postConfigure
'';