summary refs log tree commit diff
path: root/pkgs/build-support/cc-wrapper
diff options
context:
space:
mode:
authorCraig Hall <ch9871@gmail.com>2019-08-04 01:57:49 +0100
committerCraig Hall <ch9871@gmail.com>2019-09-01 16:53:06 +0100
commit0b7494ed2b8641cbe28ab9a74b54bc53408f031b (patch)
treef09414c02a3a0fbd7ca63d0fffcc964d2a665cf3 /pkgs/build-support/cc-wrapper
parent8d1510abfb592339e13ce8f6db6f29c1f8b72924 (diff)
downloadnixpkgs-0b7494ed2b8641cbe28ab9a74b54bc53408f031b.tar
nixpkgs-0b7494ed2b8641cbe28ab9a74b54bc53408f031b.tar.gz
nixpkgs-0b7494ed2b8641cbe28ab9a74b54bc53408f031b.tar.bz2
nixpkgs-0b7494ed2b8641cbe28ab9a74b54bc53408f031b.tar.lz
nixpkgs-0b7494ed2b8641cbe28ab9a74b54bc53408f031b.tar.xz
nixpkgs-0b7494ed2b8641cbe28ab9a74b54bc53408f031b.tar.zst
nixpkgs-0b7494ed2b8641cbe28ab9a74b54bc53408f031b.zip
cc-wrapper: add (partial) support for clang -cc1
We need this for intel-compute-runtime, see #63705
Diffstat (limited to 'pkgs/build-support/cc-wrapper')
-rw-r--r--pkgs/build-support/cc-wrapper/cc-wrapper.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/build-support/cc-wrapper/cc-wrapper.sh b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
index bb789010008..ba3dfc96f5c 100644
--- a/pkgs/build-support/cc-wrapper/cc-wrapper.sh
+++ b/pkgs/build-support/cc-wrapper/cc-wrapper.sh
@@ -33,6 +33,7 @@ fi
 # GCC prints annoying warnings when they are not needed.
 dontLink=0
 nonFlagArgs=0
+cc1=0
 # shellcheck disable=SC2193
 [[ "@prog@" = *++ ]] && isCpp=1 || isCpp=0
 cppInclude=1
@@ -68,6 +69,8 @@ while (( "$n" < "$nParams" )); do
     elif [[ "$p" != -?* ]]; then
         # A dash alone signifies standard input; it is not a flag
         nonFlagArgs=1
+    elif [ "$p" = -cc1 ]; then
+        cc1=1
     fi
     n+=1
 done
@@ -167,6 +170,14 @@ if [ "$*" = -v ]; then
     extraBefore=()
 fi
 
+# clang's -cc1 mode is not compatible with most options
+# that we would pass. Rather than trying to pass only
+# options that would work, let's just remove all of them.
+if [ "$cc1" = 1 ]; then
+  extraAfter=()
+  extraBefore=()
+fi
+
 # Optionally print debug info.
 if (( "${NIX_DEBUG:-0}" >= 1 )); then
     # Old bash workaround, see ld-wrapper for explanation.