Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 imath,
7 libdeflate,
8 pkg-config,
9 libjxl,
10 pkgsCross,
11}:
12
13stdenv.mkDerivation rec {
14 pname = "openexr";
15 version = "3.3.4";
16
17 src = fetchFromGitHub {
18 owner = "AcademySoftwareFoundation";
19 repo = "openexr";
20 rev = "v${version}";
21 hash = "sha256-dPPL9ML5O/u0FXuLxE3bkkgetOzNU3qni3n0pq25bT0=";
22 };
23
24 outputs = [
25 "bin"
26 "dev"
27 "out"
28 "doc"
29 ];
30
31 patches =
32 # Disable broken test on musl libc
33 # https://github.com/AcademySoftwareFoundation/openexr/issues/1556
34 lib.optional stdenv.hostPlatform.isMusl ./disable-iex-test.patch;
35
36 # tests are determined to use /var/tmp on unix
37 postPatch = ''
38 cat <(find . -name tmpDir.h) <(echo src/test/OpenEXRCoreTest/main.cpp) | while read -r f ; do
39 substituteInPlace $f --replace '/var/tmp' "$TMPDIR"
40 done
41 '';
42
43 cmakeFlags = lib.optional stdenv.hostPlatform.isStatic "-DCMAKE_SKIP_RPATH=ON";
44
45 nativeBuildInputs = [
46 cmake
47 pkg-config
48 ];
49 propagatedBuildInputs = [
50 imath
51 libdeflate
52 ];
53
54 # Without 'sse' enforcement tests fail on i686 as due to excessive precision as:
55 # error reading back channel B pixel 21,-76 got -nan expected -nan
56 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isi686 "-msse2 -mfpmath=sse";
57
58 # https://github.com/AcademySoftwareFoundation/openexr/issues/1400
59 doCheck = !stdenv.hostPlatform.isAarch32;
60
61 passthru.tests = {
62 inherit libjxl;
63 musl = pkgsCross.musl64.openexr;
64 };
65
66 meta = with lib; {
67 description = "High dynamic-range (HDR) image file format";
68 homepage = "https://www.openexr.com";
69 license = licenses.bsd3;
70 maintainers = with maintainers; [ paperdigits ];
71 platforms = platforms.all;
72 };
73}