@@ -21,13 +21,17 @@ stdenv.mkDerivation rec {
2121
2222 postCheck = "cat test/test.log";
2323
24− buildInputs = [ ]
25− ++ stdenv.lib.optional docSupport doxygen;
24+ buildInputs = stdenv.lib.optional docSupport doxygen;
2625
2726 propagatedBuildInputs = [ libpng ];
2827
29− makeFlags = [ "PREFIX=\${out}" ]
30− ++ stdenv.lib.optional docSupport "docs";
28+ preConfigure = stdenv.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 = stdenv.lib.optional docSupport "docs";
3135
3236 enableParallelBuilding = true;
3337
@@ -35,7 +39,7 @@ stdenv.mkDerivation rec {
3539 homepage = http://www.nongnu.org/pngpp/;
3640 description = "C++ wrapper for libpng library";
3741 license = licenses.bsd3;
38− platforms = platforms.linux;
42+ platforms = platforms.unix;
3943 maintainers = [ maintainers.ramkromberg ];
4044 };
4145}