Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / openexr / default.nix
blob1a135fa6d4a80ff0ed5d0de56e621cb2969269cb
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , zlib
5 , ilmbase
6 , fetchpatch
7 , cmake
8 }:
10 stdenv.mkDerivation rec {
11   pname = "openexr";
12   version = "2.5.8";
14   outputs = [ "bin" "dev" "out" "doc" ];
16   src = fetchFromGitHub {
17     owner = "AcademySoftwareFoundation";
18     repo = "openexr";
19     rev = "v${version}";
20     sha256 = "sha256-N7XdDaDsYdx4TXvHplQDTvhHNUmW5rntdaTKua4C0es=";
21   };
23   patches = [
24     (fetchpatch {
25       name = "CVE-2021-45942.patch";
26       url = "https://github.com/AcademySoftwareFoundation/openexr/commit/11cad77da87c4fa2aab7d58dd5339e254db7937e.patch";
27       stripLen = 4;
28       extraPrefix = "OpenEXR/IlmImf/";
29       sha256 = "1wa2jn6sa0n3phaqvklnlbgk1bz60y756ad4jk4d757pzpnannsy";
30     })
31     (fetchpatch {
32       name = "CVE-2021-3933.patch";
33       url = "https://github.com/AcademySoftwareFoundation/openexr/commit/5db6f7aee79e3e75e8c3780b18b28699614dd08e.patch";
34       stripLen = 4;
35       extraPrefix = "OpenEXR/IlmImf/";
36       sha256 = "sha256-DrpldpNgN5pWKzIuuPIrynGX3EpP8YhJlu+lLfNFGxQ=";
37     })
39     # Backport gcc-13 fix:
40     #   https://github.com/AcademySoftwareFoundation/openexr/pull/1264
41     ./gcc-13.patch
42   ];
44   postPatch = ''
45     # tests are determined to use /var/tmp on unix
46     find . -name tmpDir.h | while read -r f ; do
47       substituteInPlace $f --replace '/var/tmp' "$TMPDIR"
48     done
49     # On slower machines this test can take more than the default 1500 seconds
50     echo 'set_tests_properties(OpenEXR.IlmImf PROPERTIES TIMEOUT 3000)' >> OpenEXR/IlmImfTest/CMakeLists.txt
51   '';
53   cmakeFlags = [
54     "-DCMAKE_CTEST_ARGUMENTS=--timeout;3600"
55   ] ++ lib.optional stdenv.hostPlatform.isStatic "-DCMAKE_SKIP_RPATH=ON";
57   nativeBuildInputs = [ cmake ];
58   propagatedBuildInputs = [ ilmbase zlib ];
60   # https://github.com/AcademySoftwareFoundation/openexr/issues/1400
61   # https://github.com/AcademySoftwareFoundation/openexr/issues/1281
62   doCheck = !stdenv.isAarch32 && !stdenv.isi686;
64   meta = with lib; {
65     description = "A high dynamic-range (HDR) image file format";
66     homepage = "https://www.openexr.com/";
67     license = licenses.bsd3;
68     platforms = platforms.all;
69   };