git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #94205 from nh2/ilmbase-non-glibc-fpstate

openexr, ilmbase: Fix compilation on non-glibc.

commit388076f985481b6bcfbd613850bb741d2c30e933 authorNiklas Hambüchen <mail@nh2.me> dateTue 11 Aug 2020, 00:39 (6 years ago) parentb8e21e1d939373
2 files changed+34−2
pkgs/development/libraries/ilmbase/default.nix+6−1 pkgs/development/libraries/openexr/default.nix+28−1
pkgs/development/libraries/ilmbase/default.nix+6−1
@@ -1,4 +1,5 @@
11{ stdenv
2+, lib
23, buildPackages
34, cmake
45, libtool
@@ -20,7 +21,11 @@ stdenv.mkDerivation rec {
2021 nativeBuildInputs = [ cmake libtool ];
2122 depsBuildBuild = [ buildPackages.stdenv.cc ];
2223
23− patches = [ ./cross.patch ];
24+ patches = [
25+ ./cross.patch
26+ ] ++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.libc != "glibc") [
27+ openexr.non_glibc_fpstate_patch # see description of this patch in `openexr`
28+ ];
2429
2530 # fails 1 out of 1 tests with
2631 # "lt-ImathTest: testBoxAlgo.cpp:892: void {anonymous}::boxMatrixTransform(): Assertion `b21 == b2' failed"
pkgs/development/libraries/openexr/default.nix+28−1
@@ -4,10 +4,24 @@
44, fetchFromGitHub
55, zlib
66, ilmbase
7−, fetchpatch
7+, fetchpatch
88, cmake
99, libtool
1010}:
11+
12+let
13+ non_glibc_fpstate_patch =
14+ # Fix ilmbase/openexr using glibc-only fpstate.
15+ # Found via https://git.alpinelinux.org/aports/tree/community/openexr/10-musl-_fpstate.patch?id=80d9611b7b8e406a554c6f511137e03ff26acbae,
16+ # TODO Remove when https://github.com/AcademySoftwareFoundation/openexr/pull/798 is merged and available.
17+ # Remove it from `ilmbase` as well then.
18+ (fetchpatch {
19+ name = "ilmbase-musl-_fpstate.patch.patch";
20+ url = "https://raw.githubusercontent.com/void-linux/void-packages/80bbc168faa25448bd3399f4df331b836e74b85c/srcpkgs/ilmbase/patches/musl-_fpstate.patch";
21+ sha256 = "0appzbs9pd6dia5pzxmrs9ww35shlxi329ks6lchwzw4f2a81arz";
22+ });
23+in
24+
1125stdenv.mkDerivation rec {
1226 pname = "openexr";
1327 version = "2.4.1";
@@ -23,8 +37,21 @@ stdenv.mkDerivation rec {
2337 nativeBuildInputs = [ cmake libtool ];
2438 propagatedBuildInputs = [ ilmbase zlib ];
2539
40+ postPatch =
41+ if (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.libc != "glibc")
42+ then
43+ ''
44+ patch -p0 < ${non_glibc_fpstate_patch}
45+ ''
46+ else null; # `null` avoids rebuild on glibc
47+
2648 enableParallelBuilding = true;
2749
50+ passthru = {
51+ # So that ilmbase (sharing the same source code) can re-use this patch.
52+ inherit non_glibc_fpstate_patch;
53+ };
54+
2855 meta = with stdenv.lib; {
2956 description = "A high dynamic-range (HDR) image file format";
3057 homepage = "https://www.openexr.com/";