uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
126
pkgs/tools/graphics/netpbm/default.nix
Normal file
126
pkgs/tools/graphics/netpbm/default.nix
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchsvn
|
||||
, pkg-config
|
||||
, libjpeg
|
||||
, libpng
|
||||
, jbigkit
|
||||
, flex
|
||||
, zlib
|
||||
, perl
|
||||
, libxml2
|
||||
, makeWrapper
|
||||
, libtiff
|
||||
, enableX11 ? false
|
||||
, libX11
|
||||
, buildPackages
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
# Determine version and revision from:
|
||||
# https://sourceforge.net/p/netpbm/code/HEAD/log/?path=/advanced
|
||||
pname = "netpbm";
|
||||
version = "10.97.4";
|
||||
|
||||
outputs = [ "bin" "out" "dev" ];
|
||||
|
||||
src = fetchsvn {
|
||||
url = "https://svn.code.sf.net/p/netpbm/code/advanced";
|
||||
rev = "4275";
|
||||
sha256 = "SEKxjlKNJijOk1MNIktSf/YTLxBq8gEHyjLUVtXG5OI=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
flex
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
zlib
|
||||
perl
|
||||
libpng
|
||||
libjpeg
|
||||
libxml2
|
||||
libtiff
|
||||
jbigkit
|
||||
] ++ lib.optional enableX11 libX11;
|
||||
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
# Environment variables
|
||||
STRIPPROG = "${lib.getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip";
|
||||
|
||||
postPatch = ''
|
||||
# Install libnetpbm.so symlink to correct destination
|
||||
substituteInPlace lib/Makefile \
|
||||
--replace '/sharedlink' '/lib'
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
cp config.mk.in config.mk
|
||||
|
||||
# Disable building static library
|
||||
echo "STATICLIB_TOO = N" >> config.mk
|
||||
|
||||
# Enable cross-compilation
|
||||
echo 'AR = ${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.pkg-config}/bin/${buildPackages.pkg-config.targetPrefix}pkg-config' >> config.mk
|
||||
echo 'RANLIB = ${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
|
||||
'' + 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
|
||||
'' + ''
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
make package pkgdir=$out
|
||||
|
||||
rm -rf $out/*_template $out/{pkginfo,README,VERSION} $out/man/web
|
||||
|
||||
mkdir -p $out/share/netpbm
|
||||
mv $out/misc $out/share/netpbm/
|
||||
|
||||
moveToOutput bin "''${!outputBin}"
|
||||
|
||||
# wrap any scripts that expect other programs in the package to be in their PATH
|
||||
for prog in ppmquant; do
|
||||
wrapProgram "''${!outputBin}/bin/$prog" --prefix PATH : "''${!outputBin}/bin"
|
||||
done
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = {
|
||||
homepage = "http://netpbm.sourceforge.net/";
|
||||
description = "Toolkit for manipulation of graphic images";
|
||||
license = lib.licenses.free; # http://netpbm.svn.code.sourceforge.net/p/netpbm/code/trunk/doc/copyright_summary
|
||||
platforms = with lib.platforms; linux ++ darwin;
|
||||
};
|
||||
}
|
||||
40
pkgs/tools/graphics/netpbm/update.sh
Executable file
40
pkgs/tools/graphics/netpbm/update.sh
Executable file
|
|
@ -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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue