diff --git a/pkgs/build-support/cc-wrapper/setup-hook.sh b/pkgs/build-support/cc-wrapper/setup-hook.sh index 3d0b2fdfe8a..35620483d2b 100644 --- a/pkgs/build-support/cc-wrapper/setup-hook.sh +++ b/pkgs/build-support/cc-wrapper/setup-hook.sh @@ -22,20 +22,20 @@ envHooks+=(addCVars) # Note: these come *after* $out in the PATH (see setup.sh). -if [ -n "@cc@" ]; then - addToSearchPath PATH @cc@/bin +if [ -n "@binutils@" ]; then + addToSearchPath _PATH @binutils@/bin fi -if [ -n "@binutils@" ]; then - addToSearchPath PATH @binutils@/bin +if [ -n "@cc@" ]; then + addToSearchPath _PATH @cc@/bin fi if [ -n "@libc@" ]; then - addToSearchPath PATH @libc@/bin + addToSearchPath _PATH @libc@/bin fi if [ -n "@coreutils@" ]; then - addToSearchPath PATH @coreutils@/bin + addToSearchPath _PATH @coreutils@/bin fi if [ -z "$crossConfig" ]; then diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index b49846fa050..97eb855d359 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -214,7 +214,6 @@ PATH= for i in $initialPath; do if [ "$i" = / ]; then i=; fi addToSearchPath PATH $i/bin - addToSearchPath PATH $i/sbin done if [ "$NIX_DEBUG" = 1 ]; then @@ -262,6 +261,10 @@ findInputs() { source "$pkg" fi + if [ -d $1/bin ]; then + addToSearchPath _PATH $1/bin + fi + if [ -f "$pkg/nix-support/setup-hook" ]; then source "$pkg/nix-support/setup-hook" fi @@ -289,10 +292,6 @@ done _addToNativeEnv() { local pkg=$1 - if [ -d $1/bin ]; then - addToSearchPath _PATH $1/bin - fi - # Run the package-specific hooks set by the setup-hook scripts. runHook envHook "$pkg" } @@ -304,13 +303,6 @@ done _addToCrossEnv() { local pkg=$1 - # Some programs put important build scripts (freetype-config and similar) - # into their crossDrv bin path. Intentionally these should go after - # the nativePkgs in PATH. - if [ -d $1/bin ]; then - addToSearchPath _PATH $1/bin - fi - # Run the package-specific hooks set by the setup-hook scripts. runHook crossEnvHook "$pkg" }