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