diff options
author | John Ericson <git@JohnEricson.me> | 2021-03-06 11:24:32 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-06 11:24:32 -0500 |
commit | 6979a72840a1f6f034cb6a11a3d114b17f792ad4 (patch) | |
tree | 2587d63ad3b74c89fe79c81dd1d3d57b7aa3991d /pkgs/build-support | |
parent | 8e5041ca6dcfe957a30b1e8efff42fa447e3f883 (diff) | |
parent | 60c5cf9cea56ffd607b48fe07ff1174ea6a13afc (diff) |
Merge pull request #112449 from angerman/angerman/response-files
Add response file support when compiling with clang
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/cc-wrapper/cc-wrapper.sh | 16 | ||||
-rw-r--r-- | pkgs/build-support/cc-wrapper/default.nix | 1 | ||||
-rw-r--r-- | pkgs/build-support/expand-response-params/default.nix | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh index 1450218aff27..f033836a962f 100644 --- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh +++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh @@ -198,7 +198,15 @@ fi PATH="$path_backup" # Old bash workaround, see above. -exec @prog@ \ - ${extraBefore+"${extraBefore[@]}"} \ - ${params+"${params[@]}"} \ - ${extraAfter+"${extraAfter[@]}"} + +if (( "${NIX_CC_USE_RESPONSE_FILE:-@use_response_file_by_default@}" >= 1 )); then + exec @prog@ "@<(printf "%q\n" \ + ${extraBefore+"${extraBefore[@]}"} \ + ${params+"${params[@]}"} \ + ${extraAfter+"${extraAfter[@]}"})" +else + exec @prog@ \ + ${extraBefore+"${extraBefore[@]}"} \ + ${params+"${params[@]}"} \ + ${extraAfter+"${extraAfter[@]}"} +fi diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 8f20abc560a2..31689022b326 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -160,6 +160,7 @@ stdenv.mkDerivation { local dst="$1" local wrapper="$2" export prog="$3" + export use_response_file_by_default=${if isClang then "1" else "0"} substituteAll "$wrapper" "$out/bin/$dst" chmod +x "$out/bin/$dst" } diff --git a/pkgs/build-support/expand-response-params/default.nix b/pkgs/build-support/expand-response-params/default.nix index 2a4bee74197b..402f0071a533 100644 --- a/pkgs/build-support/expand-response-params/default.nix +++ b/pkgs/build-support/expand-response-params/default.nix @@ -10,7 +10,7 @@ stdenv.mkDerivation { src=$PWD ''; buildPhase = '' - "$CC" -std=c99 -O3 -o "expand-response-params" expand-response-params.c + NIX_CC_USE_RESPONSE_FILE=0 "$CC" -std=c99 -O3 -o "expand-response-params" expand-response-params.c ''; installPhase = '' mkdir -p $prefix/bin |