Squashed 'third_party/bazel-toolchain/' content from commit a912bb381
Change-Id: Ie1ff8ed3b3948cca1d1b6227097c95e5a048de86
git-subtree-dir: third_party/bazel-toolchain
git-subtree-split: a912bb381b36437be0eeb22de11f0ea198450b4e
Signed-off-by: Brian Silverman <bsilver16834@gmail.com>
diff --git a/toolchain/host_libtool_wrapper.sh.tpl b/toolchain/host_libtool_wrapper.sh.tpl
new file mode 100644
index 0000000..ffef52d
--- /dev/null
+++ b/toolchain/host_libtool_wrapper.sh.tpl
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+# Some older `libtool` versions (~macOS 10.12) don't support arg files.
+#
+# This script flattens arg files into regular command line arguments.
+
+args=()
+for a in "${@}"; do
+ if [[ ${a} =~ @.* ]]; then
+ IFS=$'\n' read -d '' -r -a args_in_file < "${a:1}"
+ for arg in "${args_in_file[@]}"; do
+ args+=("${arg}")
+ done
+ else
+ args+=("${a}")
+ fi
+done
+
+exec "%{libtool_path}" "${args[@]}"