nixpkgs/pkgs/development/libraries/openexr/3.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

61 lines
1.6 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, imath
, libdeflate
, pkg-config
, pkgsCross
}:
stdenv.mkDerivation rec {
pname = "openexr";
version = "3.2.4";
src = fetchFromGitHub {
owner = "AcademySoftwareFoundation";
repo = "openexr";
rev = "v${version}";
hash = "sha256-mVUxxYe6teiJ18PQ9703/kjBpJ9+a7vcDme+NwtQQQM=";
};
outputs = [ "bin" "dev" "out" "doc" ];
patches =
# Disable broken test on musl libc
# https://github.com/AcademySoftwareFoundation/openexr/issues/1556
lib.optional stdenv.hostPlatform.isMusl ./disable-iex-test.patch
;
# tests are determined to use /var/tmp on unix
postPatch = ''
cat <(find . -name tmpDir.h) <(echo src/test/OpenEXRCoreTest/main.cpp) | while read -r f ; do
substituteInPlace $f --replace '/var/tmp' "$TMPDIR"
done
'';
cmakeFlags = lib.optional stdenv.hostPlatform.isStatic "-DCMAKE_SKIP_RPATH=ON";
nativeBuildInputs = [ cmake pkg-config ];
propagatedBuildInputs = [ imath libdeflate ];
# Without 'sse' enforcement tests fail on i686 as due to excessive precision as:
# error reading back channel B pixel 21,-76 got -nan expected -nan
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isi686 "-msse2 -mfpmath=sse";
# https://github.com/AcademySoftwareFoundation/openexr/issues/1400
doCheck = !stdenv.hostPlatform.isAarch32;
passthru.tests = {
musl = pkgsCross.musl64.openexr_3;
};
meta = with lib; {
description = "High dynamic-range (HDR) image file format";
homepage = "https://www.openexr.com";
license = licenses.bsd3;
maintainers = with maintainers; [ paperdigits ];
platforms = platforms.all;
};
}