termux-packages/packages/swift/swift-utils-build-script-impl-flags.patch

83 lines
4.6 KiB
Diff
Raw Normal View History

2020-09-07 18:23:03 +02:00
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
2021-07-04 19:15:47 +02:00
@@ -1652,6 +1688,13 @@ for host in "${ALL_HOSTS[@]}"; do
2020-09-07 18:23:03 +02:00
-DLLVM_NATIVE_BUILD=$(build_directory "${LOCAL_HOST}" llvm)
)
2021-01-14 16:12:45 +01:00
cmake_options+=("${SWIFT_TARGET_CMAKE_OPTIONS[@]}")
2020-09-07 18:23:03 +02:00
+ cmake_options+=(
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS --target=$CCTERMUX_HOST_PLATFORM $CPPFLAGS"
+ -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS --target=$CCTERMUX_HOST_PLATFORM"
2021-07-04 19:15:47 +02:00
+ -DCMAKE_FIND_ROOT_PATH:PATH="${CROSS_COMPILE_DEPS_PATH}"
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
2020-09-07 18:23:03 +02:00
+ )
fi
;;
2021-07-04 19:15:47 +02:00
@@ -1854,6 +1854,9 @@ for host in "${ALL_HOSTS[@]}"; do
"${cmake_options[@]}"
-DLLVM_TABLEGEN=$(build_directory "${LOCAL_HOST}" llvm)/bin/llvm-tblgen
2022-02-08 20:48:18 +01:00
-DSWIFT_INCLUDE_TEST_BINARIES:BOOL=FALSE
2021-07-04 19:15:47 +02:00
+ -DCMAKE_FIND_ROOT_PATH:PATH="${CROSS_COMPILE_DEPS_PATH}"
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
)
fi
2020-09-07 18:23:03 +02:00
@@ -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
2021-07-04 19:15:47 +02:00
@@ -2199,6 +2201,9 @@ for host in "${ALL_HOSTS[@]}"; do
# https://cmake.org/cmake/help/latest/command/find_package.html
2020-09-07 18:23:03 +02:00
cmake_options+=(
-DCMAKE_FIND_ROOT_PATH:PATH="${CROSS_COMPILE_DEPS_PATH}"
2021-07-04 19:15:47 +02:00
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
2020-09-07 18:23:03 +02:00
+ -DCMAKE_C_FLAGS="$CFLAGS --target=$CCTERMUX_HOST_PLATFORM $CPPFLAGS"
+ -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS --target=$CCTERMUX_HOST_PLATFORM"
)
fi
2021-01-14 16:12:45 +01:00
if [[ "${host}" == "android-"* ]]; then
@@ -2239,6 +2243,11 @@ for host in "${ALL_HOSTS[@]}"; do
2020-09-07 18:23:03 +02:00
)
if [[ $(is_cross_tools_host ${host}) ]] ; then
2021-01-14 16:12:45 +01:00
cmake_options+=("${SWIFT_TARGET_CMAKE_OPTIONS[@]}")
2020-09-07 18:23:03 +02:00
+ 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
@@ -2929,7 +2999,20 @@ 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"
+ # Remove most libdispatch products before building the package manager.
+ rm -rf @TERMUX_PREFIX@/lib/swift{,_static}/{Block,os}
+ rm @TERMUX_PREFIX@/lib/swift{,_static}/dispatch/*.h
+ 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
+ if [[ -z "${ANDROID_DATA}" ]] ; then
+ mv @TERMUX_PREFIX@/lib/swift/${host/-//}/glibc.modulemap @TERMUX_PREFIX@/glibc-native.modulemap
+ cp $(build_directory ${host} swift)/lib/swift/${host/-//}/glibc.modulemap @TERMUX_PREFIX@/lib/swift/${host/-//}/glibc.modulemap
+ fi
;;
# Products from this here install themselves; they don't fall-through.
lldb)
if [[ -z "${INSTALL_LLDB}" ]] ; then