@@ -1041,10 +1041,14 @@ if [[ ! "${SKIP_BUILD_PLAYGROUNDSUPPORT}" && ! -d ${PLAYGROUNDSUPPORT_SOURCE_DIR
10411041 exit 1
10421042fi
10431043
1044- PRODUCTS=(cmark llvm)
1044+ # We cannot currently apply the normal rules of skipping here for LLVM. Even if
1045+ # we are skipping building LLVM, we still need to at least build several tools
1046+ # that swift relies on for building and testing. See the LLVM configure rules.
1047+ PRODUCTS=(llvm)
1048+ [[ " ${SKIP_BUILD_CMARK} " ]] || PRODUCTS+=(cmark)
10451049[[ " ${SKIP_BUILD_LIBCXX} " ]] || PRODUCTS+=(libcxx)
10461050[[ " ${SKIP_BUILD_LIBICU} " ]] || PRODUCTS+=(libicu)
1047- PRODUCTS+=(swift)
1051+ [[ " ${SKIP_BUILD_SWIFT} " ]] || PRODUCTS+=(swift)
10481052[[ " ${SKIP_BUILD_LLDB} " ]] || PRODUCTS+=(lldb)
10491053[[ " ${SKIP_BUILD_LIBDISPATCH} " ]] || PRODUCTS+=(libdispatch)
10501054[[ " ${SKIP_BUILD_STATIC_LIBDISPATCH} " ]] || PRODUCTS+=(libdispatch_static)
@@ -1436,7 +1440,6 @@ for host in "${ALL_HOSTS[@]}"; do
14361440 -DCMAKE_BUILD_TYPE:STRING=" ${CMARK_BUILD_TYPE} "
14371441 " ${cmark_cmake_options[@]} "
14381442 )
1439- skip_build=${SKIP_BUILD_CMARK}
14401443 build_targets=(all)
14411444 ;;
14421445
@@ -1749,7 +1752,6 @@ for host in "${ALL_HOSTS[@]}"; do
17491752 build_targets=(" ${build_targets[@]} "
17501753 " ${SWIFT_BENCHMARK_TARGETS[@]} " )
17511754 fi
1752- skip_build=${SKIP_BUILD_SWIFT}
17531755 ;;
17541756 lldb)
17551757 if [ ! -d " ${LLDB_SOURCE_DIR} " ]; then
@@ -2216,48 +2218,46 @@ for host in "${ALL_HOSTS[@]}"; do
22162218 fi
22172219
22182220 # Build.
2219- if [[ ! " ${skip_build} " ]]; then
2220- if [[ " ${CMAKE_GENERATOR} " == " Xcode" ]] ; then
2221- # Xcode generator uses "ALL_BUILD" instead of "all".
2222- # Also, xcodebuild uses -target instead of bare names.
2223- build_targets=(" ${build_targets[@]/ all/ ALL_BUILD} " )
2224- build_targets=(" ${build_targets[@]/#/ ${BUILD_TARGET_FLAG} } " )
2225-
2226- # Xcode can't restart itself if it turns out we need to reconfigure.
2227- # Do an advance build to handle that.
2228- call " ${CMAKE_BUILD[@]} " " ${build_dir} " $( cmake_config_opt ${product} )
2229- fi
2221+ if [[ " ${CMAKE_GENERATOR} " == " Xcode" ]] ; then
2222+ # Xcode generator uses "ALL_BUILD" instead of "all".
2223+ # Also, xcodebuild uses -target instead of bare names.
2224+ build_targets=(" ${build_targets[@]/ all/ ALL_BUILD} " )
2225+ build_targets=(" ${build_targets[@]/#/ ${BUILD_TARGET_FLAG} } " )
2226+
2227+ # Xcode can't restart itself if it turns out we need to reconfigure.
2228+ # Do an advance build to handle that.
2229+ call " ${CMAKE_BUILD[@]} " " ${build_dir} " $( cmake_config_opt ${product} )
2230+ fi
22302231
2231- call " ${CMAKE_BUILD[@]} " " ${build_dir} " $( cmake_config_opt ${product} ) -- " ${BUILD_ARGS[@]} " ${build_targets[@]}
2232-
2233- # When we are building LLVM copy over the compiler-rt
2234- # builtins for iOS/tvOS/watchOS to ensure that Swift's
2235- # stdlib can use compiler-rt builtins when targetting iOS/tvOS/watchOS.
2236- if [[ " ${product} " = " llvm" ]] && [[ " ${BUILD_LLVM} " = " 1" ]] && [[ " $( uname -s) " = " Darwin" ]]; then
2237- HOST_CXX_DIR=$( dirname " ${HOST_CXX} " )
2238- HOST_LIB_CLANG_DIR=" ${HOST_CXX_DIR} /../lib/clang"
2239- DEST_LIB_CLANG_DIR=" $( build_directory_bin ${host} llvm) /../lib/clang"
2240-
2241- if [[ -d " ${HOST_LIB_CLANG_DIR} " ]] && [[ -d " ${DEST_LIB_CLANG_DIR} " ]]; then
2242- DEST_CXX_BUILTINS_VERSION=$( ls " ${DEST_LIB_CLANG_DIR} " | awk ' {print $0}' )
2243- DEST_BUILTINS_DIR=" $( build_directory_bin ${host} llvm) /../lib/clang/$DEST_CXX_BUILTINS_VERSION /lib/darwin"
2244-
2245- if [[ -d " ${DEST_BUILTINS_DIR} " ]]; then
2246- for HOST_CXX_BUILTINS_PATH in " ${HOST_LIB_CLANG_DIR} " /* ; do
2247- HOST_CXX_BUILTINS_DIR=" ${HOST_CXX_BUILTINS_PATH} /lib/darwin"
2248- echo " copying compiler-rt embedded builtins from ${HOST_CXX_BUILTINS_DIR} into the local clang build directory ${DEST_BUILTINS_DIR} ."
2249-
2250- for OS in ios watchos tvos; do
2251- LIB_NAME=" libclang_rt.$OS .a"
2252- HOST_LIB_PATH=" $HOST_CXX_BUILTINS_DIR /$LIB_NAME "
2253- if [[ -f " ${HOST_LIB_PATH} " ]]; then
2254- call cp " ${HOST_LIB_PATH} " " ${DEST_BUILTINS_DIR} /${LIB_NAME} "
2255- elif [[ " ${VERBOSE_BUILD} " ]]; then
2256- echo " no file exists at ${HOST_LIB_PATH} "
2257- fi
2258- done
2232+ call " ${CMAKE_BUILD[@]} " " ${build_dir} " $( cmake_config_opt ${product} ) -- " ${BUILD_ARGS[@]} " ${build_targets[@]}
2233+
2234+ # When we are building LLVM copy over the compiler-rt
2235+ # builtins for iOS/tvOS/watchOS to ensure that Swift's
2236+ # stdlib can use compiler-rt builtins when targetting iOS/tvOS/watchOS.
2237+ if [[ " ${product} " = " llvm" ]] && [[ " ${BUILD_LLVM} " = " 1" ]] && [[ " $( uname -s) " = " Darwin" ]]; then
2238+ HOST_CXX_DIR=$( dirname " ${HOST_CXX} " )
2239+ HOST_LIB_CLANG_DIR=" ${HOST_CXX_DIR} /../lib/clang"
2240+ DEST_LIB_CLANG_DIR=" $( build_directory_bin ${host} llvm) /../lib/clang"
2241+
2242+ if [[ -d " ${HOST_LIB_CLANG_DIR} " ]] && [[ -d " ${DEST_LIB_CLANG_DIR} " ]]; then
2243+ DEST_CXX_BUILTINS_VERSION=$( ls " ${DEST_LIB_CLANG_DIR} " | awk ' {print $0}' )
2244+ DEST_BUILTINS_DIR=" $( build_directory_bin ${host} llvm) /../lib/clang/$DEST_CXX_BUILTINS_VERSION /lib/darwin"
2245+
2246+ if [[ -d " ${DEST_BUILTINS_DIR} " ]]; then
2247+ for HOST_CXX_BUILTINS_PATH in " ${HOST_LIB_CLANG_DIR} " /* ; do
2248+ HOST_CXX_BUILTINS_DIR=" ${HOST_CXX_BUILTINS_PATH} /lib/darwin"
2249+ echo " copying compiler-rt embedded builtins from ${HOST_CXX_BUILTINS_DIR} into the local clang build directory ${DEST_BUILTINS_DIR} ."
2250+
2251+ for OS in ios watchos tvos; do
2252+ LIB_NAME=" libclang_rt.$OS .a"
2253+ HOST_LIB_PATH=" $HOST_CXX_BUILTINS_DIR /$LIB_NAME "
2254+ if [[ -f " ${HOST_LIB_PATH} " ]]; then
2255+ call cp " ${HOST_LIB_PATH} " " ${DEST_BUILTINS_DIR} /${LIB_NAME} "
2256+ elif [[ " ${VERBOSE_BUILD} " ]]; then
2257+ echo " no file exists at ${HOST_LIB_PATH} "
2258+ fi
22592259 done
2260- fi
2260+ done
22612261 fi
22622262 fi
22632263 fi
0 commit comments