Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openexr, ilmbase: Fix compilation on non-glibc. #94205

Merged
merged 1 commit into from
Aug 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks to be merged now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not available though (no release made).

# 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