1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 zlib,
6 ilmbase,
7 fetchpatch,
8 cmake,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "openexr";
13 version = "2.5.10";
14
15 outputs = [
16 "bin"
17 "dev"
18 "out"
19 "doc"
20 ];
21
22 src = fetchFromGitHub {
23 owner = "AcademySoftwareFoundation";
24 repo = "openexr";
25 rev = "v${version}";
26 hash = "sha256-xdC+T79ZQBx/XhuIXtP93Roj0N9lF+E65ReEKQ4kIsg=";
27 };
28
29 patches = [
30 (fetchpatch {
31 name = "CVE-2021-45942.patch";
32 url = "https://github.com/AcademySoftwareFoundation/openexr/commit/11cad77da87c4fa2aab7d58dd5339e254db7937e.patch";
33 stripLen = 4;
34 extraPrefix = "OpenEXR/IlmImf/";
35 sha256 = "1wa2jn6sa0n3phaqvklnlbgk1bz60y756ad4jk4d757pzpnannsy";
36 })
37 (fetchpatch {
38 name = "CVE-2021-3933.patch";
39 url = "https://github.com/AcademySoftwareFoundation/openexr/commit/5db6f7aee79e3e75e8c3780b18b28699614dd08e.patch";
40 stripLen = 4;
41 extraPrefix = "OpenEXR/IlmImf/";
42 sha256 = "sha256-DrpldpNgN5pWKzIuuPIrynGX3EpP8YhJlu+lLfNFGxQ=";
43 })
44
45 # GCC 13 fixes
46 ./gcc-13.patch
47 ];
48
49 postPatch = ''
50 # tests are determined to use /var/tmp on unix
51 find . -name tmpDir.h | while read -r f ; do
52 substituteInPlace $f --replace '/var/tmp' "$TMPDIR"
53 done
54 # On slower machines this test can take more than the default 1500 seconds
55 echo 'set_tests_properties(OpenEXR.IlmImf PROPERTIES TIMEOUT 3000)' >> OpenEXR/IlmImfTest/CMakeLists.txt
56 '';
57
58 cmakeFlags = [
59 "-DCMAKE_CTEST_ARGUMENTS=--timeout;3600"
60 ]
61 ++ lib.optional stdenv.hostPlatform.isStatic "-DCMAKE_SKIP_RPATH=ON";
62
63 nativeBuildInputs = [ cmake ];
64 propagatedBuildInputs = [
65 ilmbase
66 zlib
67 ];
68
69 # https://github.com/AcademySoftwareFoundation/openexr/issues/1400
70 # https://github.com/AcademySoftwareFoundation/openexr/issues/1281
71 doCheck = !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isi686;
72
73 meta = with lib; {
74 description = "High dynamic-range (HDR) image file format";
75 homepage = "https://www.openexr.com/";
76 license = licenses.bsd3;
77 platforms = platforms.all;
78 insecure = true;
79 };
80}