mirror of
https://github.com/termux/termux-packages.git
synced 2024-12-04 18:45:52 +00:00
145 lines
7.2 KiB
Diff
145 lines
7.2 KiB
Diff
diff --git a/swift/utils/build-script-impl b/swift/utils/build-script-impl
|
|
index b1d060328bc..218c9215260 100755
|
|
--- a/swift/utils/build-script-impl
|
|
+++ b/swift/utils/build-script-impl
|
|
@@ -1726,6 +1726,7 @@
|
|
)
|
|
fi
|
|
|
|
+ cross_c_flags=""
|
|
if [[ ! "${SKIP_BUILD_ANDROID}" ]] ||
|
|
[[ $(is_cross_tools_host ${host}) && "${host}" == "android-"* ]]; then
|
|
cmake_options=(
|
|
@@ -1733,6 +1734,7 @@
|
|
-DSWIFT_ANDROID_DEPLOY_DEVICE_PATH:STRING="${ANDROID_DEPLOY_DEVICE_PATH}"
|
|
-DSWIFT_SDK_ANDROID_ARCHITECTURES:STRING="${ANDROID_ARCH}"
|
|
)
|
|
+ cross_c_flags="$CFLAGS --target=$CCTERMUX_HOST_PLATFORM"
|
|
fi
|
|
|
|
if [[ ! "${SKIP_BUILD_WASM}" ]]; then
|
|
@@ -1785,6 +1788,9 @@
|
|
"${cmake_options[@]}"
|
|
-DLLVM_TABLEGEN=$(build_directory "${LOCAL_HOST}" llvm)/bin/llvm-tblgen
|
|
-DSWIFT_INCLUDE_TEST_BINARIES:BOOL=FALSE
|
|
+ -DCMAKE_FIND_ROOT_PATH:PATH="${CROSS_COMPILE_DEPS_PATH}"
|
|
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
|
|
+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
|
|
)
|
|
fi
|
|
|
|
@@ -1800,6 +1806,13 @@
|
|
native_swift_tools_path="${NATIVE_SWIFT_TOOLS_PATH}"
|
|
fi
|
|
|
|
+ if [[ $(is_cross_tools_host ${host}) && "${host}" != "macosx-"* ]] ; then
|
|
+ cmake_options=(
|
|
+ "${cmake_options[@]}"
|
|
+ -DCMAKE_Swift_COMPILER:PATH="${native_swift_tools_path}/swiftc"
|
|
+ )
|
|
+ fi
|
|
+
|
|
if [ "${BUILD_LLVM}" == "0" ] ; then
|
|
cmake_options=(
|
|
"${cmake_options[@]}"
|
|
@@ -1820,8 +1833,8 @@
|
|
|
|
cmake_options=(
|
|
"${cmake_options[@]}"
|
|
- -DCMAKE_C_FLAGS="$(swift_c_flags ${host})"
|
|
- -DCMAKE_CXX_FLAGS="$(swift_c_flags ${host})"
|
|
+ -DCMAKE_C_FLAGS="$(swift_c_flags ${host}) ${cross_c_flags}"
|
|
+ -DCMAKE_CXX_FLAGS="$(swift_c_flags ${host}) ${cross_c_flags}"
|
|
-DCMAKE_C_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG"
|
|
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG"
|
|
-DCMAKE_BUILD_TYPE:STRING="${SWIFT_BUILD_TYPE}"
|
|
@@ -1878,6 +1891,7 @@
|
|
-DSWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE:PATH="${SWIFT_SYNTAX_SOURCE_DIR}"
|
|
-DSWIFT_ENABLE_BACKTRACING:BOOL=$(true_false "${SWIFT_ENABLE_BACKTRACING}")
|
|
-DSWIFT_STDLIB_OVERRIDABLE_RETAIN_RELEASE:BOOL=$(true_false "${SWIFT_STDLIB_OVERRIDABLE_RETAIN_RELEASE}")
|
|
+ -DSWIFT_CLANG_RESOURCE_DIR_SYMLINK_INSTALL_TARGET:STRING="../clang/latest"
|
|
"${swift_cmake_options[@]}"
|
|
)
|
|
|
|
@@ -2045,6 +2045,8 @@ for host in "${ALL_HOSTS[@]}"; do
|
|
cmake_options+=(
|
|
-DCMAKE_FIND_ROOT_PATH:PATH="${CROSS_COMPILE_DEPS_PATH}"
|
|
-DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
|
|
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS --target=$CCTERMUX_HOST_PLATFORM $CPPFLAGS"
|
|
+ -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS --target=$CCTERMUX_HOST_PLATFORM"
|
|
)
|
|
fi
|
|
|
|
@@ -2388,7 +2404,8 @@
|
|
-DENABLE_TESTING=YES
|
|
)
|
|
if [[ $(is_cross_tools_host ${host}) ]] ; then
|
|
- cmake_options+=("${SWIFT_TARGET_CMAKE_OPTIONS[@]}")
|
|
+ cmake_options+=("${SWIFT_TARGET_CMAKE_OPTIONS[@]}"
|
|
+ -DCMAKE_C_FLAGS="$CFLAGS --target=$CCTERMUX_HOST_PLATFORM $CPPFLAGS")
|
|
fi
|
|
;;
|
|
esac
|
|
@@ -2412,7 +2412,7 @@ for host in "${ALL_HOSTS[@]}"; do
|
|
|
|
;;
|
|
foundation_macros)
|
|
- if [[ ${host} == "macosx"* ]]; then
|
|
+ if [[ ${host} == "macosx"* ]] || [[ "${host}" == "android-"* ]]; then
|
|
echo "Skipping Foundation Macros on OS X -- Foundation is part of the OS on this platform"
|
|
continue
|
|
fi
|
|
@@ -2537,11 +2554,15 @@
|
|
# https://cmake.org/cmake/help/latest/command/find_package.html
|
|
cmake_options+=(
|
|
-DCMAKE_FIND_ROOT_PATH:PATH="${CROSS_COMPILE_DEPS_PATH}"
|
|
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
|
|
+ -DCMAKE_C_FLAGS="$CFLAGS --target=$CCTERMUX_HOST_PLATFORM $CPPFLAGS"
|
|
+ -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS --target=$CCTERMUX_HOST_PLATFORM"
|
|
)
|
|
fi
|
|
if [[ "${host}" == "android-"* ]]; then
|
|
cmake_options+=(
|
|
-DCMAKE_HAVE_LIBC_PTHREAD=True
|
|
+ -DSwiftFoundation_MODULE_TRIPLE:STRING="${ANDROID_ARCH}-unknown-linux-android"
|
|
)
|
|
fi
|
|
;;
|
|
@@ -2583,6 +2603,11 @@
|
|
)
|
|
if [[ $(is_cross_tools_host ${host}) ]] ; then
|
|
cmake_options+=("${SWIFT_TARGET_CMAKE_OPTIONS[@]}")
|
|
+ cmake_options+=(
|
|
+ -DCMAKE_C_FLAGS="$CFLAGS --target=$CCTERMUX_HOST_PLATFORM $CPPFLAGS"
|
|
+ -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS --target=$CCTERMUX_HOST_PLATFORM"
|
|
+ -DCMAKE_SHARED_LINKER_FLAGS="$LDFLAGS --target=$CCTERMUX_HOST_PLATFORM"
|
|
+ )
|
|
fi
|
|
;;
|
|
esac
|
|
@@ -3106,7 +3131,14 @@ for host in "${ALL_HOSTS[@]}"; do
|
|
if [[ -z "${INSTALL_LLBUILD}" ]] ; then
|
|
continue
|
|
fi
|
|
- INSTALL_TARGETS="install-swift-build-tool install-libllbuildSwift"
|
|
+ INSTALL_TARGETS="install-libllbuildSwift"
|
|
+ # Use the system libdispatch headers instead.
|
|
+ sed -i -e "s%dispatch\.h%@TERMUX_PREFIX@/include/dispatch/dispatch.h%" \
|
|
+ -e "s%introspection\.h%@TERMUX_PREFIX@/include/dispatch/introspection.h%" \
|
|
+ @TERMUX_PREFIX@/lib/swift/dispatch/module.modulemap
|
|
+ sed -i -e "s%dispatch\.h%@TERMUX_PREFIX@/include/dispatch/dispatch.h%" \
|
|
+ -e "s%introspection\.h%@TERMUX_PREFIX@/include/dispatch/introspection.h%" \
|
|
+ @TERMUX_PREFIX@/lib/swift_static/dispatch/module.modulemap
|
|
;;
|
|
# Products from this here install themselves; they don't fall-through.
|
|
lldb)
|
|
@@ -3131,7 +3163,7 @@ for host in "${ALL_HOSTS[@]}"; do
|
|
;;
|
|
foundation|foundation_static|foundation_macros)
|
|
# FIXME: Foundation doesn't build from the script on OS X
|
|
- if [[ ${host} == "macosx"* ]]; then
|
|
+ if [[ ${host} == "macosx"* ]] || [[ "${host}" == "android-"* && "${product}" == "foundation_macros" ]]; then
|
|
echo "Skipping Foundation on OS X -- Foundation does not build for this platform"
|
|
continue
|
|
fi
|