summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2018-09-16 15:58:21 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2018-09-16 15:58:21 -0500
commita4630c65caf8a239b9ba5c013466d485c4fd7fde (patch)
tree17151d2a07d093722e572608791bb7003dfeda78 /pkgs/stdenv
parent06c63123ccfbe3fa21b74819050281c6394ae6eb (diff)
downloadnixlib-a4630c65caf8a239b9ba5c013466d485c4fd7fde.tar
nixlib-a4630c65caf8a239b9ba5c013466d485c4fd7fde.tar.gz
nixlib-a4630c65caf8a239b9ba5c013466d485c4fd7fde.tar.bz2
nixlib-a4630c65caf8a239b9ba5c013466d485c4fd7fde.tar.lz
nixlib-a4630c65caf8a239b9ba5c013466d485c4fd7fde.tar.xz
nixlib-a4630c65caf8a239b9ba5c013466d485c4fd7fde.tar.zst
nixlib-a4630c65caf8a239b9ba5c013466d485c4fd7fde.zip
stdenv: add shell to HOST_PATH for backwards compatibility
To avoid breaking things, we need to make sure SHELL goes into
HOST_PATH. This reflects my changes to patch-shebangs to make it cross
compilation ready. When a script is patched from the Nix store it now
looks to HOST_PATH to get the targeted machine’s executables.
Unfortunately, this only works in native builds.
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/setup.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index e51dc1f1a0a6..9a620abfbade 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -257,6 +257,7 @@ shopt -s nullglob
 
 # Set up the initial path.
 PATH=
+HOST_PATH=
 for i in $initialPath; do
     if [ "$i" = / ]; then i=; fi
     addToSearchPath PATH "$i/bin"
@@ -272,6 +273,12 @@ if [ -z "${SHELL:-}" ]; then echo "SHELL not set"; exit 1; fi
 BASH="$SHELL"
 export CONFIG_SHELL="$SHELL"
 
+# For backward compatibility, we add SHELL to HOST_PATH so it can be
+# used in auto patch-shebangs. Unfortunately this will not work with
+# cross compilation because it will be for the builder’s platform.
+if [ -z "${strictDeps-}" ]; then
+    addToSearchPath HOST_PATH "$SHELL/bin"
+fi
 
 # Dummy implementation of the paxmark function. On Linux, this is
 # overwritten by paxctl's setup hook.