Skip to content

Commit 91c9501

Browse files
committed
[build-script-impl] Handle multiple version directories in TOOLCHAIN/usr/lib/clang.
This ensures that compiler-rt gets copied across even if there's more than one version listed. rdar://problem/55974236
1 parent b32e82c commit 91c9501

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

utils/build-script-impl

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,23 +2929,24 @@ for host in "${ALL_HOSTS[@]}"; do
29292929
if [[ "${product}" == "llvm" && "${BUILD_LLVM}" == "1" ]]; then
29302930
if [[ "$(uname -s)" == "Darwin" ]] ; then
29312931
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"
29342932
DEST_CXX_BUILTINS_VERSION=$(ls "$(build_directory_bin ${host} llvm)/../lib/clang" | awk '{print $0}')
29352933
DEST_BUILTINS_DIR="$(build_directory_bin ${host} llvm)/../lib/clang/$DEST_CXX_BUILTINS_VERSION/lib/darwin"
29362934

29372935
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
2936+
for HOST_CXX_BUILTINS_PATH in "$HOST_CXX_DIR/../lib/clang"/*; do
2937+
HOST_CXX_BUILTINS_DIR="$HOST_CXX_BUILTINS_PATH/lib/darwin"
2938+
echo "copying compiler-rt embedded builtins from $HOST_CXX_BUILTINS_DIR into the local clang build directory $DEST_BUILTINS_DIR."
2939+
2940+
for OS in ios watchos tvos; do
2941+
LIB_NAME="libclang_rt.$OS.a"
2942+
HOST_LIB_PATH="$HOST_CXX_BUILTINS_DIR/$LIB_NAME"
2943+
if [ -f "$HOST_LIB_PATH" ]; then
2944+
call cp "$HOST_LIB_PATH" "$DEST_BUILTINS_DIR/$LIB_NAME"
2945+
elif [[ "${VERBOSE_BUILD}" ]]; then
2946+
echo "no file exists at $HOST_LIB_PATH"
2947+
fi
2948+
done
2949+
done
29492950
fi
29502951
fi
29512952
fi

0 commit comments

Comments
 (0)