commit
f27031f48f
|
@ -49,7 +49,7 @@ stdenv.mkDerivation {
|
||||||
"${ghostscript}/bin:" +
|
"${ghostscript}/bin:" +
|
||||||
(if aspell == null then "" else "${aspell}/bin:") +
|
(if aspell == null then "" else "${aspell}/bin:") +
|
||||||
(if tex == null then "" else "${tex}/bin:") +
|
(if tex == null then "" else "${tex}/bin:") +
|
||||||
(if netpbm == null then "" else "${netpbm}/bin:") +
|
(if netpbm == null then "" else "${stdenv.lib.getBin netpbm}/bin:") +
|
||||||
(if imagemagick == null then "" else "${imagemagick}/bin:");
|
(if imagemagick == null then "" else "${imagemagick}/bin:");
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
|
|
@ -18,7 +18,7 @@ stdenv.mkDerivation {
|
||||||
makeFlags = [
|
makeFlags = [
|
||||||
"PREFIX=${placeholder "out"}"
|
"PREFIX=${placeholder "out"}"
|
||||||
"LEX=flex"
|
"LEX=flex"
|
||||||
"RGBDEF=${netpbm}/share/netpbm/misc/rgb.txt"
|
"RGBDEF=${netpbm.out}/share/netpbm/misc/rgb.txt"
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
|
|
@ -1,56 +1,85 @@
|
||||||
{ lib, stdenv, fetchsvn, pkgconfig, libjpeg, libpng, flex, zlib, perl, libxml2
|
{ lib
|
||||||
, makeWrapper, libtiff
|
, stdenv
|
||||||
, enableX11 ? false, libX11 }:
|
, fetchsvn
|
||||||
|
, pkgconfig
|
||||||
|
, libjpeg
|
||||||
|
, libpng
|
||||||
|
, flex
|
||||||
|
, zlib
|
||||||
|
, perl
|
||||||
|
, libxml2
|
||||||
|
, makeWrapper
|
||||||
|
, libtiff
|
||||||
|
, enableX11 ? false
|
||||||
|
, libX11
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
# Determine version and revision from:
|
# Determine version and revision from:
|
||||||
# https://sourceforge.net/p/netpbm/code/HEAD/log/?path=/advanced
|
# https://sourceforge.net/p/netpbm/code/HEAD/log/?path=/advanced
|
||||||
name = "netpbm-10.82.01";
|
name = "netpbm-10.89.1";
|
||||||
|
|
||||||
|
outputs = [ "bin" "out" "dev" ];
|
||||||
|
|
||||||
src = fetchsvn {
|
src = fetchsvn {
|
||||||
url = "https://svn.code.sf.net/p/netpbm/code/advanced";
|
url = "https://svn.code.sf.net/p/netpbm/code/advanced";
|
||||||
rev = "3264";
|
rev = "3735";
|
||||||
sha256 = "17fmyjbxp1l18rma7gb0m8wd9kx2iwhqs8dd6fpalsn2cr8mf8hf";
|
sha256 = "hRepEUBlf83p77Amjze+Qz7XTHhCuPdV01K/UabR89Q=";
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = /* CVE-2005-2471, from Arch */ ''
|
postPatch = ''
|
||||||
substituteInPlace converter/other/pstopnm.c \
|
# Install libnetpbm.so symlink to correct destination
|
||||||
--replace '"-dSAFER"' '"-dPARANOIDSAFER"'
|
substituteInPlace lib/Makefile \
|
||||||
|
--replace '/sharedlink' '/lib'
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildInputs =
|
nativeBuildInputs = [
|
||||||
[ pkgconfig flex zlib perl libpng libjpeg libxml2 makeWrapper libtiff ]
|
pkgconfig
|
||||||
++ lib.optional enableX11 libX11;
|
flex
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = [
|
||||||
|
zlib
|
||||||
|
perl
|
||||||
|
libpng
|
||||||
|
libjpeg
|
||||||
|
libxml2
|
||||||
|
libtiff
|
||||||
|
] ++ lib.optional enableX11 libX11;
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
|
runHook preConfigure
|
||||||
|
|
||||||
cp config.mk.in config.mk
|
cp config.mk.in config.mk
|
||||||
echo "STATICLIB_TOO = n" >> config.mk
|
|
||||||
substituteInPlace "config.mk" \
|
# Disable building static library
|
||||||
--replace "TIFFLIB = NONE" "TIFFLIB = ${libtiff.out}/lib/libtiff.so" \
|
echo "STATICLIB_TOO = N" >> config.mk
|
||||||
--replace "TIFFHDR_DIR =" "TIFFHDR_DIR = ${libtiff.dev}/include" \
|
|
||||||
--replace "JPEGLIB = NONE" "JPEGLIB = ${libjpeg.out}/lib/libjpeg.so" \
|
# Use libraries from Nixpkgs
|
||||||
--replace "JPEGHDR_DIR =" "JPEGHDR_DIR = ${libjpeg.dev}/include"
|
echo "TIFFLIB = libtiff.so" >> config.mk
|
||||||
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
echo "TIFFLIB_NEEDS_JPEG = N" >> config.mk
|
||||||
|
echo "TIFFLIB_NEEDS_Z = N" >> config.mk
|
||||||
|
echo "JPEGLIB = libjpeg.so" >> config.mk
|
||||||
|
|
||||||
|
# Fix path to rgb.txt
|
||||||
|
echo "RGB_DB_PATH = $out/share/netpbm/misc/rgb.txt" >> config.mk
|
||||||
|
'' + stdenv.lib.optionalString stdenv.isDarwin ''
|
||||||
echo "LDSHLIB=-dynamiclib -install_name $out/lib/libnetpbm.\$(MAJ).dylib" >> config.mk
|
echo "LDSHLIB=-dynamiclib -install_name $out/lib/libnetpbm.\$(MAJ).dylib" >> config.mk
|
||||||
echo "NETPBMLIBTYPE = dylib" >> config.mk
|
echo "NETPBMLIBTYPE = dylib" >> config.mk
|
||||||
echo "NETPBMLIBSUFFIX = dylib" >> config.mk
|
echo "NETPBMLIBSUFFIX = dylib" >> config.mk
|
||||||
|
|
||||||
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preBuild = ''
|
enableParallelBuilding = true;
|
||||||
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 = ''
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
make package pkgdir=$out
|
make package pkgdir=$out
|
||||||
|
|
||||||
rm -rf $out/link $out/*_template $out/{pkginfo,README,VERSION} $out/man/web
|
rm -rf $out/*_template $out/{pkginfo,README,VERSION} $out/man/web
|
||||||
|
|
||||||
mkdir -p $out/share/netpbm
|
mkdir -p $out/share/netpbm
|
||||||
mv $out/misc $out/share/netpbm/
|
mv $out/misc $out/share/netpbm/
|
||||||
|
@ -59,12 +88,18 @@ stdenv.mkDerivation {
|
||||||
for prog in ppmquant; do
|
for prog in ppmquant; do
|
||||||
wrapProgram "$out/bin/$prog" --prefix PATH : "$out/bin"
|
wrapProgram "$out/bin/$prog" --prefix PATH : "$out/bin"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
moveToOutput bin "''${!outputBin}"
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.updateScript = ./update.sh;
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
homepage = http://netpbm.sourceforge.net/;
|
homepage = "http://netpbm.sourceforge.net/";
|
||||||
description = "Toolkit for manipulation of graphic images";
|
description = "Toolkit for manipulation of graphic images";
|
||||||
license = "GPL,free";
|
license = lib.licenses.free; # http://netpbm.svn.code.sourceforge.net/p/netpbm/code/trunk/doc/copyright_summary
|
||||||
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
platforms = with stdenv.lib.platforms; linux ++ darwin;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#!nix-shell -p bash -p subversion -p common-updater-scripts -i bash
|
||||||
|
|
||||||
|
die() {
|
||||||
|
echo "error: $1" >&2
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
attr=netpbm
|
||||||
|
svnRoot=https://svn.code.sf.net/p/netpbm/code/advanced
|
||||||
|
|
||||||
|
oldRev=$(nix-instantiate --eval -E "with import ./. {}; $attr.src.rev" | tr -d '"')
|
||||||
|
if [[ -z "$oldRev" ]]; then
|
||||||
|
die "Could not extract old revision."
|
||||||
|
fi
|
||||||
|
|
||||||
|
latestRev=$(svn info --show-item "last-changed-revision" "$svnRoot")
|
||||||
|
if [[ -z "$latestRev" ]]; then
|
||||||
|
die "Could not find out last changed revision."
|
||||||
|
fi
|
||||||
|
|
||||||
|
versionInfo=$(svn cat -r "$latestRev" "$svnRoot/version.mk")
|
||||||
|
if [[ -z "$versionInfo" ]]; then
|
||||||
|
die "Could not get version info."
|
||||||
|
fi
|
||||||
|
|
||||||
|
nixFile=$(nix-instantiate --eval --strict -A "$attr.meta.position" | sed -re 's/^"(.*):[0-9]+"$/\1/')
|
||||||
|
if [[ ! -f "$nixFile" ]]; then
|
||||||
|
die "Could not evaluate '$attr.meta.position' to locate the .nix file!"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# h remembers if we found the pattern; on the last line, if a pattern was previously found, we exit with 1
|
||||||
|
# https://stackoverflow.com/a/12145797/160386
|
||||||
|
sed -i "$nixFile" -re '/(\brev\b\s*=\s*)"'"$oldRev"'"/{ s||\1"'"$latestRev"'"|; h }; ${x; /./{x; q1}; x}' && die "Unable to update revision."
|
||||||
|
|
||||||
|
majorRelease=$(grep --perl-regex --only-matching 'NETPBM_MAJOR_RELEASE = \K.+' <<< "$versionInfo")
|
||||||
|
minorRelease=$(grep --perl-regex --only-matching 'NETPBM_MINOR_RELEASE = \K.+' <<< "$versionInfo")
|
||||||
|
pointRelease=$(grep --perl-regex --only-matching 'NETPBM_POINT_RELEASE = \K.+' <<< "$versionInfo")
|
||||||
|
|
||||||
|
update-source-version "$attr" "$majorRelease.$minorRelease.$pointRelease"
|
|
@ -18,9 +18,9 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
rm cmake/FindNETPBM.cmake
|
rm cmake/FindNETPBM.cmake
|
||||||
echo "SET(NETPBM_LIBRARY `find ${netpbm} -name "*.${stdenv.hostPlatform.extensions.sharedLibrary}*" -type f`)" >> cmake/FindNETPBM.cmake
|
echo "SET(NETPBM_LIBRARY `find ${stdenv.lib.getLib netpbm} -name "*.${stdenv.hostPlatform.extensions.sharedLibrary}*" -type f`)" >> cmake/FindNETPBM.cmake
|
||||||
echo "SET(NETPBM_LIBRARIES `find ${netpbm} -name "*.${stdenv.hostPlatform.extensions.sharedLibrary}*" -type f`)" >> cmake/FindNETPBM.cmake
|
echo "SET(NETPBM_LIBRARIES `find ${stdenv.lib.getLib netpbm} -name "*.${stdenv.hostPlatform.extensions.sharedLibrary}*" -type f`)" >> cmake/FindNETPBM.cmake
|
||||||
echo "SET(NETPBM_INCLUDE_DIR ${netpbm}/include/netpbm)" >> cmake/FindNETPBM.cmake
|
echo "SET(NETPBM_INCLUDE_DIR ${stdenv.lib.getDev netpbm}/include/netpbm)" >> cmake/FindNETPBM.cmake
|
||||||
echo "INCLUDE(FindPackageHandleStandardArgs)" >> cmake/FindNETPBM.cmake
|
echo "INCLUDE(FindPackageHandleStandardArgs)" >> cmake/FindNETPBM.cmake
|
||||||
echo "FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETPBM DEFAULT_MSG NETPBM_LIBRARY NETPBM_INCLUDE_DIR)" >> cmake/FindNETPBM.cmake
|
echo "FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETPBM DEFAULT_MSG NETPBM_LIBRARY NETPBM_INCLUDE_DIR)" >> cmake/FindNETPBM.cmake
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
|
||||||
buildInputs = [ libpng ];
|
buildInputs = [ libpng ];
|
||||||
|
|
||||||
configureFlags = [
|
configureFlags = [
|
||||||
"--with-rgbtxt=${netpbm}/share/netpbm/misc/rgb.txt"
|
"--with-rgbtxt=${netpbm.out}/share/netpbm/misc/rgb.txt"
|
||||||
];
|
];
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
|
|
|
@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
|
||||||
sed -i src/form.c -e '21i#include <stdlib.h>'
|
sed -i src/form.c -e '21i#include <stdlib.h>'
|
||||||
|
|
||||||
# there is no point to bring in the whole netpbm package just for this file
|
# there is no point to bring in the whole netpbm package just for this file
|
||||||
install -Dm644 ${netpbm}/share/netpbm/misc/rgb.txt $out/share/yad/rgb.txt
|
install -Dm644 ${netpbm.out}/share/netpbm/misc/rgb.txt $out/share/yad/rgb.txt
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postAutoreconf = ''
|
postAutoreconf = ''
|
||||||
|
|
|
@ -29,13 +29,13 @@ stdenv.mkDerivation rec {
|
||||||
--replace "psselect" "${psutils}/bin/psselect"
|
--replace "psselect" "${psutils}/bin/psselect"
|
||||||
'' + stdenv.lib.optionalString (netpbm != null) ''
|
'' + stdenv.lib.optionalString (netpbm != null) ''
|
||||||
substituteInPlace src/preproc/html/pre-html.cpp \
|
substituteInPlace src/preproc/html/pre-html.cpp \
|
||||||
--replace "pnmcut" "${netpbm}/bin/pnmcut" \
|
--replace "pnmcut" "${stdenv.lib.getBin netpbm}/bin/pnmcut" \
|
||||||
--replace "pnmcrop" "${netpbm}/bin/pnmcrop" \
|
--replace "pnmcrop" "${stdenv.lib.getBin netpbm}/bin/pnmcrop" \
|
||||||
--replace "pnmtopng" "${netpbm}/bin/pnmtopng"
|
--replace "pnmtopng" "${stdenv.lib.getBin netpbm}/bin/pnmtopng"
|
||||||
substituteInPlace tmac/www.tmac \
|
substituteInPlace tmac/www.tmac \
|
||||||
--replace "pnmcrop" "${netpbm}/bin/pnmcrop" \
|
--replace "pnmcrop" "${stdenv.lib.getBin netpbm}/bin/pnmcrop" \
|
||||||
--replace "pngtopnm" "${netpbm}/bin/pngtopnm" \
|
--replace "pngtopnm" "${stdenv.lib.getBin netpbm}/bin/pngtopnm" \
|
||||||
--replace "@PNMTOPS_NOSETPAGE@" "${netpbm}/bin/pnmtops -nosetpage"
|
--replace "@PNMTOPS_NOSETPAGE@" "${stdenv.lib.getBin netpbm}/bin/pnmtops -nosetpage"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildInputs = [ ghostscript psutils netpbm perl ];
|
buildInputs = [ ghostscript psutils netpbm perl ];
|
||||||
|
|
Loading…
Reference in New Issue