Skip to content

Commit f2b43e4

Browse files
authored
Merge pull request #27575 from mikeash/compiler-retweet-nonexistent-ls
2 parents f2229c4 + e40a6fd commit f2b43e4

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

utils/build-script-impl

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2927,24 +2927,27 @@ for host in "${ALL_HOSTS[@]}"; do
29272927
# When we are building LLVM copy over the compiler-rt
29282928
# builtins for iOS/tvOS/watchOS to ensure that Swift's
29292929
# stdlib can use compiler-rt builtins when targetting iOS/tvOS/watchOS.
2930-
if [[ "${product}" == "llvm" && "${BUILD_LLVM}" == "1" ]]; then
2931-
if [[ "$(uname -s)" == "Darwin" ]] ; then
2932-
HOST_CXX_DIR=$(dirname "${HOST_CXX}")
2933-
DEST_CXX_BUILTINS_VERSION=$(ls "$(build_directory_bin ${host} llvm)/../lib/clang" | awk '{print $0}')
2930+
if [[ "${product}" = "llvm" ]] && [[ "${BUILD_LLVM}" = "1" ]] && [[ "$(uname -s)" = "Darwin" ]]; then
2931+
HOST_CXX_DIR=$(dirname "${HOST_CXX}")
2932+
HOST_LIB_CLANG_DIR="${HOST_CXX_DIR}/../lib/clang"
2933+
DEST_LIB_CLANG_DIR="$(build_directory_bin ${host} llvm)/../lib/clang"
2934+
2935+
if [[ -d "${HOST_LIB_CLANG_DIR}" ]] && [[ -d "${DEST_LIB_CLANG_DIR}" ]]; then
2936+
DEST_CXX_BUILTINS_VERSION=$(ls "${DEST_LIB_CLANG_DIR}" | awk '{print $0}')
29342937
DEST_BUILTINS_DIR="$(build_directory_bin ${host} llvm)/../lib/clang/$DEST_CXX_BUILTINS_VERSION/lib/darwin"
29352938

2936-
if [ -d "$DEST_BUILTINS_DIR" ]; then
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."
2939+
if [[ -d "${DEST_BUILTINS_DIR}" ]]; then
2940+
for HOST_CXX_BUILTINS_PATH in "${HOST_LIB_CLANG_DIR}"/*; do
2941+
HOST_CXX_BUILTINS_DIR="${HOST_CXX_BUILTINS_PATH}/lib/darwin"
2942+
echo "copying compiler-rt embedded builtins from ${HOST_CXX_BUILTINS_DIR} into the local clang build directory ${DEST_BUILTINS_DIR}."
29402943

29412944
for OS in ios watchos tvos; do
29422945
LIB_NAME="libclang_rt.$OS.a"
29432946
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"
2947+
if [[ -f "${HOST_LIB_PATH}" ]]; then
2948+
call cp "${HOST_LIB_PATH}" "${DEST_BUILTINS_DIR}/${LIB_NAME}"
29462949
elif [[ "${VERBOSE_BUILD}" ]]; then
2947-
echo "no file exists at $HOST_LIB_PATH"
2950+
echo "no file exists at ${HOST_LIB_PATH}"
29482951
fi
29492952
done
29502953
done

0 commit comments

Comments
 (0)