termux-packages/packages/swift/swift-utils-build-script-im...

135 lines
7.3 KiB
Diff

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
@@ -1584,6 +1584,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
[[ $(should_execute_action "${host}-${product/_static}-build") ]] || continue
@@ -2022,7 +2034,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"
@@ -2073,8 +2085,10 @@ for host in "${ALL_HOSTS[@]}"; do
"${llbuild_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}
-DCMAKE_Swift_FLAGS:STRING="-module-cache-path \"${module_cache}\""
-DLLBUILD_ENABLE_ASSERTIONS:BOOL=$(true_false "${LLBUILD_ENABLE_ASSERTIONS}")
@@ -2082,7 +2096,7 @@ for host in "${ALL_HOSTS[@]}"; do
-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}"
@@ -2106,7 +2120,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)
@@ -2144,14 +2157,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_Swift_FLAGS:STRING="-module-cache-path \"${module_cache}\""
-DCMAKE_INSTALL_PREFIX:PATH="$(get_host_install_prefix ${host})"
-DCMAKE_INSTALL_LIBDIR:PATH="lib"
@@ -2163,7 +2174,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
@@ -2178,9 +2189,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
@@ -2220,8 +2228,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_Swift_FLAGS:STRING="-module-cache-path \"${module_cache}\""
@@ -2244,8 +2252,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-*)
@@ -2264,8 +2270,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_Swift_FLAGS:STRING="-module-cache-path \"${module_cache}\""