1{
2 lib,
3 stdenv,
4 fetchurl,
5 zlib,
6 testers,
7}:
8
9assert stdenv.hostPlatform == stdenv.buildPlatform -> zlib != null;
10
11stdenv.mkDerivation (finalAttrs: {
12 pname = "libpng";
13 version = "1.2.59";
14
15 src = fetchurl {
16 url = "mirror://sourceforge/libpng/libpng-${finalAttrs.version}.tar.xz";
17 sha256 = "1izw9ybm27llk8531w6h4jp4rk2rxy2s9vil16nwik5dp0amyqxl";
18 };
19
20 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
21 substituteInPlace pngconf.h --replace-fail '<fp.h>' '<math.h>'
22 '';
23
24 outputs = [
25 "out"
26 "dev"
27 "man"
28 ];
29
30 propagatedBuildInputs = [ zlib ];
31
32 configureFlags = [ "--enable-static" ];
33
34 postInstall = ''mv "$out/bin" "$dev/bin"'';
35
36 passthru = {
37 inherit zlib;
38
39 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
40 };
41
42 meta = with lib; {
43 description = "Official reference implementation for the PNG file format";
44 homepage = "http://www.libpng.org/pub/png/libpng.html";
45 license = licenses.libpng;
46 maintainers = [ ];
47 branch = "1.2";
48 pkgConfigModules = [
49 "libpng"
50 "libpng12"
51 ];
52 platforms = platforms.unix;
53 };
54})