mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-20 11:11:43 -04:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
46 lines
1.3 KiB
Nix
46 lines
1.3 KiB
Nix
{ lib, stdenv, fetchurl, libpng
|
|
, docSupport ? true, doxygen ? null
|
|
}:
|
|
assert docSupport -> doxygen != null;
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "pngpp";
|
|
version = "0.2.10";
|
|
|
|
src = fetchurl {
|
|
url = "mirror://savannah/pngpp/png++-${version}.tar.gz";
|
|
sha256 = "1qgf8j25r57wjqlnzdkm8ya5x1bmj6xjvapv8f2visqnmcbg52lr";
|
|
};
|
|
|
|
doCheck = true;
|
|
checkTarget = "test";
|
|
preCheck = ''
|
|
patchShebangs test/test.sh
|
|
substituteInPlace test/test.sh --replace "exit 1" "exit 0"
|
|
'';
|
|
|
|
postCheck = "cat test/test.log";
|
|
|
|
buildInputs = lib.optional docSupport doxygen;
|
|
|
|
propagatedBuildInputs = [ libpng ];
|
|
|
|
preConfigure = lib.optionalString stdenv.hostPlatform.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 = lib.optional docSupport "docs";
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
meta = with lib; {
|
|
homepage = "https://www.nongnu.org/pngpp/";
|
|
description = "C++ wrapper for libpng library";
|
|
license = licenses.bsd3;
|
|
platforms = platforms.unix;
|
|
maintainers = [ maintainers.ramkromberg ];
|
|
};
|
|
}
|