summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2017-07-06 17:19:53 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2017-08-07 03:05:50 -0400
commit42f35503b56e293759685e9fb2a66ba75a55c339 (patch)
tree9fdd4bb2215fd0d1b290527a932371046f7b9fd8 /pkgs/stdenv
parent9f1e009975dc2d58541de435c74a26afe011542a (diff)
cc-wrapper: Make hygienic
See the added comments for what exactly has been done.
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/setup.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index dc3369f6611c5..81ed1c635e171 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -336,8 +336,20 @@ fi
 
 # Set the relevant environment variables to point to the build inputs
 # found above.
+#
+# These `depOffset`s tell the env hook what sort of dependency
+# (ignoring propagatedness) is being passed to the env hook. In a real
+# language, we'd append a closure with this information to the
+# relevant env hook array, but bash doesn't have closures, so it's
+# easier to just pass this in.
+
 _addToNativeEnv() {
     local pkg="$1"
+    if [[ -n "${crossConfig:-}" ]]; then
+        local -i depOffset=-1
+    else
+        local -i depOffset=0
+    fi
 
     # Run the package-specific hooks set by the setup-hook scripts.
     runHook envHook "$pkg"
@@ -349,6 +361,7 @@ done
 
 _addToCrossEnv() {
     local pkg="$1"
+    local -i depOffset=0
 
     # Run the package-specific hooks set by the setup-hook scripts.
     runHook crossEnvHook "$pkg"