summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/build-support/bintools-wrapper/setup-hook.sh7
-rw-r--r--pkgs/build-support/cc-wrapper/setup-hook.sh7
-rw-r--r--pkgs/stdenv/generic/setup.sh37
3 files changed, 38 insertions, 13 deletions
diff --git a/pkgs/build-support/bintools-wrapper/setup-hook.sh b/pkgs/build-support/bintools-wrapper/setup-hook.sh
index c508963ac33e..48a00b0b9b07 100644
--- a/pkgs/build-support/bintools-wrapper/setup-hook.sh
+++ b/pkgs/build-support/bintools-wrapper/setup-hook.sh
@@ -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
diff --git a/pkgs/build-support/cc-wrapper/setup-hook.sh b/pkgs/build-support/cc-wrapper/setup-hook.sh
index 17877dc262c5..29a7306b9b7e 100644
--- a/pkgs/build-support/cc-wrapper/setup-hook.sh
+++ b/pkgs/build-support/cc-wrapper/setup-hook.sh
@@ -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
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 1850d322cc69..d2c67cce81a2 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -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
 }