lol
1{ lib, stdenv, fetchurl, zlib, apngSupport ? true
2, testers
3}:
4
5assert zlib != null;
6
7let
8 patchVersion = "1.6.43";
9 patch_src = fetchurl {
10 url = "mirror://sourceforge/libpng-apng/libpng-${patchVersion}-apng.patch.gz";
11 hash = "sha256-0QdXnpDVU4bQDmCG6nUJQvIqBLmrR2u6DGYHcM76/iI=";
12 };
13 whenPatched = lib.optionalString apngSupport;
14
15in stdenv.mkDerivation (finalAttrs: {
16 pname = "libpng" + whenPatched "-apng";
17 version = "1.6.43";
18
19 src = fetchurl {
20 url = "mirror://sourceforge/libpng/libpng-${finalAttrs.version}.tar.xz";
21 hash = "sha256-alygZSOSotfJ2yrltAIQhDwLvAgcvUEIJasAzFnxSmw=";
22 };
23 postPatch = whenPatched "gunzip < ${patch_src} | patch -Np1";
24
25 outputs = [ "out" "dev" "man" ];
26 outputBin = "dev";
27
28 propagatedBuildInputs = [ zlib ];
29
30 doCheck = true;
31
32 passthru = {
33 inherit zlib;
34
35 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
36 };
37
38 meta = with lib; {
39 description = "The official reference implementation for the PNG file format" + whenPatched " with animation patch";
40 homepage = "http://www.libpng.org/pub/png/libpng.html";
41 changelog = "https://github.com/pnggroup/libpng/blob/v${finalAttrs.version}/CHANGES";
42 license = licenses.libpng2;
43 pkgConfigModules = [ "libpng" "libpng16" ];
44 platforms = platforms.all;
45 maintainers = with maintainers; [ vcunat ];
46 };
47})