diff --git a/pkgs/development/libraries/ilmbase/default.nix b/pkgs/development/libraries/ilmbase/default.nix index 9d2479c2e0b..ac78257b74a 100644 --- a/pkgs/development/libraries/ilmbase/default.nix +++ b/pkgs/development/libraries/ilmbase/default.nix @@ -1,4 +1,5 @@ { stdenv +, lib , buildPackages , cmake , libtool @@ -20,7 +21,11 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake libtool ]; depsBuildBuild = [ buildPackages.stdenv.cc ]; - patches = [ ./cross.patch ]; + patches = [ + ./cross.patch + ] ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.libc != "glibc") [ + openexr.non_glibc_fpstate_patch # see description of this patch in `openexr` + ]; # fails 1 out of 1 tests with # "lt-ImathTest: testBoxAlgo.cpp:892: void {anonymous}::boxMatrixTransform(): Assertion `b21 == b2' failed" diff --git a/pkgs/development/libraries/openexr/default.nix b/pkgs/development/libraries/openexr/default.nix index 425afc70f37..a1f5183da90 100644 --- a/pkgs/development/libraries/openexr/default.nix +++ b/pkgs/development/libraries/openexr/default.nix @@ -4,10 +4,24 @@ , fetchFromGitHub , zlib , ilmbase -, fetchpatch +, fetchpatch , cmake , libtool }: + +let + non_glibc_fpstate_patch = + # Fix ilmbase/openexr using glibc-only fpstate. + # Found via https://git.alpinelinux.org/aports/tree/community/openexr/10-musl-_fpstate.patch?id=80d9611b7b8e406a554c6f511137e03ff26acbae, + # TODO Remove when https://github.com/AcademySoftwareFoundation/openexr/pull/798 is merged and available. + # Remove it from `ilmbase` as well then. + (fetchpatch { + name = "ilmbase-musl-_fpstate.patch.patch"; + url = "https://raw.githubusercontent.com/void-linux/void-packages/80bbc168faa25448bd3399f4df331b836e74b85c/srcpkgs/ilmbase/patches/musl-_fpstate.patch"; + sha256 = "0appzbs9pd6dia5pzxmrs9ww35shlxi329ks6lchwzw4f2a81arz"; + }); +in + stdenv.mkDerivation rec { pname = "openexr"; version = "2.4.1"; @@ -23,8 +37,21 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake libtool ]; propagatedBuildInputs = [ ilmbase zlib ]; + postPatch = + if (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.libc != "glibc") + then + '' + patch -p0 < ${non_glibc_fpstate_patch} + '' + else null; # `null` avoids rebuild on glibc + enableParallelBuilding = true; + passthru = { + # So that ilmbase (sharing the same source code) can re-use this patch. + inherit non_glibc_fpstate_patch; + }; + meta = with stdenv.lib; { description = "A high dynamic-range (HDR) image file format"; homepage = "https://www.openexr.com/";