From eb7c50a993833ecdb94cc3affb55ac4c560edf50 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Wed, 31 Oct 2018 15:34:45 -0500 Subject: [PATCH] patch-shebangs: use --build for auto patch shebangs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In strictDeps=false, autoPatchshebangs should use --build (corresponding to PATH) to lookup commands. This restores the previous behavior of patchshebangs so that we don’t break stuff that isn’t careful in the buildInputs vs. nativeBuildInputs distinction. Unfortunately this won’t work under cross compilation. --- pkgs/build-support/setup-hooks/patch-shebangs.sh | 4 +++- pkgs/stdenv/generic/setup.sh | 8 -------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh index 441f230869b..b35c3c87625 100644 --- a/pkgs/build-support/setup-hooks/patch-shebangs.sh +++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh @@ -102,10 +102,12 @@ patchShebangs() { patchShebangsAuto () { if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then + if [ -z "${strictDeps-}"]; then + patchShebangs --build "$prefix" # Dev output will end up being run on the build platform. An # example case of this is sdl2-config. Otherwise, we can just # use the runtime path (--host). - if [ "$output" != out ] && [ "$output" = "${!outputDev}" ]; then + elif [ "$output" != out ] && [ "$output" = "${!outputDev}" ]; then patchShebangs --build "$prefix" else patchShebangs --host "$prefix" diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 8af369b1d17..81c1725f1d1 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -257,17 +257,9 @@ 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" - - # For backward compatibility, we add initial path to HOST_PATH so - # it can be used in auto patch-shebangs. Unfortunately this will - # not work with cross compilation. - if [ -z "${strictDeps-}" ]; then - addToSearchPath HOST_PATH "$i/bin" - fi done if (( "${NIX_DEBUG:-0}" >= 1 )); then