libpng: merge apng expression (keep patch disabled by default)

I made sure no rebuild will happen because of this.
Unfortunately this meant merging attrsets instead of just using an
optionalString for postPatch
This commit is contained in:
Mathijs Kwik 2013-06-26 10:54:06 +02:00
parent 0b17251c06
commit e78b013fe3
3 changed files with 20 additions and 37 deletions

View File

@ -1,12 +1,19 @@
{ stdenv, fetchurl, zlib }:
{ stdenv, fetchurl, zlib, apngSupport ? false}:
assert zlib != null;
stdenv.mkDerivation rec {
name = "libpng-1.6.2";
let whenPatched = stdenv.lib.optionalString apngSupport;
version = "1.6.2";
patch_src = fetchurl {
url = "mirror://sourceforge/libpng-apng/libpng-${version}-apng.patch.gz";
sha256 = "0fy7p197ilr9phwqqk9h91s1mc28r6gj0w2ilrw5liagi71z75j1";
};
in stdenv.mkDerivation (rec {
name = "libpng" + whenPatched "-apng" + "-${version}";
src = fetchurl {
url = "mirror://sourceforge/libpng/${name}.tar.xz";
url = "mirror://sourceforge/libpng/libpng-${version}.tar.xz";
sha256 = "1pljkqjqgyz8c32w8fipd9f0v2gcyhah2ypp0h7ya1r1q85sk5qw";
};
@ -17,9 +24,15 @@ stdenv.mkDerivation rec {
passthru = { inherit zlib; };
meta = {
description = "The official reference implementation for the PNG file format";
description = "The official reference implementation for the PNG file format" + whenPatched " with animation patch";
homepage = http://www.libpng.org/pub/png/libpng.html;
license = "free-non-copyleft"; # http://www.libpng.org/pub/png/src/libpng-LICENSE.txt
platforms = stdenv.lib.platforms.all;
};
}
} // stdenv.lib.optionalAttrs apngSupport {
postPatch = ''
gunzip < ${patch_src} | patch -Np1
'';
})

View File

@ -1,30 +0,0 @@
{ stdenv, fetchurl, zlib }:
stdenv.mkDerivation rec {
version = "1.5.14";
name = "libpng-apng-${version}";
patch_src = fetchurl {
url = "mirror://sourceforge/libpng-apng/libpng15/${version}/libpng-${version}-apng.patch.gz";
sha256 = "1vcqbkdssy4srm8jqyzaipdc70xzanilqssypmwqyngp8ph0m45p";
};
src = fetchurl {
url = "mirror://sourceforge/libpng/libpng-${version}.tar.xz";
sha256 = "0m3vz3gig7s63zanq5b1dgb5ph12qm0cylw4g4fbxlsq3f74hn8l";
};
preConfigure = ''
gunzip < ${patch_src} | patch -Np1
'';
propagatedBuildInputs = [ zlib ];
passthru = { inherit zlib; };
meta = {
description = "The official reference implementation for the PNG file format with animation patch";
homepage = http://www.libpng.org/pub/png/libpng.html;
license = "free-non-copyleft"; # http://www.libpng.org/pub/png/src/libpng-LICENSE.txt
};
}

View File

@ -4688,7 +4688,7 @@ let
libpcap = callPackage ../development/libraries/libpcap { };
libpng = callPackage ../development/libraries/libpng { };
libpng_apng = callPackage ../development/libraries/libpng/libpng-apng.nix { };
libpng_apng = libpng.override { apngSupport = true; };
libpng12 = callPackage ../development/libraries/libpng/12.nix { };
libpng15 = callPackage ../development/libraries/libpng/15.nix { };