2023-10-19 13:55:26 +00:00
|
|
|
{ lib, stdenv, fetchurl, zlib, apngSupport ? true
|
|
|
|
, testers
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
assert zlib != null;
|
|
|
|
|
|
|
|
let
|
2024-04-21 15:54:59 +00:00
|
|
|
patchVersion = "1.6.43";
|
2020-04-24 23:36:52 +00:00
|
|
|
patch_src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/libpng-apng/libpng-${patchVersion}-apng.patch.gz";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-0QdXnpDVU4bQDmCG6nUJQvIqBLmrR2u6DGYHcM76/iI=";
|
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
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
in stdenv.mkDerivation (finalAttrs: {
|
2022-03-30 09:31:56 +00:00
|
|
|
pname = "libpng" + whenPatched "-apng";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "1.6.43";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2023-10-19 13:55:26 +00:00
|
|
|
url = "mirror://sourceforge/libpng/libpng-${finalAttrs.version}.tar.xz";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-alygZSOSotfJ2yrltAIQhDwLvAgcvUEIJasAzFnxSmw=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2024-06-20 14:57:18 +00:00
|
|
|
postPatch = whenPatched "gunzip < ${patch_src} | patch -Np1"
|
2024-09-26 11:04:55 +00:00
|
|
|
+ lib.optionalString stdenv.hostPlatform.isFreeBSD ''
|
2024-06-20 14:57:18 +00:00
|
|
|
|
|
|
|
sed -i 1i'int feenableexcept(int __mask);' contrib/libtests/pngvalid.c
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" "man" ];
|
|
|
|
outputBin = "dev";
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ zlib ];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
passthru = {
|
|
|
|
inherit zlib;
|
|
|
|
|
|
|
|
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Official reference implementation for the PNG file format" + whenPatched " with animation patch";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "http://www.libpng.org/pub/png/libpng.html";
|
2024-04-21 15:54:59 +00:00
|
|
|
changelog = "https://github.com/pnggroup/libpng/blob/v${finalAttrs.version}/CHANGES";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.libpng2;
|
2023-10-19 13:55:26 +00:00
|
|
|
pkgConfigModules = [ "libpng" "libpng16" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.all;
|
2023-01-20 10:41:00 +00:00
|
|
|
maintainers = with maintainers; [ vcunat ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2023-10-19 13:55:26 +00:00
|
|
|
})
|