summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2018-11-14 19:42:04 +0100
committerDaiderd Jordan <daiderd@gmail.com>2018-11-14 23:37:32 +0100
commitbdec3ed049477a0c2b0b615d0a6c5e5b79ea74cb (patch)
tree8cc69dc2a9b6f26f1aba2847c1205ddf6bc4a2dc /pkgs/build-support/setup-hooks
parentc9223a17bc86fda888b36b7fde9ebc5bed3f0463 (diff)
downloadnixpkgs-bdec3ed049477a0c2b0b615d0a6c5e5b79ea74cb.tar
nixpkgs-bdec3ed049477a0c2b0b615d0a6c5e5b79ea74cb.tar.gz
nixpkgs-bdec3ed049477a0c2b0b615d0a6c5e5b79ea74cb.tar.bz2
nixpkgs-bdec3ed049477a0c2b0b615d0a6c5e5b79ea74cb.tar.lz
nixpkgs-bdec3ed049477a0c2b0b615d0a6c5e5b79ea74cb.tar.xz
nixpkgs-bdec3ed049477a0c2b0b615d0a6c5e5b79ea74cb.tar.zst
nixpkgs-bdec3ed049477a0c2b0b615d0a6c5e5b79ea74cb.zip
Revert "Revert "Revert "patch-shebangs: respect cross compilation"""
Completely breaks darwin. Every package in the stdenv that has shebangs
in the output will end up with references to bootstrap-tools.

This reverts commit bde99096a80e74692795fa2782619c46a476839e.
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r--pkgs/build-support/setup-hooks/patch-shebangs.sh53
1 files changed, 3 insertions, 50 deletions
diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh
index 441f230869b..d26bf735d30 100644
--- a/pkgs/build-support/setup-hooks/patch-shebangs.sh
+++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh
@@ -5,32 +5,10 @@
 # rewritten to /nix/store/<hash>/bin/python.  Interpreters that are
 # already in the store are left untouched.
 
-fixupOutputHooks+=(patchShebangsAuto)
-
-# Run patch shebangs on a directory.
-# patchShebangs [--build | --host] directory
-
-# Flags:
-# --build : Lookup commands available at build-time
-# --host  : Lookup commands available at runtime
-
-# Example use cases,
-# $ patchShebangs --host /nix/store/...-hello-1.0/bin
-# $ patchShebangs --build configure
+fixupOutputHooks+=('if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then patchShebangs "$prefix"; fi')
 
 patchShebangs() {
-    local pathName
-
-    if [ "$1" = "--host" ]; then
-        pathName=HOST_PATH
-        shift
-    elif [ "$1" = "--build" ]; then
-        pathName=PATH
-        shift
-    fi
-
     local dir="$1"
-
     header "patching script interpreter paths in $dir"
     local f
     local oldPath
@@ -49,14 +27,6 @@ patchShebangs() {
         oldInterpreterLine=$(head -1 "$f" | tail -c+3)
         read -r oldPath arg0 args <<< "$oldInterpreterLine"
 
-        if [ -z "$pathName" ]; then
-            if [ -n "$strictDeps" ] && [[ "$f" = "$NIX_STORE"* ]]; then
-                pathName=HOST_PATH
-            else
-                pathName=PATH
-            fi
-        fi
-
         if $(echo "$oldPath" | grep -q "/bin/env$"); then
             # Check for unsupported 'env' functionality:
             # - options: something starting with a '-'
@@ -65,17 +35,14 @@ patchShebangs() {
                 echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
                 exit 1
             fi
-
-            newPath="$(PATH="${!pathName}" command -v "$arg0" || true)"
+            newPath="$(command -v "$arg0" || true)"
         else
             if [ "$oldPath" = "" ]; then
                 # If no interpreter is specified linux will use /bin/sh. Set
                 # oldpath="/bin/sh" so that we get /nix/store/.../sh.
                 oldPath="/bin/sh"
             fi
-
-            newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)"
-
+            newPath="$(command -v "$(basename "$oldPath")" || true)"
             args="$arg0 $args"
         fi
 
@@ -98,17 +65,3 @@ patchShebangs() {
 
     stopNest
 }
-
-patchShebangsAuto () {
-    if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then
-
-        # 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
-            patchShebangs --build "$prefix"
-        else
-            patchShebangs --host "$prefix"
-        fi
-    fi
-}