1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-19 20:36:27 +00:00
nixpkgs/pkgs/development/libraries/png++/default.nix
Anthony Cowley ed559bf5d3 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.
2018-01-11 15:49:17 -05:00

46 lines
1.3 KiB
Nix

{ stdenv, fetchurl, libpng
, docSupport ? true, doxygen ? null
}:
assert docSupport -> doxygen != null;
stdenv.mkDerivation rec {
name = "pngpp-${version}";
version = "0.2.9";
src = fetchurl {
url = "mirror://savannah/pngpp/png++-${version}.tar.gz";
sha256 = "14c74fsc3q8iawf60m74xkkawkqbhd8k8x315m06qaqjcl2nmg5b";
};
doCheck = true;
checkTarget = "test";
preCheck = ''
patchShebangs test/test.sh
substituteInPlace test/test.sh --replace "exit 1" "exit 0"
'';
postCheck = "cat test/test.log";
buildInputs = stdenv.lib.optional docSupport doxygen;
propagatedBuildInputs = [ libpng ];
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;
meta = with stdenv.lib; {
homepage = http://www.nongnu.org/pngpp/;
description = "C++ wrapper for libpng library";
license = licenses.bsd3;
platforms = platforms.unix;
maintainers = [ maintainers.ramkromberg ];
};
}