diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index d5ae64c9c5ff..bb95c1807ab9 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -342,7 +342,8 @@ stdenv.mkDerivation { inherit dynamicLinker expand-response-params; - expandResponseParams = expand-response-params; # for substitution in utils.sh + # for substitution in utils.sh + expandResponseParams = "${expand-response-params}/bin/expand-response-params"; crossAttrs = { shell = shell.crossDrv + shell.crossDrv.shellPath; diff --git a/pkgs/build-support/cc-wrapper/utils.sh b/pkgs/build-support/cc-wrapper/utils.sh index 7e9979f10ae8..c84a094e26b0 100644 --- a/pkgs/build-support/cc-wrapper/utils.sh +++ b/pkgs/build-support/cc-wrapper/utils.sh @@ -30,7 +30,7 @@ expandResponseParams() { if [[ "$arg" == @* ]]; then # phase separation makes this look useless # shellcheck disable=SC2157 - if [ -n "@expandResponseParams@" ]; then + if [ -x "@expandResponseParams@" ]; then # params is used by caller #shellcheck disable=SC2034 readarray -d '' params < <("@expandResponseParams@" "$@") diff --git a/pkgs/build-support/expand-response-params/default.nix b/pkgs/build-support/expand-response-params/default.nix index 7afbb727fc3e..2a4bee74197b 100644 --- a/pkgs/build-support/expand-response-params/default.nix +++ b/pkgs/build-support/expand-response-params/default.nix @@ -3,11 +3,17 @@ stdenv.mkDerivation { name = "expand-response-params"; src = ./expand-response-params.c; - buildCommand = '' - # Work around "stdenv-darwin-boot-2 is not allowed to refer to path /nix/store/...-expand-response-params.c" + # Work around "stdenv-darwin-boot-2 is not allowed to refer to path + # /nix/store/...-expand-response-params.c" + unpackPhase = '' cp "$src" expand-response-params.c - "$CC" -std=c99 -O3 -o "$out" expand-response-params.c - strip -S $out - ${stdenv.lib.optionalString stdenv.hostPlatform.isLinux "patchelf --shrink-rpath $out"} + src=$PWD + ''; + buildPhase = '' + "$CC" -std=c99 -O3 -o "expand-response-params" expand-response-params.c + ''; + installPhase = '' + mkdir -p $prefix/bin + mv expand-response-params $prefix/bin/ ''; } diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index 48deb9a5c02c..fab1985b9765 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -310,7 +310,7 @@ in # More complicated cases ++ [ glibc.out glibc.dev glibc.bin/*propagated from .dev*/ linuxHeaders - gcc gcc.cc gcc.cc.lib gcc.expandResponseParams + gcc gcc.cc gcc.cc.lib gcc.expand-response-params ] ++ lib.optionals (system == "aarch64-linux") [ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ];