nixpkgs/pkgs/development/libraries/opencollada/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
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"
```
2024-09-25 00:04:37 +03:00

48 lines
1.5 KiB
Nix

{ lib, stdenv, fetchFromGitHub, fetchurl, cmake, pkg-config, libxml2, pcre
, darwin}:
stdenv.mkDerivation rec {
pname = "opencollada";
version = "1.6.68";
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "OpenCOLLADA";
rev = "v${version}";
sha256 = "1ym16fxx9qhf952vva71sdzgbm7ifis0h1n5fj1bfdj8zvvkbw5w";
};
patches = [
./pcre.patch
# fix build with gcc 13
(fetchurl {
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/media-libs/opencollada/files/opencollada-1.6.68-gcc13.patch?id=b76590f9fb8615da3da9d783ad841c0e3881a27b";
hash = "sha256-uimeLGHgXaFi61mmoaloJ5vo83c8EIQmtHEMngC2Nq4=";
})
];
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [ AGL ]);
propagatedBuildInputs = [ libxml2 pcre ];
postPatch = ''
# Drop blanket -Werror as it tends to fail on newer toolchain for
# minor warnings. In this case it was gcc-13 build failure.
substituteInPlace DAEValidator/CMakeLists.txt --replace-fail ' -Werror"' '"'
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace GeneratedSaxParser/src/GeneratedSaxParserUtils.cpp \
--replace math.h cmath
'';
meta = {
description = "Library for handling the COLLADA file format";
homepage = "https://github.com/KhronosGroup/OpenCOLLADA/";
maintainers = [ ];
platforms = lib.platforms.unix;
license = lib.licenses.mit;
};
}