1{ lib, stdenv, fetchurl, zlib, apngSupport ? true }:
2
3assert zlib != null;
4
5let
6 patchVersion = "1.6.37";
7 patch_src = fetchurl {
8 url = "mirror://sourceforge/libpng-apng/libpng-${patchVersion}-apng.patch.gz";
9 sha256 = "1dh0250mw9b2hx7cdmnb2blk7ddl49n6vx8zz7jdmiwxy38v4fw2";
10 };
11 whenPatched = lib.optionalString apngSupport;
12
13in stdenv.mkDerivation rec {
14 name = "libpng" + whenPatched "-apng" + "-${version}";
15 version = "1.6.37";
16
17 src = fetchurl {
18 url = "mirror://sourceforge/libpng/libpng-${version}.tar.xz";
19 sha256 = "1jl8in381z0128vgxnvn33nln6hzckl7l7j9nqvkaf1m9n1p0pjh";
20 };
21 postPatch = whenPatched "gunzip < ${patch_src} | patch -Np1";
22
23 outputs = [ "out" "dev" "man" ];
24 outputBin = "dev";
25
26 propagatedBuildInputs = [ zlib ];
27
28 doCheck = true;
29
30 passthru = { inherit zlib; };
31
32 meta = with lib; {
33 description = "The official reference implementation for the PNG file format" + whenPatched " with animation patch";
34 homepage = "http://www.libpng.org/pub/png/libpng.html";
35 license = licenses.libpng2;
36 platforms = platforms.all;
37 maintainers = [ maintainers.vcunat ];
38 };
39}