stdenv-setup: Ease the transition with native builds
- All deps go on the PATH - CC and Bintools wrappers with their host != depender's host still get their setup hooks run. - Environment hooks get applied to all packages This isn't so elegent, but eases the transition on a very significant PR.
This commit is contained in:
parent
f083248290
commit
469fd89832
@ -4,8 +4,11 @@
|
||||
|
||||
set -u
|
||||
|
||||
# Skip setup hook if we're not a build-time dep
|
||||
(( "$hostOffset" < 0 )) || return 0
|
||||
# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
|
||||
# native compile.
|
||||
#
|
||||
# TODO(@Ericson2314): No native exception
|
||||
[[ -z ${crossConfig-} ]] || (( "$hostOffset" < 0 )) || return 0
|
||||
|
||||
bintoolsWrapper_addLDVars () {
|
||||
case $depHostOffset in
|
||||
|
@ -56,8 +56,11 @@
|
||||
|
||||
set -u
|
||||
|
||||
# Skip setup hook if we're not a build-time dep
|
||||
(( "$hostOffset" < 0 )) || return 0
|
||||
# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
|
||||
# native compile.
|
||||
#
|
||||
# TODO(@Ericson2314): No native exception
|
||||
[[ -z ${crossConfig-} ]] || (( "$hostOffset" < 0 )) || return 0
|
||||
|
||||
# It's fine that any other cc-wrapper will redefine this. Bash functions close
|
||||
# over no state, and there's no @-substitutions within, so any redefined
|
||||
|
@ -506,10 +506,12 @@ activatePackage() {
|
||||
|
||||
# Only dependencies whose host platform is guaranteed to match the
|
||||
# build platform are included here. That would be `depsBuild*`,
|
||||
# and legacy `nativeBuildInputs`. Other aren't because of cross
|
||||
# compiling, and we want to have consistent rules whether or not
|
||||
# we are cross compiling.
|
||||
if [[ "$hostOffset" -le -1 && -d "$pkg/bin" ]]; then
|
||||
# and legacy `nativeBuildInputs`, in general. If we aren't cross
|
||||
# compiling, however, everything can be put on the PATH. To ease
|
||||
# the transition, we do include everything in thatcase.
|
||||
#
|
||||
# TODO(@Ericson2314): Don't special-case native compilation
|
||||
if [[ ( -z "${crossConfig-}" || "$hostOffset" -le -1 ) && -d "$pkg/bin" ]]; then
|
||||
addToSearchPath _PATH "$pkg/bin"
|
||||
fi
|
||||
|
||||
@ -559,11 +561,28 @@ _addToEnv() {
|
||||
for depTargetOffset in "${allPlatOffsets[@]}"; do
|
||||
(( "$depHostOffset" <= "$depTargetOffset" )) || continue
|
||||
local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"
|
||||
local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"
|
||||
local pkgsSlice="${!pkgsRef}[@]"
|
||||
for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; do
|
||||
runHook "${!hookRef}" "$pkg"
|
||||
done
|
||||
if [[ -z "${crossConfig-}" ]]; then
|
||||
# Apply environment hooks to all packages during native
|
||||
# compilation to ease the transition.
|
||||
#
|
||||
# TODO(@Ericson2314): Don't special-case native compilation
|
||||
for pkg in \
|
||||
${pkgsBuildBuild+"${pkgsBuildBuild[@]}"} \
|
||||
${pkgsBuildHost+"${pkgsBuildHost[@]}"} \
|
||||
${pkgsBuildTarget+"${pkgsBuildTarget[@]}"} \
|
||||
${pkgsHostHost+"${pkgsHostHost[@]}"} \
|
||||
${pkgsHostTarget+"${pkgsHostTarget[@]}"} \
|
||||
${pkgsTargetTarget+"${pkgsTargetTarget[@]}"}
|
||||
do
|
||||
runHook "${!hookRef}" "$pkg"
|
||||
done
|
||||
else
|
||||
local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"
|
||||
local pkgsSlice="${!pkgsRef}[@]"
|
||||
for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; do
|
||||
runHook "${!hookRef}" "$pkg"
|
||||
done
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user