Skip to content

Commit 14985a8

Browse files
authored
Merge pull request swiftlang#27550 from mikeash/compiler-retweet
[build-script-impl] Handle multiple version directories in TOOLCHAIN/usr/lib/clang.
2 parents 98d358c + afb904f commit 14985a8

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

utils/build-script-impl

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,10 @@ KNOWN_SETTINGS=(
284284
# these functions.
285285

286286
function call() {
287-
if [[ ${DRY_RUN} ]]; then
287+
if [[ ${DRY_RUN} ]] || [[ "${VERBOSE_BUILD}" ]]; then
288288
echo "${PS4}"$(quoted_print "$@")
289-
else
289+
fi
290+
if [[ ! ${DRY_RUN} ]]; then
290291
{ set -x; } 2>/dev/null
291292
"$@"
292293
{ set +x; } 2>/dev/null
@@ -2929,23 +2930,24 @@ for host in "${ALL_HOSTS[@]}"; do
29292930
if [[ "${product}" == "llvm" && "${BUILD_LLVM}" == "1" ]]; then
29302931
if [[ "$(uname -s)" == "Darwin" ]] ; then
29312932
HOST_CXX_DIR=$(dirname "${HOST_CXX}")
2932-
HOST_CXX_BUILTINS_VERSION=$(ls "$HOST_CXX_DIR/../lib/clang" | awk '{print $0}')
2933-
HOST_CXX_BUILTINS_DIR="$HOST_CXX_DIR/../lib/clang/$HOST_CXX_BUILTINS_VERSION/lib/darwin"
29342933
DEST_CXX_BUILTINS_VERSION=$(ls "$(build_directory_bin ${host} llvm)/../lib/clang" | awk '{print $0}')
29352934
DEST_BUILTINS_DIR="$(build_directory_bin ${host} llvm)/../lib/clang/$DEST_CXX_BUILTINS_VERSION/lib/darwin"
29362935

29372936
if [ -d "$DEST_BUILTINS_DIR" ]; then
2938-
echo "copying compiler-rt embedded builtins into the local clang build directory $DEST_BUILTINS_DIR."
2939-
2940-
if [ -f "$HOST_CXX_BUILTINS_DIR/libclang_rt.ios.a" ]; then
2941-
call cp "$HOST_CXX_BUILTINS_DIR/libclang_rt.ios.a" "$DEST_BUILTINS_DIR/libclang_rt.ios.a"
2942-
fi
2943-
if [ -f "$HOST_CXX_BUILTINS_DIR/libclang_rt.watchos.a" ]; then
2944-
call cp "$HOST_CXX_BUILTINS_DIR/libclang_rt.watchos.a" "$DEST_BUILTINS_DIR/libclang_rt.watchos.a"
2945-
fi
2946-
if [ -f "$HOST_CXX_BUILTINS_DIR/libclang_rt.tvos.a" ]; then
2947-
call cp "$HOST_CXX_BUILTINS_DIR/libclang_rt.tvos.a" "$DEST_BUILTINS_DIR/libclang_rt.tvos.a"
2948-
fi
2937+
for HOST_CXX_BUILTINS_PATH in "$HOST_CXX_DIR/../lib/clang"/*; do
2938+
HOST_CXX_BUILTINS_DIR="$HOST_CXX_BUILTINS_PATH/lib/darwin"
2939+
echo "copying compiler-rt embedded builtins from $HOST_CXX_BUILTINS_DIR into the local clang build directory $DEST_BUILTINS_DIR."
2940+
2941+
for OS in ios watchos tvos; do
2942+
LIB_NAME="libclang_rt.$OS.a"
2943+
HOST_LIB_PATH="$HOST_CXX_BUILTINS_DIR/$LIB_NAME"
2944+
if [ -f "$HOST_LIB_PATH" ]; then
2945+
call cp "$HOST_LIB_PATH" "$DEST_BUILTINS_DIR/$LIB_NAME"
2946+
elif [[ "${VERBOSE_BUILD}" ]]; then
2947+
echo "no file exists at $HOST_LIB_PATH"
2948+
fi
2949+
done
2950+
done
29492951
fi
29502952
fi
29512953
fi

0 commit comments

Comments
 (0)