Skip to content

Commit

Permalink
Merge pull request #94205 from nh2/ilmbase-non-glibc-fpstate
Browse files Browse the repository at this point in the history
openexr, ilmbase: Fix compilation on non-glibc.
  • Loading branch information
nh2 committed Aug 10, 2020
2 parents b8e21e1 + d939373 commit 388076f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
7 changes: 6 additions & 1 deletion pkgs/development/libraries/ilmbase/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{ stdenv
, lib
, buildPackages
, cmake
, libtool
Expand All @@ -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"
Expand Down
29 changes: 28 additions & 1 deletion pkgs/development/libraries/openexr/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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/";
Expand Down

0 comments on commit 388076f

Please sign in to comment.