commit 32d341e244d4a56185ed04c60542250b5b5047e9 Date: Thu Jul 16 17:23:18 2020 +0530 [build] extend support for building with a prebuilt toolchain to the corelibs and llbuild diff --git a/swift/utils/build-script-impl b/swift/utils/build-script-impl index 7f39ff97459..af310ec8cbf 100755 --- a/swift/utils/build-script-impl +++ b/swift/utils/build-script-impl @@ -1604,6 +1604,18 @@ for host in "${ALL_HOSTS[@]}"; do ) fi + if [[ "${NATIVE_CLANG_TOOLS_PATH}" ]] ; then + CLANG_BIN="${NATIVE_CLANG_TOOLS_PATH}" + else + CLANG_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)" + fi + + if [[ "${NATIVE_SWIFT_TOOLS_PATH}" ]] ; then + SWIFTC_BIN="${NATIVE_SWIFT_TOOLS_PATH}/swiftc" + else + SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc" + fi + for product in "${PRODUCTS[@]}"; do # Check if we should perform this action. tmp_product=${product} @@ -2066,7 +2078,7 @@ for host in "${ALL_HOSTS[@]}"; do -DCMAKE_C_FLAGS="$(llvm_c_flags ${host})" -DCMAKE_CXX_FLAGS="$(llvm_c_flags ${host})" -DCMAKE_BUILD_TYPE:STRING="${LLDB_BUILD_TYPE}" - -DLLDB_SWIFTC:PATH="$(build_directory ${LOCAL_HOST} swift)/bin/swiftc" + -DLLDB_SWIFTC:PATH=${SWIFTC_BIN} -DLLDB_SWIFT_LIBS:PATH="$(build_directory ${LOCAL_HOST} swift)/lib/swift" -DCMAKE_INSTALL_PREFIX:PATH="$(get_host_install_prefix ${host})" -DLLDB_FRAMEWORK_INSTALL_DIR="$(get_host_install_prefix ${host})../System/Library/PrivateFrameworks" @@ -2100,15 +2112,17 @@ for host in "${ALL_HOSTS[@]}"; do "${cmake_options[@]}" -DCMAKE_BUILD_TYPE:STRING="${LLBUILD_BUILD_TYPE}" + -DCMAKE_C_COMPILER:PATH="${CLANG_BIN}/clang" + -DCMAKE_CXX_COMPILER:PATH="${CLANG_BIN}/clang++" -DCMAKE_INSTALL_PREFIX:PATH="$(get_host_install_prefix ${host})" - -DCMAKE_Swift_COMPILER:PATH="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc" + -DCMAKE_Swift_COMPILER:PATH=${SWIFTC_BIN} -DLLBUILD_ENABLE_ASSERTIONS:BOOL=$(true_false "${LLBUILD_ENABLE_ASSERTIONS}") -DLLBUILD_SUPPORT_BINDINGS:=Swift -DLIT_EXECUTABLE:PATH="${LLVM_SOURCE_DIR}/utils/lit/lit.py" -DFILECHECK_EXECUTABLE:PATH="$(build_directory_bin ${LOCAL_HOST} llvm)/FileCheck" - -DSWIFTC_EXECUTABLE:PATH="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc" + -DSWIFTC_EXECUTABLE:PATH=${SWIFTC_BIN} -DFOUNDATION_BUILD_DIR:PATH="$(build_directory ${host} foundation)" -DLIBDISPATCH_BUILD_DIR:PATH="$(build_directory ${host} libdispatch)" -DLIBDISPATCH_SOURCE_DIR:PATH="${LIBDISPATCH_SOURCE_DIR}" @@ -2132,7 +2146,6 @@ for host in "${ALL_HOSTS[@]}"; do fi ;; xctest) - SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc" XCTEST_BUILD_DIR=$(build_directory ${host} xctest) FOUNDATION_BUILD_DIR=$(build_directory ${host} foundation) SWIFT_BUILD_DIR=$(build_directory ${host} swift) @@ -2170,14 +2183,12 @@ for host in "${ALL_HOSTS[@]}"; do echo "Cleaning the XCTest build directory" call rm -rf "${XCTEST_BUILD_DIR}" - LLVM_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)" - cmake_options=( ${cmake_options[@]} -DCMAKE_BUILD_TYPE:STRING="${XCTEST_BUILD_TYPE}" - -DCMAKE_C_COMPILER:PATH="${LLVM_BIN}/clang" - -DCMAKE_CXX_COMPILER:PATH="${LLVM_BIN}/clang++" - -DCMAKE_Swift_COMPILER:PATH="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc" + -DCMAKE_C_COMPILER:PATH="${CLANG_BIN}/clang" + -DCMAKE_CXX_COMPILER:PATH="${CLANG_BIN}/clang++" + -DCMAKE_Swift_COMPILER:PATH=${SWIFTC_BIN} -DCMAKE_INSTALL_PREFIX:PATH="$(get_host_install_prefix ${host})" -DCMAKE_INSTALL_LIBDIR:PATH="lib" @@ -2188,7 +2199,7 @@ for host in "${ALL_HOSTS[@]}"; do -DXCTEST_PATH_TO_LIBDISPATCH_SOURCE:PATH=${LIBDISPATCH_SOURCE_DIR} -DXCTEST_PATH_TO_LIBDISPATCH_BUILD:PATH=$(build_directory ${host} libdispatch) -DXCTEST_PATH_TO_FOUNDATION_BUILD:PATH=${FOUNDATION_BUILD_DIR} - -DCMAKE_SWIFT_COMPILER:PATH="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc" + -DCMAKE_SWIFT_COMPILER:PATH=${SWIFTC_BIN} -DCMAKE_PREFIX_PATH:PATH=$(build_directory ${host} llvm) -DENABLE_TESTING=YES @@ -2203,9 +2214,6 @@ for host in "${ALL_HOSTS[@]}"; do # is not yet built at this point. XCTEST_BUILD_DIR=$(build_directory ${host} xctest) - SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc" - LLVM_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)" - if [[ ${host} == "macosx"* ]]; then echo "Skipping Foundation on OS X -- use the Xcode project instead" continue @@ -2257,8 +2265,8 @@ for host in "${ALL_HOSTS[@]}"; do cmake_options=( ${cmake_options[@]} -DCMAKE_BUILD_TYPE:STRING=${FOUNDATION_BUILD_TYPE} - -DCMAKE_C_COMPILER:PATH=${LLVM_BIN}/clang - -DCMAKE_CXX_COMPILER:PATH=${LLVM_BIN}/clang++ + -DCMAKE_C_COMPILER:PATH=${CLANG_BIN}/clang + -DCMAKE_CXX_COMPILER:PATH=${CLANG_BIN}/clang++ -DCMAKE_SWIFT_COMPILER:PATH=${SWIFTC_BIN} -DCMAKE_Swift_COMPILER:PATH=${SWIFTC_BIN} -DCMAKE_INSTALL_PREFIX:PATH=$(get_host_install_prefix ${host}) @@ -2277,8 +2285,6 @@ for host in "${ALL_HOSTS[@]}"; do libdispatch|libdispatch_static) LIBDISPATCH_BUILD_DIR=$(build_directory ${host} ${product}) SWIFT_BUILD_PATH="$(build_directory ${host} swift)" - SWIFTC_BIN="$(build_directory_bin ${LOCAL_HOST} swift)/swiftc" - LLVM_BIN="$(build_directory_bin ${LOCAL_HOST} llvm)" case "${host}" in macosx-*) @@ -2297,8 +2303,8 @@ for host in "${ALL_HOSTS[@]}"; do -DENABLE_SWIFT=YES ${cmake_options[@]} -DCMAKE_BUILD_TYPE:STRING="${LIBDISPATCH_BUILD_TYPE}" - -DCMAKE_C_COMPILER:PATH="${LLVM_BIN}/clang" - -DCMAKE_CXX_COMPILER:PATH="${LLVM_BIN}/clang++" + -DCMAKE_C_COMPILER:PATH="${CLANG_BIN}/clang" + -DCMAKE_CXX_COMPILER:PATH="${CLANG_BIN}/clang++" -DCMAKE_SWIFT_COMPILER:PATH="${SWIFTC_BIN}" -DCMAKE_Swift_COMPILER:PATH="${SWIFTC_BIN}" -DCMAKE_INSTALL_PREFIX:PATH="$(get_host_install_prefix ${host})"