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/cc-wrapper | |
parent | 8e5041ca6dcfe957a30b1e8efff42fa447e3f883 (diff) | |
parent | 60c5cf9cea56ffd607b48fe07ff1174ea6a13afc (diff) | |
download | nixpkgs-6979a72840a1f6f034cb6a11a3d114b17f792ad4.tar nixpkgs-6979a72840a1f6f034cb6a11a3d114b17f792ad4.tar.gz nixpkgs-6979a72840a1f6f034cb6a11a3d114b17f792ad4.tar.bz2 nixpkgs-6979a72840a1f6f034cb6a11a3d114b17f792ad4.tar.lz nixpkgs-6979a72840a1f6f034cb6a11a3d114b17f792ad4.tar.xz nixpkgs-6979a72840a1f6f034cb6a11a3d114b17f792ad4.tar.zst nixpkgs-6979a72840a1f6f034cb6a11a3d114b17f792ad4.zip |
Merge pull request #112449 from angerman/angerman/response-files
Add response file support when compiling with clang
Diffstat (limited to 'pkgs/build-support/cc-wrapper')
-rw-r--r-- | pkgs/build-support/cc-wrapper/cc-wrapper.sh | 16 | ||||
-rw-r--r-- | pkgs/build-support/cc-wrapper/default.nix | 1 |
2 files changed, 13 insertions, 4 deletions
diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh index 1450218aff2..f033836a962 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 8f20abc560a..31689022b32 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" } |