2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv, fetchurl, zlib, apngSupport ? true }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
assert zlib != null;
|
|
|
|
|
|
|
|
let
|
2023-10-09 19:29:22 +00:00
|
|
|
patchVersion = "1.6.40";
|
2020-04-24 23:36:52 +00:00
|
|
|
patch_src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/libpng-apng/libpng-${patchVersion}-apng.patch.gz";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-CjykZIKTjY1sciZivtLH7gxlobViRESzztIa2NNW2y8=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-02-05 17:12:51 +00:00
|
|
|
whenPatched = lib.optionalString apngSupport;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
2022-03-30 09:31:56 +00:00
|
|
|
pname = "libpng" + whenPatched "-apng";
|
2023-10-09 19:29:22 +00:00
|
|
|
version = "1.6.40";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/libpng/libpng-${version}.tar.xz";
|
2023-10-09 19:29:22 +00:00
|
|
|
hash = "sha256-U1tHmyRn/yMaPsbZKlJZBvuO8nl4vk9m2+BdPzoBs6E=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
postPatch = whenPatched "gunzip < ${patch_src} | patch -Np1";
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" "man" ];
|
|
|
|
outputBin = "dev";
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ zlib ];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
passthru = { inherit zlib; };
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "The official reference implementation for the PNG file format" + whenPatched " with animation patch";
|
|
|
|
homepage = "http://www.libpng.org/pub/png/libpng.html";
|
2023-10-09 19:29:22 +00:00
|
|
|
changelog = "https://github.com/glennrp/libpng/blob/v1.6.40/CHANGES";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.libpng2;
|
|
|
|
platforms = platforms.all;
|
2023-01-20 10:41:00 +00:00
|
|
|
maintainers = with maintainers; [ vcunat ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|