1{ lib, stdenv, fetchurl, libpng
2, docSupport ? true, doxygen ? null
3}:
4assert docSupport -> doxygen != null;
5
6stdenv.mkDerivation rec {
7 pname = "pngpp";
8 version = "0.2.10";
9
10 src = fetchurl {
11 url = "mirror://savannah/pngpp/png++-${version}.tar.gz";
12 sha256 = "1qgf8j25r57wjqlnzdkm8ya5x1bmj6xjvapv8f2visqnmcbg52lr";
13 };
14
15 doCheck = true;
16 checkTarget = "test";
17 preCheck = ''
18 patchShebangs test/test.sh
19 substituteInPlace test/test.sh --replace "exit 1" "exit 0"
20 '';
21
22 postCheck = "cat test/test.log";
23
24 buildInputs = lib.optional docSupport doxygen;
25
26 propagatedBuildInputs = [ libpng ];
27
28 preConfigure = lib.optionalString stdenv.isDarwin ''
29 substituteInPlace error.hpp --replace "#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE" "#if (__clang__ || _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE"
30 '' + ''
31 sed "s|\(PNGPP := .\)|PREFIX := ''${out}\n\\1|" -i Makefile
32 '';
33
34 makeFlags = lib.optional docSupport "docs";
35
36 enableParallelBuilding = true;
37
38 meta = with lib; {
39 homepage = "https://www.nongnu.org/pngpp/";
40 description = "C++ wrapper for libpng library";
41 license = licenses.bsd3;
42 platforms = platforms.unix;
43 maintainers = [ maintainers.ramkromberg ];
44 };
45}