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
cmake: classify libraries in /usr/lib as system libraries #98565
Conversation
/rebase-staging |
@hannesweisbach please rebase on staging. |
Would not this make builds less hermetic on Darwin (especially when not using sandbox)? |
This change is only relevant for App Bundle builds on macOS. For an App Bundle every non-system runtime dependency gets copied recursively into the App Bundle to make a standalone distributable package. The replacement of every occurence of '/usr' by '/var/empty' by Nix thwarts App Bundle builds, because libraries in /usr/lib do not get correctly classified as system libraries. This patch reverts this single path name back to '/usr/lib', so that packaging App Bundles on macOS works. FYI: within CMake the occurence is also guarded by an 'if(APPLE)' statement.
I hope I did that right. "cimg: 2.9.1 -> 2.9.2", commit |
@hannesweisbach you forgot to change the base branch. I did that for you. |
@@ -70,6 +70,12 @@ stdenv.mkDerivation rec { | |||
# CC_FOR_BUILD and CXX_FOR_BUILD are used to bootstrap cmake | |||
+ '' | |||
configureFlags="--parallel=''${NIX_BUILD_CORES:-1} CC=$CC_FOR_BUILD CXX=$CXX_FOR_BUILD $configureFlags" | |||
'' | |||
# Detect dylibs in /usr/lib as system libraries on Darwin to correctly build App bundles | |||
+ stdenv.lib.optionalString stdenv.isDarwin '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+ stdenv.lib.optionalString stdenv.isDarwin '' | |
+ lib.optionalString stdenv.isDarwin '' |
As per recent contributing change.
Motivation for this change
This change is only relevant for App Bundle builds on macOS. For an App Bundle
every non-system runtime dependency gets copied recursively into the App Bundle
to make a standalone distributable package.
The replacement of every occurence of '/usr' by '/var/empty' by Nix thwarts App
Bundle builds, because libraries in /usr/lib do not get correctly classified as
system libraries.
This patch reverts this single path name back to '/usr/lib', so that packaging
App Bundles on macOS works. FYI: within CMake the occurence is also guarded by
an 'if(APPLE)' statement.
The substituteInPlace matches only a single line: https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/GetPrerequisites.cmake#L522
Let me know, if a proper patch is preferred instead.
Draft, because I'm still building ;)Edit: Building the world succeeded
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)