Automated rollback of commit d3fc253a49a00c34408bbaf5378376cbcea1c5c9.
*** Reason for rollback ***
Breaks downstream projects on Mac: Bazel Examples, rules_apple, rules_cc, rules_go, TensorFlow.
See breakages:
https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1743
Downstream with rollback:
https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/1744
*** Original change description ***
Add support for params files for darwin
Clang has supported params files for a while now. This updates the cc
toolchain for darwin to use them.
The logic for processing response files is mostly copied from
rules_swift where similar processing is done.
Closes #12265.
PiperOrigin-RevId: 340638807
diff --git a/tools/cpp/osx_cc_wrapper.sh b/tools/cpp/osx_cc_wrapper.sh
index 8c9c111..bbb5d7e 100755
--- a/tools/cpp/osx_cc_wrapper.sh
+++ b/tools/cpp/osx_cc_wrapper.sh
@@ -34,32 +34,19 @@
LIB_DIRS=
RPATHS=
OUTPUT=
-
-function parse_option() {
- local -r opt="$1"
- if [[ "${OUTPUT}" = "1" ]]; then
- OUTPUT=$opt
- elif [[ "$opt" =~ ^-l(.*)$ ]]; then
- LIBS="${BASH_REMATCH[1]} $LIBS"
- elif [[ "$opt" =~ ^-L(.*)$ ]]; then
- LIB_DIRS="${BASH_REMATCH[1]} $LIB_DIRS"
- elif [[ "$opt" =~ ^-Wl,-rpath,\@loader_path/(.*)$ ]]; then
- RPATHS="${BASH_REMATCH[1]} ${RPATHS}"
- elif [[ "$opt" = "-o" ]]; then
- # output is coming
- OUTPUT=1
- fi
-}
-
# let parse the option list
for i in "$@"; do
- if [[ "$i" = @* ]]; then
- while IFS= read -r opt
- do
- parse_option "$opt"
- done < "${i:1}" || exit 1
- else
- parse_option "$i"
+ if [[ "${OUTPUT}" = "1" ]]; then
+ OUTPUT=$i
+ elif [[ "$i" =~ ^-l(.*)$ ]]; then
+ LIBS="${BASH_REMATCH[1]} $LIBS"
+ elif [[ "$i" =~ ^-L(.*)$ ]]; then
+ LIB_DIRS="${BASH_REMATCH[1]} $LIB_DIRS"
+ elif [[ "$i" =~ ^-Wl,-rpath,\@loader_path/(.*)$ ]]; then
+ RPATHS="${BASH_REMATCH[1]} ${RPATHS}"
+ elif [[ "$i" = "-o" ]]; then
+ # output is coming
+ OUTPUT=1
fi
done