summary refs log tree commit diff
path: root/pkgs/development/libraries/png++
diff options
context:
space:
mode:
authorAnthony Cowley <acowley@gmail.com>2018-01-11 15:44:45 -0500
committerAnthony Cowley <acowley@gmail.com>2018-01-11 15:49:17 -0500
commited559bf5d31e5c0d69f44a91e1dc34ba2d14d31a (patch)
tree97241b10e26d0bec80cdab4bfde42e788369eab4 /pkgs/development/libraries/png++
parent310ad4345bbe42ae7360981243f6602a03fd232f (diff)
downloadnixpkgs-ed559bf5d31e5c0d69f44a91e1dc34ba2d14d31a.tar
nixpkgs-ed559bf5d31e5c0d69f44a91e1dc34ba2d14d31a.tar.gz
nixpkgs-ed559bf5d31e5c0d69f44a91e1dc34ba2d14d31a.tar.bz2
nixpkgs-ed559bf5d31e5c0d69f44a91e1dc34ba2d14d31a.tar.lz
nixpkgs-ed559bf5d31e5c0d69f44a91e1dc34ba2d14d31a.tar.xz
nixpkgs-ed559bf5d31e5c0d69f44a91e1dc34ba2d14d31a.tar.zst
nixpkgs-ed559bf5d31e5c0d69f44a91e1dc34ba2d14d31a.zip
pngpp: darwin support
1) Building with clang is addressed by navigating a minor #if in some
of the code.

2) I noticed that even when things were building correctly, passing
`${out}` as a variable assignment to `make` was actually not working:
there were compiler warnings about missing include directories whose
bogus paths involved the literal string `out`. I ended up fixing this
by performing the assignment to the make variable `PREFIX` in the
`Makefile` itself.
Diffstat (limited to 'pkgs/development/libraries/png++')
-rw-r--r--pkgs/development/libraries/png++/default.nix14
1 files changed, 9 insertions, 5 deletions
diff --git a/pkgs/development/libraries/png++/default.nix b/pkgs/development/libraries/png++/default.nix
index 6ca4734a4f7..ef4b3ea7e01 100644
--- a/pkgs/development/libraries/png++/default.nix
+++ b/pkgs/development/libraries/png++/default.nix
@@ -21,13 +21,17 @@ stdenv.mkDerivation rec {
 
   postCheck = "cat test/test.log";
 
-  buildInputs = [ ]
-    ++ stdenv.lib.optional docSupport doxygen;
+  buildInputs = stdenv.lib.optional docSupport doxygen;
 
   propagatedBuildInputs = [ libpng ];
 
-  makeFlags = [ "PREFIX=\${out}" ]
-    ++ stdenv.lib.optional docSupport "docs";
+  preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
+    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"
+  '' + ''
+    sed "s|\(PNGPP := .\)|PREFIX := ''${out}\n\\1|" -i Makefile
+  '';
+
+  makeFlags = stdenv.lib.optional docSupport "docs";
 
   enableParallelBuilding = true;
 
@@ -35,7 +39,7 @@ stdenv.mkDerivation rec {
     homepage = http://www.nongnu.org/pngpp/;
     description = "C++ wrapper for libpng library";
     license = licenses.bsd3;
-    platforms = platforms.linux;
+    platforms = platforms.unix;
     maintainers = [ maintainers.ramkromberg ];
   };
 }