-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
darwin.stdenv: propagate sdkRoot via extraBuildInputs #308366
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -41,28 +41,24 @@ runCommand "sdkroot-${sdkVersion}" { } '' | |||||
|
||||||
install -D '${../../../build-support/setup-hooks/role.bash}' "$out/nix-support/setup-hook" | ||||||
cat >> "$out/nix-support/setup-hook" <<-hook | ||||||
# | ||||||
# See comments in cc-wrapper's setup hook. This works exactly the same way. | ||||||
# | ||||||
[[ -z \''${strictDeps-} ]] || (( "\$hostOffset" < 0 )) || return 0 | ||||||
|
||||||
sdkRootHook() { | ||||||
# See ../../../build-support/setup-hooks/role.bash | ||||||
local role_post | ||||||
getHostRoleEnvHook | ||||||
|
||||||
# Only set the SDK root if one has not been set via this hook or some other means. | ||||||
if [[ ! \$NIX_CFLAGS_COMPILE =~ isysroot ]]; then | ||||||
local cflagsVar=NIX_CFLAGS_COMPILE\''${role_post} | ||||||
if [[ ! \''${!cflagsVar} =~ isysroot ]]; then | ||||||
export NIX_CFLAGS_COMPILE\''${role_post}+=' -isysroot $out/${sdkName}.sdk' | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't we want to reuse the |
||||||
fi | ||||||
} | ||||||
|
||||||
# See ../../../build-support/setup-hooks/role.bash | ||||||
getTargetRole | ||||||
|
||||||
Comment on lines
56
to
58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
If the below is correct I believe this no longer serves a purpose. Actually seems to be redundant even without the change from target to host offset because this sets role_post, which is unset right after. |
||||||
addEnvHooks "\$targetOffset" sdkRootHook | ||||||
addEnvHooks "\$hostOffset" sdkRootHook | ||||||
toonn marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
# No local scope in sourced file | ||||||
unset -v role_post | ||||||
unset -v cflagsVar role_post | ||||||
hook | ||||||
'' |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,9 +138,8 @@ let | |
|
||
inherit config; | ||
|
||
extraBuildInputs = [ prevStage.darwin.CF ]; | ||
extraNativeBuildInputs = extraNativeBuildInputs | ||
++ [ prevStage.darwin.apple_sdk.sdkRoot ]; | ||
extraBuildInputs = [ prevStage.darwin.CF prevStage.darwin.apple_sdk.sdkRoot ]; | ||
extraNativeBuildInputs = extraNativeBuildInputs; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potentially use inherit? |
||
|
||
preHook = lib.optionalString (!isBuiltByNixpkgsCompiler bash) '' | ||
# Don't patch #!/interpreter because it leads to retained | ||
|
@@ -671,7 +670,7 @@ in | |
# libc++, and libc++abi do not need CoreFoundation. Avoid propagating the CF from prior | ||
# stages to the final stdenv via rpath by dropping it from `extraBuildInputs`. | ||
stdenvNoCF = self.stdenv.override { | ||
extraBuildInputs = [ ]; | ||
extraBuildInputs = [ prevStage.darwin.apple_sdk.sdkRoot ]; | ||
}; | ||
|
||
libcxxBootstrapStdenv = self.overrideCC stdenvNoCF (self.llvmPackages.clangNoCompilerRtWithLibc.override { | ||
|
@@ -885,7 +884,7 @@ in | |
compiler-rt = superLib.compiler-rt.override ({ | ||
inherit (self.llvmPackages) libllvm; | ||
stdenv = self.stdenv.override { | ||
extraBuildInputs = [ self.darwin.CF ]; | ||
extraBuildInputs = [ self.darwin.CF prevStage.darwin.apple_sdk.sdkRoot ]; | ||
}; | ||
}); | ||
}); | ||
|
@@ -899,7 +898,7 @@ in | |
stdenv = | ||
let | ||
stdenvNoCF = super.stdenv.override { | ||
extraBuildInputs = [ ]; | ||
extraBuildInputs = [ prevStage.darwin.apple_sdk.sdkRoot ]; | ||
}; | ||
in | ||
self.overrideCC stdenvNoCF (self.llvmPackages.clangNoCompilerRtWithLibc.override { | ||
|
@@ -1230,9 +1229,9 @@ in | |
|
||
extraNativeBuildInputs = lib.optionals localSystem.isAarch64 [ | ||
prevStage.updateAutotoolsGnuConfigScriptsHook | ||
] ++ [ prevStage.darwin.apple_sdk.sdkRoot ]; | ||
]; | ||
|
||
extraBuildInputs = [ prevStage.darwin.CF ]; | ||
extraBuildInputs = [ prevStage.darwin.CF prevStage.darwin.apple_sdk.sdkRoot ]; | ||
|
||
inherit cc; | ||
|
||
|
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.
So we're dropping the exception when the hook isn't a build-time dependency and we're not doing a native compile?
Seems like a good thing to have it apply consistently.
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.
It needs to be
depsHostTarget
(i.e., abuildInput
), but the hook wasn’t being run unless I took this out. The doc seems to suggest it should work, but maybe I was doing something wrong.