about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/openexr
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/openexr')
-rw-r--r--nixpkgs/pkgs/development/libraries/openexr/3.nix55
-rw-r--r--nixpkgs/pkgs/development/libraries/openexr/default.nix70
-rw-r--r--nixpkgs/pkgs/development/libraries/openexr/disable-iex-test.patch13
-rw-r--r--nixpkgs/pkgs/development/libraries/openexr/gcc-13.patch33
4 files changed, 171 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/openexr/3.nix b/nixpkgs/pkgs/development/libraries/openexr/3.nix
new file mode 100644
index 000000000000..826c7b2c854f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openexr/3.nix
@@ -0,0 +1,55 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, cmake
+, imath
+, libdeflate
+, pkg-config
+}:
+
+stdenv.mkDerivation rec {
+  pname = "openexr";
+  version = "3.2.1";
+
+  src = fetchFromGitHub {
+    owner = "AcademySoftwareFoundation";
+    repo = "openexr";
+    rev = "v${version}";
+    hash = "sha256-ycn2RbHM/vIDUGGGnfNZ0Zm0qjjKRRNhkMD11PkpGF0=";
+  };
+
+  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.isi686 "-msse2 -mfpmath=sse";
+
+  # https://github.com/AcademySoftwareFoundation/openexr/issues/1400
+  doCheck = !stdenv.isAarch32;
+
+  meta = with lib; {
+    description = "A high dynamic-range (HDR) image file format";
+    homepage = "https://www.openexr.com";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ paperdigits ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openexr/default.nix b/nixpkgs/pkgs/development/libraries/openexr/default.nix
new file mode 100644
index 000000000000..1a135fa6d4a8
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openexr/default.nix
@@ -0,0 +1,70 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, zlib
+, ilmbase
+, fetchpatch
+, cmake
+}:
+
+stdenv.mkDerivation rec {
+  pname = "openexr";
+  version = "2.5.8";
+
+  outputs = [ "bin" "dev" "out" "doc" ];
+
+  src = fetchFromGitHub {
+    owner = "AcademySoftwareFoundation";
+    repo = "openexr";
+    rev = "v${version}";
+    sha256 = "sha256-N7XdDaDsYdx4TXvHplQDTvhHNUmW5rntdaTKua4C0es=";
+  };
+
+  patches = [
+    (fetchpatch {
+      name = "CVE-2021-45942.patch";
+      url = "https://github.com/AcademySoftwareFoundation/openexr/commit/11cad77da87c4fa2aab7d58dd5339e254db7937e.patch";
+      stripLen = 4;
+      extraPrefix = "OpenEXR/IlmImf/";
+      sha256 = "1wa2jn6sa0n3phaqvklnlbgk1bz60y756ad4jk4d757pzpnannsy";
+    })
+    (fetchpatch {
+      name = "CVE-2021-3933.patch";
+      url = "https://github.com/AcademySoftwareFoundation/openexr/commit/5db6f7aee79e3e75e8c3780b18b28699614dd08e.patch";
+      stripLen = 4;
+      extraPrefix = "OpenEXR/IlmImf/";
+      sha256 = "sha256-DrpldpNgN5pWKzIuuPIrynGX3EpP8YhJlu+lLfNFGxQ=";
+    })
+
+    # Backport gcc-13 fix:
+    #   https://github.com/AcademySoftwareFoundation/openexr/pull/1264
+    ./gcc-13.patch
+  ];
+
+  postPatch = ''
+    # tests are determined to use /var/tmp on unix
+    find . -name tmpDir.h | while read -r f ; do
+      substituteInPlace $f --replace '/var/tmp' "$TMPDIR"
+    done
+    # On slower machines this test can take more than the default 1500 seconds
+    echo 'set_tests_properties(OpenEXR.IlmImf PROPERTIES TIMEOUT 3000)' >> OpenEXR/IlmImfTest/CMakeLists.txt
+  '';
+
+  cmakeFlags = [
+    "-DCMAKE_CTEST_ARGUMENTS=--timeout;3600"
+  ] ++ lib.optional stdenv.hostPlatform.isStatic "-DCMAKE_SKIP_RPATH=ON";
+
+  nativeBuildInputs = [ cmake ];
+  propagatedBuildInputs = [ ilmbase zlib ];
+
+  # https://github.com/AcademySoftwareFoundation/openexr/issues/1400
+  # https://github.com/AcademySoftwareFoundation/openexr/issues/1281
+  doCheck = !stdenv.isAarch32 && !stdenv.isi686;
+
+  meta = with lib; {
+    description = "A high dynamic-range (HDR) image file format";
+    homepage = "https://www.openexr.com/";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/openexr/disable-iex-test.patch b/nixpkgs/pkgs/development/libraries/openexr/disable-iex-test.patch
new file mode 100644
index 000000000000..f8fff65aceb4
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openexr/disable-iex-test.patch
@@ -0,0 +1,13 @@
+diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
+index 44d9185d..8ffcd2b2 100644
+--- a/src/test/CMakeLists.txt
++++ b/src/test/CMakeLists.txt
+@@ -4,7 +4,7 @@
+ # We require this to get object library link library support and
+ # combined python 2 + 3 support
+ 
+-add_subdirectory(IexTest)
++#add_subdirectory(IexTest)
+ add_subdirectory(OpenEXRCoreTest)
+ add_subdirectory(OpenEXRTest)
+ add_subdirectory(OpenEXRUtilTest)
diff --git a/nixpkgs/pkgs/development/libraries/openexr/gcc-13.patch b/nixpkgs/pkgs/development/libraries/openexr/gcc-13.patch
new file mode 100644
index 000000000000..d508b6028f76
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/openexr/gcc-13.patch
@@ -0,0 +1,33 @@
+https://github.com/AcademySoftwareFoundation/openexr/pull/1264
+https://github.com/AcademySoftwareFoundation/openexr/commit/d0088a3c6943a9a53fc24e29885414d082d531fe.patch
+
+--- a/OpenEXR/IlmImf/ImfDwaCompressor.cpp
++++ b/OpenEXR/IlmImf/ImfDwaCompressor.cpp
+@@ -159,6 +159,7 @@
+ #include <limits>
+ 
+ #include <cstddef>
++#include <cstdint>
+ 
+ 
+ // Windows specific addition to prevent the indirect import of the redefined min/max macros
+--- a/OpenEXR/IlmImf/ImfHuf.cpp
++++ b/OpenEXR/IlmImf/ImfHuf.cpp
+@@ -53,6 +53,7 @@
+ #include <cstring>
+ #include <cassert>
+ #include <algorithm>
++#include <cstdint>
+ 
+ 
+ using namespace std;
+--- a/OpenEXR/IlmImf/ImfMisc.cpp
++++ b/OpenEXR/IlmImf/ImfMisc.cpp
+@@ -52,6 +52,7 @@
+ #include <ImfConvert.h>
+ #include <ImfPartType.h>
+ #include <ImfTileDescription.h>
++#include <cstdint>
+ #include "ImfNamespace.h"
+ 
+ OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER