bump(swift): 5.7.3 to 5.8 and spin off runtime and sdk subpackages
Make it so that SDKs for other architectures can be easily installed and used for cross-compilation.
This commit is contained in:
parent
085b237ebe
commit
e93c1bb648
|
@ -2,12 +2,12 @@ TERMUX_PKG_HOMEPAGE=https://swift.org/
|
|||
TERMUX_PKG_DESCRIPTION="Swift is a high-performance system programming language"
|
||||
TERMUX_PKG_LICENSE="Apache-2.0, NCSA"
|
||||
TERMUX_PKG_MAINTAINER="@buttaface"
|
||||
TERMUX_PKG_VERSION=5.7.3
|
||||
TERMUX_PKG_VERSION=5.8
|
||||
SWIFT_RELEASE="RELEASE"
|
||||
TERMUX_PKG_SRCURL=https://github.com/apple/swift/archive/swift-$TERMUX_PKG_VERSION-$SWIFT_RELEASE.tar.gz
|
||||
TERMUX_PKG_SHA256=8cda906403c12c5bf6ba4afea14fd494b6f08354e3e43be521f52e5cc5709eb8
|
||||
TERMUX_PKG_SHA256=16c68b4c4872651d4fc7e361df7731b7cc2592b293473d41bd331cd1a1fc3887
|
||||
TERMUX_PKG_HOSTBUILD=true
|
||||
TERMUX_PKG_DEPENDS="clang, libandroid-glob, libandroid-posix-semaphore, libandroid-spawn, libcurl, libicu, libicu-static, libsqlite, libuuid, libxml2, libdispatch, llbuild"
|
||||
TERMUX_PKG_DEPENDS="clang, libandroid-glob, libandroid-posix-semaphore, libandroid-spawn, libcurl, libicu, libicu-static, libsqlite, libuuid, libxml2, libdispatch, llbuild, swift-sdk-${TERMUX_ARCH/_/-}"
|
||||
TERMUX_PKG_BUILD_DEPENDS="rsync"
|
||||
TERMUX_PKG_BLACKLISTED_ARCHES="i686"
|
||||
TERMUX_PKG_NO_STATICSPLIT=true
|
||||
|
@ -18,7 +18,7 @@ TERMUX_PKG_NO_STATICSPLIT=true
|
|||
TERMUX_PKG_FORCE_CMAKE=true
|
||||
TERMUX_CMAKE_BUILD=Ninja
|
||||
|
||||
SWIFT_COMPONENTS="autolink-driver;compiler;clang-resource-dir-symlink;swift-remote-mirror;parser-lib;license;sourcekit-inproc;stdlib;sdk-overlay"
|
||||
SWIFT_COMPONENTS="autolink-driver;compiler;clang-resource-dir-symlink;swift-remote-mirror;license;sourcekit-inproc;static-mirror-lib;stdlib;sdk-overlay"
|
||||
SWIFT_TOOLCHAIN_FLAGS="-RA --llvm-targets-to-build='X86;ARM;AArch64' -j $TERMUX_MAKE_PROCESSES"
|
||||
SWIFT_PATH_FLAGS="--build-subdir=. --install-destdir=/ --install-prefix=$TERMUX_PREFIX"
|
||||
SWIFT_BUILD_FLAGS="$SWIFT_TOOLCHAIN_FLAGS $SWIFT_PATH_FLAGS"
|
||||
|
@ -34,23 +34,24 @@ termux_step_post_get_source() {
|
|||
mv .temp swift
|
||||
|
||||
declare -A library_checksums
|
||||
library_checksums[swift-cmark]=143a58286e611460ba5ffe3d53d8be5bfbe655f9eba4571201537bb417547b63
|
||||
library_checksums[llvm-project]=003e933dcfe8251ab0d809aba36d8f38d3cafa5946df2e0f0713962d9e5ebd62
|
||||
library_checksums[swift-experimental-string-processing]=86f5e1c9336fc4fc7529554418bff760aaafc8397dc29c4e56a5b1334dcdffba
|
||||
library_checksums[swift-corelibs-libdispatch]=4c6b7b0ecdf10e9cbe1cd007b9a09689ea412edb8e3a289ade6d105df43209f5
|
||||
library_checksums[swift-corelibs-foundation]=78852bcfcf703957953761cbd18a2398c31b25f26ddf3ac18983b959e1564f3d
|
||||
library_checksums[swift-corelibs-xctest]=4f152a62522008c09948202cd94d1d25c42b68ef5c8eb21abaa9855ea3e5a47f
|
||||
library_checksums[swift-llbuild]=bf1f1ca43d4f658813382ddb144d11f2ccd79ab7b10b31fde673087587310909
|
||||
library_checksums[swift-cmark]=e3de63c4a6672e13e7b7aa80dcbe2361fbac507851440a0ac61e20f1cb470119
|
||||
library_checksums[llvm-project]=8435ea5e39d34c74b1a2600376eff4b217f9933830e23d6cf67521513fce7706
|
||||
library_checksums[swift-experimental-string-processing]=ff4507448e31a011d51b3143ef1ba9e8694886dab4cd89ca202f42b79d1c9e0c
|
||||
library_checksums[swift-syntax]=24ed18b53c4339caff746be184c16d75bd394ed10c9cebddfa776c83a47b5d9b
|
||||
library_checksums[swift-corelibs-libdispatch]=391d2bcaea22c4aa980400c3a29b3d9991641aa62253b693c0b79c302eafd5a0
|
||||
library_checksums[swift-corelibs-foundation]=ff7e5903c80364a1531ab4af7e6fe861998a069e425d6a842fa6ca0236504a9c
|
||||
library_checksums[swift-corelibs-xctest]=b5a007afd43d702d31a1bfc165e3ded0142b0526a56b1a532351b8d751b2499f
|
||||
library_checksums[swift-llbuild]=6345ae69ac9b8bb61b61f14871b322f83b1d08f70c261bd9a2f86a998c394c0c
|
||||
library_checksums[swift-argument-parser]=a4d4c08cf280615fe6e00752ef60e28e76f07c25eb4706a9269bf38135cd9c3f
|
||||
library_checksums[Yams]=b31b6df500d6191368c93f605690ca9857fff7c6fd1c8897e9765fb624535c63
|
||||
library_checksums[Yams]=ec1ad699c30f0db45520006c63a88cc1c946a7d7b36dff32a96460388c0a4af2
|
||||
library_checksums[swift-collections]=575cf0f88d9068411f9acc6e3ca5d542bef1cc9e87dc5d69f7b5a1d5aec8c6b6
|
||||
library_checksums[swift-crypto]=86d6c22c9f89394fd579e967b0d5d0b6ce33cdbf52ba70f82fa313baf70c759f
|
||||
library_checksums[swift-crypto]=84cec042505e1c5bf3dd14a1bb18d0c06c5a9435b7b10a69709101b602285ff5
|
||||
library_checksums[swift-system]=865b8c380455eef27e73109835142920c60ae4c4f4178a3d12ad04acc83f1371
|
||||
library_checksums[swift-driver]=4a730616abd89191dfbebae888bc9c2436447868b69b2d4dcb7dbb2111ad2863
|
||||
library_checksums[swift-tools-support-core]=a0c54390f93642ee5df61bc65274c8c6a11e35177fb20188c1d9b710d69ef319
|
||||
library_checksums[swift-package-manager]=01ed764386cbac24c07497b192261746ddc961ce876f5f94bdcebccc1322105c
|
||||
library_checksums[indexstore-db]=210eff2343c4b122fd8622af7f0ad19cca41838dac66db8b5a35d477eaae79a0
|
||||
library_checksums[sourcekit-lsp]=cabcc7b5b839fff159210a04303660646ba2d1f51c9cf288c3a6df3373cbcd96
|
||||
library_checksums[swift-driver]=1ae19fe5c953df382d174ef4f99b3c7511d32a0037cb043ebd5f681c3d2504dd
|
||||
library_checksums[swift-tools-support-core]=6651c7f798f291386ac2d9e4be35cf25b26db4669d2ef3ad215ff3631f8850d6
|
||||
library_checksums[swift-package-manager]=2cc1b39452e5b615170d5d9ba4fdef81e8e644124af11e3affb8e385c2219f32
|
||||
library_checksums[indexstore-db]=f02a8646ce03cd89cc3db18ee460a1395c1f2285ee656e15c8c24c21f14eca31
|
||||
library_checksums[sourcekit-lsp]=cb74c4212e2387a5e8d8fba0ba96dad79191294275366e6c8b2cce9c07d9ea61
|
||||
|
||||
for library in "${!library_checksums[@]}"; do \
|
||||
GH_ORG="apple"
|
||||
|
@ -61,14 +62,14 @@ termux_step_post_get_source() {
|
|||
SRC_VERSION="1.0.1"
|
||||
TAR_NAME=$SRC_VERSION
|
||||
elif [ "$library" = "swift-crypto" ]; then
|
||||
SRC_VERSION="1.1.5"
|
||||
SRC_VERSION="2.2.3"
|
||||
TAR_NAME=$SRC_VERSION
|
||||
elif [ "$library" = "swift-system" ]; then
|
||||
SRC_VERSION="1.1.1"
|
||||
TAR_NAME=$SRC_VERSION
|
||||
elif [ "$library" = "Yams" ]; then
|
||||
GH_ORG="jpsim"
|
||||
SRC_VERSION="5.0.0"
|
||||
SRC_VERSION="5.0.1"
|
||||
TAR_NAME=$SRC_VERSION
|
||||
else
|
||||
SRC_VERSION=$SWIFT_RELEASE
|
||||
|
@ -109,7 +110,7 @@ termux_step_host_build() {
|
|||
SWIFT_BUILD_ROOT=$TERMUX_PKG_HOSTBUILD_DIR $TERMUX_PKG_SRCDIR/swift/utils/build-script \
|
||||
-R --no-assertions -j $TERMUX_MAKE_PROCESSES $SWIFT_PATH_FLAGS \
|
||||
--skip-build-cmark --skip-build-llvm --skip-build-swift --skip-early-swift-driver \
|
||||
--build-toolchain-only --host-cc=$CLANG --host-cxx=$CLANGXX
|
||||
--skip-early-swiftsyntax --build-toolchain-only --host-cc=$CLANG --host-cxx=$CLANGXX
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -121,8 +122,7 @@ termux_step_make() {
|
|||
termux_setup_swift
|
||||
ln -sf $TERMUX_PKG_HOSTBUILD_DIR/llvm-linux-x86_64 $TERMUX_PKG_BUILDDIR/llvm-linux-x86_64
|
||||
|
||||
BOOTSTRAP=
|
||||
test $SWIFT_ARCH == 'armv7' && BOOTSTRAP='--bootstrapping=off'
|
||||
BOOTSTRAP='--bootstrapping=off'
|
||||
|
||||
SWIFT_BUILD_FLAGS="$SWIFT_BUILD_FLAGS --android
|
||||
--android-ndk $TERMUX_STANDALONE_TOOLCHAIN --android-arch $SWIFT_ARCH
|
||||
|
@ -136,7 +136,7 @@ termux_step_make() {
|
|||
|
||||
SWIFT_BUILD_ROOT=$TERMUX_PKG_BUILDDIR $TERMUX_PKG_SRCDIR/swift/utils/build-script \
|
||||
$SWIFT_BUILD_FLAGS --xctest -b -p --swift-driver --sourcekit-lsp \
|
||||
--android-api-level $TERMUX_PKG_API_LEVEL \
|
||||
--android-api-level $TERMUX_PKG_API_LEVEL --skip-early-swiftsyntax \
|
||||
--build-swift-static-stdlib --swift-install-components=$SWIFT_COMPONENTS \
|
||||
--llvm-install-components=IndexStore --install-llvm --install-swift \
|
||||
--install-libdispatch --install-foundation --install-xctest --install-llbuild \
|
||||
|
@ -146,6 +146,9 @@ termux_step_make() {
|
|||
termux_step_make_install() {
|
||||
rm $TERMUX_PREFIX/lib/swift/pm/llbuild/libllbuild.so
|
||||
rm $TERMUX_PREFIX/lib/swift/android/lib{dispatch,BlocksRuntime}.so
|
||||
mv $TERMUX_PREFIX/lib/swift/android/lib[^_]*.so $TERMUX_PREFIX/opt/ndk-multilib/$TERMUX_ARCH-linux-android*/lib
|
||||
mv $TERMUX_PREFIX/lib/swift/android/lib*.a $TERMUX_PREFIX/lib/swift/android/$SWIFT_ARCH
|
||||
mv $TERMUX_PREFIX/lib/swift_static/android/lib*.a $TERMUX_PREFIX/lib/swift_static/android/$SWIFT_ARCH
|
||||
|
||||
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then
|
||||
rm $TERMUX_PREFIX/swiftpm-android-$SWIFT_ARCH.json
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
diff --git a/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp b/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
index 0836903a0..e556e56fd 100644
|
||||
--- a/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
+++ b/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
@@ -162,8 +162,8 @@
|
||||
@@ -162,8 +162,8 @@ static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args) {
|
||||
// FIXME: This is a bit of a hack. We should really unify this code for
|
||||
// reasoning about oslibdir spellings with the lib dir spellings in the
|
||||
// GCCInstallationDetector, but that is a more significant refactoring.
|
||||
|
@ -11,27 +13,27 @@
|
|||
return "lib32";
|
||||
|
||||
if (Triple.getArch() == llvm::Triple::x86_64 && Triple.isX32())
|
||||
@@ -287,7 +287,7 @@
|
||||
@@ -287,7 +287,7 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||
if (Triple.getVendor() == llvm::Triple::OpenEmbedded &&
|
||||
Triple.isArch64Bit())
|
||||
addPathIfExists(D, SysRoot + "/usr/" + OSLibDir, Paths);
|
||||
addPathIfExists(D, concat(SysRoot, "/usr", OSLibDir), Paths);
|
||||
- else
|
||||
+ else if (!IsAndroid)
|
||||
addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
|
||||
addPathIfExists(D, concat(SysRoot, "/usr/lib/..", OSLibDir), Paths);
|
||||
if (IsRISCV) {
|
||||
StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple);
|
||||
@@ -311,7 +311,15 @@
|
||||
@@ -311,7 +311,15 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
|
||||
}
|
||||
|
||||
addPathIfExists(D, SysRoot + "/lib", Paths);
|
||||
- addPathIfExists(D, SysRoot + "/usr/lib", Paths);
|
||||
addPathIfExists(D, concat(SysRoot, "/lib"), Paths);
|
||||
- addPathIfExists(D, concat(SysRoot, "/usr/lib"), Paths);
|
||||
+ bool nativeBuild = MultiarchTriple == getMultiarchTriple(D, llvm::Triple(llvm::sys::getDefaultTargetTriple()), SysRoot);
|
||||
+ if (nativeBuild || !IsAndroid)
|
||||
+ addPathIfExists(D, SysRoot + "/usr/lib", Paths);
|
||||
+ addPathIfExists(D, concat(SysRoot, "/usr/lib"), Paths);
|
||||
+
|
||||
+ if (IsAndroid) {
|
||||
+ addPathIfExists(D, SysRoot + "/usr/" + MultiarchTriple + "/lib", Paths);
|
||||
+ addPathIfExists(D, "/system/" + OSLibDir, Paths);
|
||||
+ addPathIfExists(D, concat(SysRoot, "/usr/", MultiarchTriple, "/lib"), Paths);
|
||||
+ addPathIfExists(D, concat("/system/", OSLibDir), Paths);
|
||||
+ ExtraOpts.push_back("-rpath=" + SysRoot + "/usr/lib");
|
||||
+ }
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
--- a/llvm-project/clang/tools/driver/cc1depscan_main.cpp 2022-08-28 12:37:53.827579690 +0000
|
||||
+++ b/llvm-project/clang/tools/driver/cc1depscan_main.cpp 2022-08-28 12:39:25.307724796 +0000
|
||||
@@ -68,7 +68,7 @@
|
||||
ALWAYS_ENABLED_STATISTIC(NumRequests, "Number of -cc1 update requests");
|
||||
|
||||
#ifdef CLANG_HAVE_RLIMITS
|
||||
-#if defined(__linux__) && defined(__PIE__)
|
||||
+#if defined(__linux__) && defined(__PIE__) && !defined(__ANDROID__)
|
||||
static size_t getCurrentStackAllocation() {
|
||||
// If we can't compute the current stack usage, allow for 512K of command
|
||||
// line arguments and environment.
|
|
@ -9,18 +9,30 @@ index 8e79e18..a844183 100644
|
|||
- target_link_libraries(llvmSupport PRIVATE curses)
|
||||
+ target_link_libraries(llvmSupport PRIVATE android-spawn curses)
|
||||
endif()
|
||||
diff --git a/llvm-project/clang/tools/driver/CMakeLists.txt b/llvm-project/clang/tools/driver/CMakeLists.txt
|
||||
index dd34c12880..ffd68d908b 100644
|
||||
--- a/llvm-project/clang/tools/driver/CMakeLists.txt
|
||||
+++ b/llvm-project/clang/tools/driver/CMakeLists.txt
|
||||
@@ -97,6 +97,7 @@ if (APPLE)
|
||||
set(TOOL_INFO_VERSION)
|
||||
set(TOOL_INFO_BUILD_VERSION)
|
||||
endif()
|
||||
+target_link_libraries(clang PRIVATE "android-spawn")
|
||||
|
||||
if(CLANG_ORDER_FILE AND
|
||||
(LLVM_LINKER_IS_LD64 OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
|
||||
diff --git a/sourcekit-lsp/Utilities/build-script-helper.py b/sourcekit-lsp/Utilities/build-script-helper.py
|
||||
index a64795c..d48876d 100755
|
||||
--- a/sourcekit-lsp/Utilities/build-script-helper.py
|
||||
+++ b/sourcekit-lsp/Utilities/build-script-helper.py
|
||||
@@ -54,6 +54,7 @@ def get_swiftpm_options(args):
|
||||
if 'ANDROID_DATA' in os.environ or (args.cross_compile_host and re.match(
|
||||
'android-', args.cross_compile_host)):
|
||||
swiftpm_args += [
|
||||
+ '-Xlinker', '-landroid-spawn',
|
||||
'-Xlinker', '-rpath', '-Xlinker', '$ORIGIN/../lib/swift/android',
|
||||
# SwiftPM will otherwise try to compile against GNU strerror_r on
|
||||
# Android and fail.
|
||||
@@ -124,6 +124,7 @@ def get_swiftpm_options(swift_exec: str, args: argparse.Namespace) -> List[str]:
|
||||
if 'ANDROID_DATA' in os.environ or (args.cross_compile_host and re.match(
|
||||
'android-', args.cross_compile_host)):
|
||||
swiftpm_args += [
|
||||
+ '-Xlinker', '-landroid-spawn',
|
||||
'-Xlinker', '-rpath', '-Xlinker', '$ORIGIN/../lib/swift/android',
|
||||
# SwiftPM will otherwise try to compile against GNU strerror_r on
|
||||
# Android and fail.
|
||||
diff --git a/swift-corelibs-foundation/Sources/Foundation/CMakeLists.txt b/swift-corelibs-foundation/Sources/Foundation/CMakeLists.txt
|
||||
index 016bf294..cd534f16 100644
|
||||
--- a/swift-corelibs-foundation/Sources/Foundation/CMakeLists.txt
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
diff --git a/swift/lib/Driver/ToolChains.cpp b/swift/lib/Driver/ToolChains.cpp
|
||||
index c0ee9217e86..47b667187c6 100644
|
||||
--- a/swift/lib/Driver/ToolChains.cpp
|
||||
+++ b/swift/lib/Driver/ToolChains.cpp
|
||||
@@ -1448,6 +1448,9 @@ void ToolChain::getRuntimeLibraryPaths(SmallVectorImpl<std::string> &runtimeLibP
|
||||
StringRef SDKPath, bool shared) const {
|
||||
SmallString<128> scratchPath;
|
||||
getResourceDirPath(scratchPath, args, shared);
|
||||
+ if (getTriple().isAndroid())
|
||||
+ llvm::sys::path::append(scratchPath,
|
||||
+ swift::getMajorArchitectureName(getTriple()));
|
||||
runtimeLibPaths.push_back(std::string(scratchPath.str()));
|
||||
|
||||
// If there's a secondary resource dir, add it too.
|
||||
diff --git a/swift/lib/Frontend/CompilerInvocation.cpp b/swift/lib/Frontend/CompilerInvocation.cpp
|
||||
index 0a57134a410..71b7f36a634 100644
|
||||
--- a/swift/lib/Frontend/CompilerInvocation.cpp
|
||||
+++ b/swift/lib/Frontend/CompilerInvocation.cpp
|
||||
@@ -169,7 +169,7 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
|
||||
|
||||
llvm::sys::path::append(LibPath, LibSubDir);
|
||||
SearchPathOpts.RuntimeLibraryPaths.clear();
|
||||
- SearchPathOpts.RuntimeLibraryPaths.push_back(std::string(LibPath.str()));
|
||||
+ SearchPathOpts.RuntimeLibraryPaths.push_back("@TERMUX_PREFIX@/lib");
|
||||
if (Triple.isOSDarwin())
|
||||
SearchPathOpts.RuntimeLibraryPaths.push_back(DARWIN_OS_LIBRARY_PATH);
|
||||
|
||||
diff --git a/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift b/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
|
||||
index a4a735f4..dcd3f55a 100644
|
||||
--- a/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
|
||||
+++ b/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
|
||||
@@ -226,8 +226,11 @@ extension GenericUnixToolchain {
|
||||
}
|
||||
|
||||
// Add the runtime library link paths.
|
||||
- for path in runtimePaths {
|
||||
+ for var path in runtimePaths {
|
||||
commandLine.appendFlag(.L)
|
||||
+ if targetTriple.environment == .android {
|
||||
+ path = path.appending(component: majorArchitectureName(for: targetTriple))
|
||||
+ }
|
||||
commandLine.appendPath(path)
|
||||
}
|
||||
|
|
@ -1,103 +1,45 @@
|
|||
From eed2db947104f09b49adf98c27d5e3282187087b
|
||||
From: Dario Rexin <drexin@apple.com>
|
||||
Date: Tue, 20 Jul 2021 11:09:22 -0700
|
||||
Subject: [PATCH] [Build] Make LLVM a build-script product
|
||||
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py b/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py
|
||||
index 0b127d46c48..39144ae4674 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py
|
||||
@@ -509,7 +509,7 @@ class BuildScriptInvocation(object):
|
||||
"SWIFT_TEST_TARGETS": " ".join(
|
||||
config.swift_test_run_targets),
|
||||
"SWIFT_FLAGS": config.swift_flags,
|
||||
- "SWIFT_TARGET_CMAKE_OPTIONS": config.cmake_options,
|
||||
+ "SWIFT_TARGET_CMAKE_OPTIONS": ' '.join(config.cmake_options),
|
||||
}
|
||||
|
||||
return options
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/host_specific_configuration.py b/swift/utils/swift_build_support/swift_build_support/host_specific_configuration.py
|
||||
index fc037d6fb44..443b5e766c1 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/host_specific_configuration.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/host_specific_configuration.py
|
||||
@@ -15,6 +15,7 @@ import sys
|
||||
from argparse import ArgumentError
|
||||
|
||||
from . import compiler_stage
|
||||
+from .cmake import CMakeOptions
|
||||
from .targets import StdlibDeploymentTarget
|
||||
|
||||
|
||||
@@ -83,7 +84,7 @@ class HostSpecificConfiguration(object):
|
||||
self.swift_benchmark_build_targets = []
|
||||
self.swift_benchmark_run_targets = []
|
||||
self.swift_flags = ''
|
||||
- self.cmake_options = ''
|
||||
+ self.cmake_options = CMakeOptions()
|
||||
for deployment_target_name in stdlib_targets_to_configure:
|
||||
# Get the target object.
|
||||
deployment_target = StdlibDeploymentTarget.get_target_for_name(
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/products/cmark.py b/swift/utils/swift_build_support/swift_build_support/products/cmark.py
|
||||
index b11313fab87..fe2e8982300 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/cmark.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/cmark.py
|
||||
@@ -12,6 +12,8 @@
|
||||
@@ -12,6 +12,9 @@
|
||||
|
||||
from . import cmake_product
|
||||
from . import earlyswiftdriver
|
||||
+from ..host_specific_configuration \
|
||||
+ import HostSpecificConfiguration
|
||||
+import os
|
||||
|
||||
|
||||
class CMark(cmake_product.CMakeProduct):
|
||||
@@ -68,6 +70,9 @@ class CMark(cmake_product.CMakeProduct):
|
||||
@@ -68,6 +70,13 @@ class CMark(cmake_product.CMakeProduct):
|
||||
toolchain_file = self.generate_linux_toolchain_file(platform, arch)
|
||||
self.cmake_options.define('CMAKE_TOOLCHAIN_FILE:PATH', toolchain_file)
|
||||
|
||||
+ host_config = HostSpecificConfiguration(host_target, self.args)
|
||||
+ self.cmake_options.extend(host_config.cmake_options)
|
||||
+
|
||||
+ if 'ANDROID_DATA' not in os.environ:
|
||||
+ self.cmake_options.define('CMAKE_C_FLAGS', '%s --target=%s %s' % (os.environ.get('CFLAGS'), os.environ.get('CCTERMUX_HOST_PLATFORM'), os.environ.get('CPPFLAGS')))
|
||||
+ self.cmake_options.define('CMAKE_CXX_FLAGS', '%s --target=%s %s' % (os.environ.get('CXXFLAGS'), os.environ.get('CCTERMUX_HOST_PLATFORM'), os.environ.get('CPPFLAGS')))
|
||||
+
|
||||
self.build_with_cmake(["all"], self.args.cmark_build_variant, [])
|
||||
|
||||
def should_test(self, host_target):
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/targets.py b/swift/utils/swift_build_support/swift_build_support/targets.py
|
||||
index 05966defe28..133761ba91d 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/targets.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/targets.py
|
||||
@@ -11,6 +11,7 @@
|
||||
import os
|
||||
import platform
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/products/llvm.py b/swift/utils/swift_build_support/swift_build_support/products/llvm.py
|
||||
index 744dca10fca..7b5932882f2 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/llvm.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/llvm.py
|
||||
@@ -340,6 +340,12 @@ class LLVM(cmake_product.CMakeProduct):
|
||||
llvm_cmake_options.define('CLANG_TABLEGEN', clang_tblgen)
|
||||
llvm = os.path.join(host_build_dir, 'llvm')
|
||||
llvm_cmake_options.define('LLVM_NATIVE_BUILD', llvm)
|
||||
+ llvm_cmake_options.define('CMAKE_CXX_FLAGS', '{} --target={} {}'.format(os.environ['CXXFLAGS'], os.environ['CCTERMUX_HOST_PLATFORM'], os.environ['CPPFLAGS']))
|
||||
+ llvm_cmake_options.define('CMAKE_EXE_LINKER_FLAGS', '{} --target={}'.format(os.environ['LDFLAGS'], os.environ['CCTERMUX_HOST_PLATFORM']))
|
||||
+ llvm_cmake_options.define('CMAKE_FIND_ROOT_PATH:PATH', self.args.cross_compile_deps_path)
|
||||
+ llvm_cmake_options.define('CMAKE_FIND_ROOT_PATH_MODE_PROGRAM', 'NEVER')
|
||||
+ llvm_cmake_options.define('CMAKE_FIND_ROOT_PATH_MODE_LIBRARY', 'ONLY')
|
||||
+
|
||||
|
||||
+from . import cmake
|
||||
from . import shell
|
||||
host_config = HostSpecificConfiguration(host_target, self.args)
|
||||
|
||||
try:
|
||||
@@ -78,7 +79,7 @@ class Platform(object):
|
||||
"""
|
||||
CMake flags to build for a platform, useful for cross-compiling
|
||||
"""
|
||||
- return ''
|
||||
+ return cmake.CMakeOptions()
|
||||
|
||||
def swiftpm_config(self, args, output_dir, swift_toolchain, resource_path):
|
||||
"""
|
||||
@@ -163,12 +164,13 @@ class AndroidPlatform(Platform):
|
||||
return flags
|
||||
|
||||
def cmake_options(self, args):
|
||||
- options = '-DCMAKE_SYSTEM_NAME=Android '
|
||||
- options += '-DCMAKE_SYSTEM_VERSION=%s ' % (args.android_api_level)
|
||||
- options += '-DCMAKE_SYSTEM_PROCESSOR=%s ' % (args.android_arch if not
|
||||
- args.android_arch == 'armv7'
|
||||
- else 'armv7-a')
|
||||
- options += '-DCMAKE_ANDROID_NDK:PATH=%s' % (args.android_ndk)
|
||||
+ options = cmake.CMakeOptions()
|
||||
+ options.define('CMAKE_SYSTEM_NAME', 'Android')
|
||||
+ options.define('CMAKE_SYSTEM_VERSION' , args.android_api_level)
|
||||
+ options.define('CMAKE_SYSTEM_PROCESSOR', args.android_arch if not
|
||||
+ args.android_arch == 'armv7'
|
||||
+ else 'armv7-a')
|
||||
+ options.define('CMAKE_ANDROID_STANDALONE_TOOLCHAIN:PATH', args.android_ndk)
|
||||
return options
|
||||
|
||||
def ndk_toolchain_path(self, args):
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
diff --git a/cmark/src/CMakeLists.txt b/cmark/src/CMakeLists.txt
|
||||
index faabffa..65e23cc 100644
|
||||
--- a/cmark/src/CMakeLists.txt
|
||||
+++ b/cmark/src/CMakeLists.txt
|
||||
@@ -162,7 +162,7 @@ if(CMARK_SHARED OR CMARK_STATIC)
|
||||
set(CMARK_TARGETS_FILE ${CMAKE_CURRENT_BINARY_DIR}/cmarkTargets.cmake)
|
||||
export(TARGETS ${CMARK_INSTALL} FILE ${CMARK_TARGETS_FILE})
|
||||
|
||||
- if(CMARK_THREADING AND NOT APPLE AND NOT MSVC)
|
||||
+ if(CMARK_THREADING AND NOT APPLE AND NOT MSVC AND NOT ANDROID)
|
||||
if(CMARK_SHARED)
|
||||
target_link_libraries(${LIBRARY} pthread)
|
||||
endif(CMARK_SHARED)
|
||||
diff --git a/llvm-project/clang/runtime/CMakeLists.txt b/llvm-project/clang/runtime/CMakeLists.txt
|
||||
index 61b1c60bf590..5b0d10a67699 100644
|
||||
--- a/llvm-project/clang/runtime/CMakeLists.txt
|
||||
|
@ -31,38 +44,63 @@ index 1bcfc0734785..ddb77c91b22d 100644
|
|||
|
||||
install(DIRECTORY ../../include/indexstore
|
||||
COMPONENT IndexStore
|
||||
diff --git a/llvm-project/compiler-rt/cmake/Modules/HandleCompilerRT.cmake b/llvm-project/compiler-rt/cmake/Modules/HandleCompilerRT.cmake
|
||||
diff --git a/llvm-project/llvm/CMakeLists.txt b/llvm-project/llvm/CMakeLists.txt
|
||||
index a888c4177fa5..6788a62fa8bd 100644
|
||||
--- a/llvm-project/llvm/CMakeLists.txt
|
||||
+++ b/llvm-project/llvm/CMakeLists.txt
|
||||
@@ -625,7 +625,7 @@ option (LLVM_ENABLE_SPHINX "Use Sphinx to generate llvm documentation." OFF)
|
||||
option (LLVM_ENABLE_OCAMLDOC "Build OCaml bindings documentation." ON)
|
||||
option (LLVM_ENABLE_BINDINGS "Build bindings." ON)
|
||||
|
||||
-if(UNIX)
|
||||
+if(UNIX AND CMAKE_SIZEOF_VOID_P GREATER_EQUAL 8)
|
||||
set(LLVM_ENABLE_ONDISK_CAS_default ON)
|
||||
else()
|
||||
set(LLVM_ENABLE_ONDISK_CAS_default OFF)
|
||||
diff --git a/llvm-project/cmake/Modules/HandleCompilerRT.cmake b/llvm-project/cmake/Modules/HandleCompilerRT.cmake
|
||||
index ac9e0871489d..b495cbfb5c2e 100644
|
||||
--- a/llvm-project/compiler-rt/cmake/Modules/HandleCompilerRT.cmake
|
||||
+++ b/llvm-project/compiler-rt/cmake/Modules/HandleCompilerRT.cmake
|
||||
@@ -31,7 +31,7 @@ function(find_compiler_rt_library name target variable)
|
||||
# If the cache variable is not defined, invoke clang and then
|
||||
# set it with cache_compiler_rt_library.
|
||||
set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${SANITIZER_COMMON_FLAGS}
|
||||
- "--rtlib=compiler-rt" "-print-libgcc-file-name")
|
||||
+ "--rtlib=compiler-rt" "-print-libgcc-file-name" "-resource-dir=$ENV{PREFIX}/lib/clang/$ENV{TERMUX_CLANG_VERSION}/")
|
||||
if(target)
|
||||
list(APPEND CLANG_COMMAND "--target=${target}")
|
||||
--- a/llvm-project/cmake/Modules/HandleCompilerRT.cmake
|
||||
+++ b/llvm-project/cmake/Modules/HandleCompilerRT.cmake
|
||||
@@ -77,7 +77,7 @@
|
||||
set(cmd_prefix "/clang:")
|
||||
endif()
|
||||
execute_process(
|
||||
- COMMAND ${clang_command} "${cmd_prefix}--rtlib=compiler-rt" "${cmd_prefix}-print-libgcc-file-name"
|
||||
+ COMMAND ${clang_command} "${cmd_prefix}--rtlib=compiler-rt" "${cmd_prefix}-print-libgcc-file-name" "-resource-dir=$ENV{PREFIX}/lib/clang/$ENV{TERMUX_CLANG_VERSION}/"
|
||||
RESULT_VARIABLE had_error
|
||||
OUTPUT_VARIABLE library_file
|
||||
)
|
||||
diff --git a/llvm-project/llvm/cmake/modules/FindTerminfo.cmake b/llvm-project/llvm/cmake/modules/FindTerminfo.cmake
|
||||
index 65edb80fa6..d02a445021 100644
|
||||
--- a/llvm-project/llvm/cmake/modules/FindTerminfo.cmake
|
||||
+++ b/llvm-project/llvm/cmake/modules/FindTerminfo.cmake
|
||||
@@ -14,15 +14,7 @@
|
||||
find_library(Terminfo_LIBRARIES NAMES terminfo tinfo curses ncurses ncursesw)
|
||||
|
||||
if(Terminfo_LIBRARIES)
|
||||
- include(CMakePushCheckState)
|
||||
- include(CheckCSourceCompiles)
|
||||
- cmake_push_check_state()
|
||||
- list(APPEND CMAKE_REQUIRED_LIBRARIES ${Terminfo_LIBRARIES})
|
||||
- check_c_source_compiles("
|
||||
- int setupterm(char *term, int filedes, int *errret);
|
||||
- int main() { return setupterm(0, 0, 0); }"
|
||||
- Terminfo_LINKABLE)
|
||||
- cmake_pop_check_state()
|
||||
+ set(Terminfo_LINKABLE 1)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
diff --git a/swift/CMakeLists.txt b/swift/CMakeLists.txt
|
||||
index b7503ecdd6..c643c2c9a5 100644
|
||||
--- a/swift/CMakeLists.txt
|
||||
+++ b/swift/CMakeLists.txt
|
||||
@@ -315,7 +315,7 @@ set(SWIFT_ANDROID_API_LEVEL "" CACHE STRING
|
||||
|
||||
set(SWIFT_ANDROID_NDK_PATH "" CACHE STRING
|
||||
"Path to the directory that contains the Android NDK tools that are executable on the build machine")
|
||||
-set(SWIFT_ANDROID_NDK_CLANG_VERSION "12.0.8" CACHE STRING
|
||||
+set(SWIFT_ANDROID_NDK_CLANG_VERSION "14.0.6" CACHE STRING
|
||||
"The Clang version to use when building for Android.")
|
||||
set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
|
||||
"Path on an Android device where build products will be pushed. These are used when running the test suite against the device")
|
||||
@@ -463,7 +463,7 @@ set(SWIFT_BUILD_HOST_DISPATCH FALSE)
|
||||
if(SWIFT_ENABLE_DISPATCH AND NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||
# Only build libdispatch for the host if the host tools are being built and
|
||||
# specifically if these two libraries that depend on it are built.
|
||||
- if(SWIFT_INCLUDE_TOOLS AND (SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT))
|
||||
+ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL Android AND SWIFT_INCLUDE_TOOLS AND (SWIFT_BUILD_SYNTAXPARSERLIB OR SWIFT_BUILD_SOURCEKIT))
|
||||
- if(SWIFT_INCLUDE_TOOLS AND SWIFT_BUILD_SOURCEKIT)
|
||||
+ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL Android AND SWIFT_INCLUDE_TOOLS AND SWIFT_BUILD_SOURCEKIT)
|
||||
set(SWIFT_BUILD_HOST_DISPATCH TRUE)
|
||||
endif()
|
||||
|
||||
|
@ -89,7 +127,7 @@ index f4a2eb2dddc..61a2548cf77 100644
|
|||
endif()
|
||||
get_versioned_target_triple(target ${SWIFT_HOST_VARIANT_SDK}
|
||||
${SWIFT_HOST_VARIANT_ARCH} "${deployment_version}")
|
||||
@@ -155,6 +155,9 @@ function(add_swift_compiler_modules_library name)
|
||||
@@ -186,6 +186,9 @@ function(add_swift_compiler_modules_library name)
|
||||
|
||||
set("${module}_dep_target" ${dep_target})
|
||||
set(all_module_targets ${all_module_targets} ${dep_target})
|
||||
|
@ -103,29 +141,41 @@ diff --git a/swift/cmake/modules/AddSwift.cmake b/swift/cmake/modules/AddSwift.c
|
|||
index a448bcb23c4..0ddbac17a52 100644
|
||||
--- a/swift/cmake/modules/AddSwift.cmake
|
||||
+++ b/swift/cmake/modules/AddSwift.cmake
|
||||
@@ -922,7 +923,7 @@ function(add_swift_host_tool executable)
|
||||
@@ -526,7 +526,7 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
|
||||
# installed host toolchain.
|
||||
get_filename_component(swift_bin_dir ${SWIFT_EXEC_FOR_LIBSWIFT} DIRECTORY)
|
||||
get_filename_component(swift_bin_dir ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY)
|
||||
get_filename_component(swift_dir ${swift_bin_dir} DIRECTORY)
|
||||
- set(host_lib_dir "${swift_dir}/lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
|
||||
+ set(host_lib_dir "${SWIFT_BINARY_DIR}/lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
|
||||
|
||||
target_link_libraries(${executable} PRIVATE ${swiftrt})
|
||||
target_link_libraries(${executable} PRIVATE "swiftCore")
|
||||
target_link_libraries(${target} PRIVATE ${swiftrt})
|
||||
target_link_libraries(${target} PRIVATE "swiftCore")
|
||||
diff --git a/swift/localization/CMakeLists.txt b/swift/localization/CMakeLists.txt
|
||||
index 07a3585a66c..461a98b6856 100644
|
||||
--- a/swift/localization/CMakeLists.txt
|
||||
+++ b/swift/localization/CMakeLists.txt
|
||||
@@ -1,3 +1,4 @@
|
||||
+if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "${SWIFT_RUNTIME_OUTPUT_INTDIR}")
|
||||
+if(NOT SWIFT_PREBUILT_SWIFT)
|
||||
set(diagnostic_witness "${CMAKE_BINARY_DIR}/share/swift/diagnostics/generated")
|
||||
|
||||
add_custom_command(
|
||||
@@ -32,3 +33,4 @@ swift_install_in_component(
|
||||
PATTERN "*.db"
|
||||
PATTERN "*.yaml"
|
||||
PATTERN "*.strings"
|
||||
)
|
||||
+endif()
|
||||
diff --git a/swift/stdlib/cmake/modules/AddSwiftStdlib.cmake b/swift/stdlib/cmake/modules/AddSwiftStdlib.cmake
|
||||
index 25a79d145fb..74a838e2075 100644
|
||||
--- a/swift/stdlib/cmake/modules/AddSwiftStdlib.cmake
|
||||
+++ b/swift/stdlib/cmake/modules/AddSwiftStdlib.cmake
|
||||
@@ -462,6 +462,7 @@ function(_add_target_variant_link_flags)
|
||||
list(APPEND link_libraries "dl" "log")
|
||||
# We need to add the math library, which is linked implicitly by libc++
|
||||
list(APPEND result "-lm")
|
||||
+ list(APPEND result "-fno-openmp-implicit-rpath")
|
||||
if(NOT "${SWIFT_ANDROID_NDK_PATH}" STREQUAL "")
|
||||
file(GLOB RESOURCE_DIR ${SWIFT_SDK_ANDROID_ARCH_${LFLAGS_ARCH}_PATH}/../lib64/clang/*)
|
||||
list(APPEND result "-resource-dir=${RESOURCE_DIR}")
|
||||
diff --git a/swift/stdlib/cmake/modules/SwiftSource.cmake b/swift/stdlib/cmake/modules/SwiftSource.cmake
|
||||
index 4bc312f7f89..d71f6408d9f 100644
|
||||
--- a/swift/stdlib/cmake/modules/SwiftSource.cmake
|
||||
|
@ -155,8 +205,8 @@ index 3313f56c8a6..59804ff6228 100644
|
|||
elseif("${SWIFT_CONCURRENCY_GLOBAL_EXECUTOR}" STREQUAL "singlethreaded" OR
|
||||
"${SWIFT_CONCURRENCY_GLOBAL_EXECUTOR}" STREQUAL "hooked")
|
||||
@@ -120,6 +120,7 @@ add_swift_target_library(swift_Concurrency ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} I
|
||||
SWIFT_MODULE_DEPENDS_WINDOWS CRT
|
||||
|
||||
INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY
|
||||
${swift_concurrency_incorporate_object_libraries_so}
|
||||
LINK_LIBRARIES ${swift_concurrency_link_libraries}
|
||||
+ LINK_FLAGS "-ldispatch"
|
||||
|
||||
|
@ -188,7 +238,7 @@ index 7a77e125f95..7eddfea2054 100644
|
|||
+ ${SWIFT_ANDROID_NATIVE_SYSROOT}/usr/include)
|
||||
endfunction()
|
||||
|
||||
# Add a new SourceKit library.
|
||||
function(add_sourcekitd_swifrt_linking target path HAS_SWIFT_MODULES)
|
||||
@@ -115,7 +115,7 @@ function(add_sourcekitd_swifrt_linking target path HAS_SWIFT_MODULES)
|
||||
# installed host toolchain.
|
||||
get_filename_component(swift_bin_dir ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY)
|
||||
|
@ -198,20 +248,20 @@ index 7a77e125f95..7eddfea2054 100644
|
|||
|
||||
target_link_libraries(${target} PRIVATE ${swiftrt})
|
||||
target_link_libraries(${target} PRIVATE "swiftCore")
|
||||
diff --git a/swift/tools/libSwiftSyntaxParser/CMakeLists.txt b/swift/tools/libSwiftSyntaxParser/CMakeLists.txt
|
||||
index 42dda212164..2338df9072a 100644
|
||||
--- a/swift/tools/libSwiftSyntaxParser/CMakeLists.txt
|
||||
+++ b/swift/tools/libSwiftSyntaxParser/CMakeLists.txt
|
||||
@@ -13,6 +13,9 @@ add_swift_host_library(libSwiftSyntaxParser SHARED
|
||||
if(NOT SWIFT_BUILT_STANDALONE AND NOT CMAKE_C_COMPILER_ID MATCHES Clang)
|
||||
add_dependencies(libSwiftSyntaxParser clang)
|
||||
endif()
|
||||
+# Look in Termux sysroot for Block.h from libdispatch
|
||||
+target_include_directories(libSwiftSyntaxParser SYSTEM PRIVATE
|
||||
+ ${SWIFT_ANDROID_NATIVE_SYSROOT}/usr/include)
|
||||
target_link_libraries(libSwiftSyntaxParser PRIVATE
|
||||
swiftParse)
|
||||
set_target_properties(libSwiftSyntaxParser
|
||||
diff --git a/swift/tools/swift-compatibility-symbols/CMakeLists.txt b/swift/tools/swift-compatibility-symbols/CMakeLists.txt
|
||||
index 11cda641cc2..bd2cb152725 100644
|
||||
--- a/swift/tools/swift-compatibility-symbols/CMakeLists.txt
|
||||
+++ b/swift/tools/swift-compatibility-symbols/CMakeLists.txt
|
||||
@@ -1,3 +1,4 @@
|
||||
+if(NOT SWIFT_PREBUILT_SWIFT)
|
||||
add_swift_host_tool(swift-compatibility-symbols
|
||||
swift-compatibility-symbols.cpp
|
||||
LLVM_LINK_COMPONENTS support
|
||||
@@ -26,3 +27,4 @@ swift_install_in_component(
|
||||
COMPONENT
|
||||
compiler
|
||||
)
|
||||
+endif()
|
||||
diff --git a/swift-corelibs-xctest/CMakeLists.txt b/swift-corelibs-xctest/CMakeLists.txt
|
||||
index 531e7c0..589930f 100644
|
||||
--- a/swift-corelibs-xctest/CMakeLists.txt
|
||||
|
@ -224,25 +274,11 @@ index 531e7c0..589930f 100644
|
|||
endif()
|
||||
endif()
|
||||
set_target_properties(XCTest PROPERTIES
|
||||
diff --git a/swift-crypto/Sources/CCryptoBoringSSL/CMakeLists.txt b/swift-crypto/Sources/CCryptoBoringSSL/CMakeLists.txt
|
||||
index 1a890d6..639126c 100644
|
||||
--- a/swift-crypto/Sources/CCryptoBoringSSL/CMakeLists.txt
|
||||
+++ b/swift-crypto/Sources/CCryptoBoringSSL/CMakeLists.txt
|
||||
@@ -337,7 +337,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL Darwin AND CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x
|
||||
crypto/fipsmodule/vpaes-x86_64.mac.x86_64.S
|
||||
crypto/fipsmodule/x86_64-mont.mac.x86_64.S
|
||||
crypto/fipsmodule/x86_64-mont5.mac.x86_64.S)
|
||||
-elseif(CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
|
||||
+elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
|
||||
target_sources(CCryptoBoringSSL PRIVATE
|
||||
crypto/chacha/chacha-x86_64.linux.x86_64.S
|
||||
crypto/cipher_extra/aes128gcmsiv-x86_64.linux.x86_64.S
|
||||
@@ -368,7 +368,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm
|
||||
crypto/fipsmodule/sha256-armv8.ios.aarch64.S
|
||||
crypto/fipsmodule/sha512-armv8.ios.aarch64.S
|
||||
crypto/fipsmodule/vpaes-armv8.ios.aarch64.S)
|
||||
-elseif(CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")
|
||||
+elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|Android" AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")
|
||||
target_sources(CCryptoBoringSSL PRIVATE
|
||||
crypto/chacha/chacha-armv8.linux.aarch64.S
|
||||
crypto/fipsmodule/aesv8-armx64.linux.aarch64.S
|
||||
@@ -69,7 +69,6 @@ set_target_properties(XCTest PROPERTIES
|
||||
if(ENABLE_TESTING)
|
||||
enable_testing()
|
||||
|
||||
- enable_language(C)
|
||||
find_package(LLVM CONFIG)
|
||||
if(LLVM_FOUND)
|
||||
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}")
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
diff --git a/swift/utils/swift_build_support/swift_build_support/products/cmark.py b/swift/utils/swift_build_support/swift_build_support/products/cmark.py
|
||||
index fe2e8982300..b413d47b843 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/cmark.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/cmark.py
|
||||
@@ -14,6 +14,7 @@ from . import cmake_product
|
||||
from . import earlyswiftdriver
|
||||
from ..host_specific_configuration \
|
||||
import HostSpecificConfiguration
|
||||
+import os
|
||||
|
||||
|
||||
class CMark(cmake_product.CMakeProduct):
|
||||
@@ -73,6 +74,10 @@ class CMark(cmake_product.CMakeProduct):
|
||||
host_config = HostSpecificConfiguration(host_target, self.args)
|
||||
self.cmake_options.extend(host_config.cmake_options)
|
||||
|
||||
+ if 'ANDROID_DATA' not in os.environ:
|
||||
+ self.cmake_options.define('CMAKE_C_FLAGS', '%s --target=%s %s' % (os.environ.get('CFLAGS'), os.environ.get('CCTERMUX_HOST_PLATFORM'), os.environ.get('CPPFLAGS')))
|
||||
+ self.cmake_options.define('CMAKE_CXX_FLAGS', '%s --target=%s %s' % (os.environ.get('CXXFLAGS'), os.environ.get('CCTERMUX_HOST_PLATFORM'), os.environ.get('CPPFLAGS')))
|
||||
+
|
||||
self.build_with_cmake(["all"], self.args.cmark_build_variant, [])
|
||||
|
||||
def should_test(self, host_target):
|
|
@ -1,27 +0,0 @@
|
|||
diff --git a/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift b/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
|
||||
index 06a29d8..5cbfddd 100644
|
||||
--- a/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
|
||||
+++ b/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
|
||||
@@ -133,8 +137,7 @@ extension GenericUnixToolchain {
|
||||
isShared: hasRuntimeArgs
|
||||
)
|
||||
|
||||
- if hasRuntimeArgs && targetTriple.environment != .android &&
|
||||
- toolchainStdlibRpath {
|
||||
+ if hasRuntimeArgs && toolchainStdlibRpath {
|
||||
// FIXME: We probably shouldn't be adding an rpath here unless we know
|
||||
// ahead of time the standard library won't be copied.
|
||||
for path in runtimePaths {
|
||||
diff --git a/swift/lib/Driver/UnixToolChains.cpp b/swift/lib/Driver/UnixToolChains.cpp
|
||||
index bdc63d1ca72..971e5ded1e2 100644
|
||||
--- a/swift/lib/Driver/UnixToolChains.cpp
|
||||
+++ b/swift/lib/Driver/UnixToolChains.cpp
|
||||
@@ -133,7 +133,7 @@ bool toolchains::GenericUnix::addRuntimeRPath(const llvm::Triple &T,
|
||||
// copied into the bundle.
|
||||
return Args.hasFlag(options::OPT_toolchain_stdlib_rpath,
|
||||
options::OPT_no_toolchain_stdlib_rpath,
|
||||
- !T.isAndroid());
|
||||
+ true);
|
||||
}
|
||||
|
||||
ToolChain::InvocationInfo
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/swift/include/swift/Basic/BridgingUtils.h b/swift/include/swift/Basic/BridgingUtils.h
|
||||
index bd8fe2e6a06..55e962f2ec3 100644
|
||||
--- a/swift/include/swift/Basic/BridgingUtils.h
|
||||
+++ b/swift/include/swift/Basic/BridgingUtils.h
|
||||
@@ -54,7 +54,7 @@ getCharSourceRange(const BridgedCharSourceRange &bridged) {
|
||||
inline BridgedCharSourceRange
|
||||
getBridgedCharSourceRange(const CharSourceRange &range) {
|
||||
auto start = getBridgedSourceLoc(range.getStart());
|
||||
- return {start, range.getByteLength()};
|
||||
+ return {start, static_cast<SwiftInt>(range.getByteLength())};
|
||||
}
|
||||
|
||||
/// Copies the string in an malloc'ed memory and the caller is responsible for
|
|
@ -0,0 +1,69 @@
|
|||
diff --git a/llbuild/products/llbuildSwift/CMakeLists.txt b/llbuild/products/llbuildSwift/CMakeLists.txt
|
||||
index aabc3f2e..168f939c 100644
|
||||
--- a/llbuild/products/llbuildSwift/CMakeLists.txt
|
||||
+++ b/llbuild/products/llbuildSwift/CMakeLists.txt
|
||||
@@ -64,8 +64,8 @@ else()
|
||||
Foundation)
|
||||
if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
|
||||
target_link_options(llbuildSwift PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
|
||||
- set_target_properties(llbuildSwift PROPERTIES
|
||||
- INSTALL_RPATH "$ORIGIN:$ORIGIN/../../$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
|
||||
+# set_target_properties(llbuildSwift PROPERTIES
|
||||
+ # INSTALL_RPATH "$ORIGIN:$ORIGIN/../../$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
|
||||
endif()
|
||||
endif()
|
||||
set_target_properties(llbuildSwift PROPERTIES
|
||||
diff --git a/sourcekit-lsp/Utilities/build-script-helper.py b/sourcekit-lsp/Utilities/build-script-helper.py
|
||||
index bd31bec..737c8c3 100755
|
||||
--- a/sourcekit-lsp/Utilities/build-script-helper.py
|
||||
+++ b/sourcekit-lsp/Utilities/build-script-helper.py
|
||||
@@ -124,7 +124,7 @@ def get_swiftpm_options(swift_exec: str, args: argparse.Namespace) -> List[str]:
|
||||
'android-', args.cross_compile_host)):
|
||||
swiftpm_args += [
|
||||
'-Xlinker', '-landroid-spawn',
|
||||
- '-Xlinker', '-rpath', '-Xlinker', '$ORIGIN/../lib/swift/android',
|
||||
+ #'-Xlinker', '-rpath', '-Xlinker', '$ORIGIN/../lib/swift/android',
|
||||
# SwiftPM will otherwise try to compile against GNU strerror_r on
|
||||
# Android and fail.
|
||||
'-Xswiftc', '-Xcc', '-Xswiftc', '-U_GNU_SOURCE',
|
||||
diff --git a/swift-corelibs-foundation/Sources/Tools/plutil/CMakeLists.txt b/swift-corelibs-foundation/Sources/Tools/plutil/CMakeLists.txt
|
||||
index b1c84350..35413f0b 100644
|
||||
--- a/swift-corelibs-foundation/Sources/Tools/plutil/CMakeLists.txt
|
||||
+++ b/swift-corelibs-foundation/Sources/Tools/plutil/CMakeLists.txt
|
||||
@@ -27,8 +27,8 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin|Windows")
|
||||
set_target_properties(plutil PROPERTIES BUILD_RPATH ${CMAKE_MATCH_1})
|
||||
endif()
|
||||
|
||||
-set_target_properties(plutil PROPERTIES
|
||||
- INSTALL_RPATH "$ORIGIN/../lib/swift/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
|
||||
+#set_target_properties(plutil PROPERTIES
|
||||
+ # INSTALL_RPATH "$ORIGIN/../lib/swift/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
|
||||
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY Foundation_EXPORTS plutil)
|
||||
diff --git a/swift-driver/Utilities/build-script-helper.py b/swift-driver/Utilities/build-script-helper.py
|
||||
index ce6523d5..e8d63bdd 100755
|
||||
--- a/swift-driver/Utilities/build-script-helper.py
|
||||
+++ b/swift-driver/Utilities/build-script-helper.py
|
||||
@@ -101,7 +101,7 @@ def get_swiftpm_options(args):
|
||||
'android-', args.cross_compile_hosts[0])):
|
||||
swiftpm_args += [
|
||||
'-Xlinker', '-landroid-spawn',
|
||||
- '-Xlinker', '-rpath', '-Xlinker', '$ORIGIN/../lib/swift/android',
|
||||
+ #'-Xlinker', '-rpath', '-Xlinker', '$ORIGIN/../lib/swift/android',
|
||||
# SwiftPM will otherwise try to compile against GNU strerror_r on
|
||||
# Android and fail.
|
||||
'-Xswiftc', '-Xcc', '-Xswiftc', '-U_GNU_SOURCE',
|
||||
diff --git a/swiftpm/Utilities/bootstrap b/swiftpm/Utilities/bootstrap
|
||||
index 92c368a86..e9d43b599 100755
|
||||
--- a/swiftpm/Utilities/bootstrap
|
||||
+++ b/swiftpm/Utilities/bootstrap
|
||||
@@ -785,7 +785,7 @@ def get_swiftpm_flags(args):
|
||||
platform_path = None
|
||||
for path in args.target_info["paths"]["runtimeLibraryPaths"]:
|
||||
platform_path = re.search(r"(lib/swift/([^/]+))$", path)
|
||||
- if platform_path:
|
||||
+ if not platform_path:
|
||||
build_flags.extend(
|
||||
[
|
||||
"-Xlinker",
|
|
@ -0,0 +1,20 @@
|
|||
TERMUX_SUBPKG_DESCRIPTION="Swift runtime libraries for Android AArch64"
|
||||
TERMUX_SUBPKG_INCLUDE="opt/ndk-multilib/aarch64-linux-android/lib/lib[FXs]*.so"
|
||||
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true
|
||||
TERMUX_SUBPKG_DEPEND_ON_PARENT=no
|
||||
TERMUX_SUBPKG_DEPENDS="ndk-multilib"
|
||||
|
||||
termux_step_create_subpkg_debscripts() {
|
||||
local file
|
||||
for file in postinst prerm; do
|
||||
sed -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
|
||||
-e "s|@TERMUX_PACKAGE_FORMAT@|${TERMUX_PACKAGE_FORMAT}|g" \
|
||||
-e "s|@SWIFT_TRIPLE@|aarch64-linux-android|g" \
|
||||
$TERMUX_PKG_BUILDER_DIR/trigger-header > "${file}"
|
||||
done
|
||||
sed 's|@COMMAND@|ln -sf "'$TERMUX_PREFIX'/opt/ndk-multilib/aarch64-linux-android/lib/lib$so.so" "$install_path"|' \
|
||||
$TERMUX_PKG_BUILDER_DIR/trigger-command >> postinst
|
||||
sed 's|@COMMAND@|rm -f "$install_path/lib$so.so"|' \
|
||||
$TERMUX_PKG_BUILDER_DIR/trigger-command >> prerm
|
||||
chmod 0700 postinst prerm
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
TERMUX_SUBPKG_DESCRIPTION="Swift runtime libraries for Android armv7"
|
||||
TERMUX_SUBPKG_INCLUDE="opt/ndk-multilib/arm-linux-androideabi/lib/lib[FXs]*.so"
|
||||
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true
|
||||
TERMUX_SUBPKG_DEPEND_ON_PARENT=no
|
||||
TERMUX_SUBPKG_DEPENDS="ndk-multilib"
|
||||
|
||||
termux_step_create_subpkg_debscripts() {
|
||||
local file
|
||||
for file in postinst prerm; do
|
||||
sed -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
|
||||
-e "s|@TERMUX_PACKAGE_FORMAT@|${TERMUX_PACKAGE_FORMAT}|g" \
|
||||
-e "s|@SWIFT_TRIPLE@|arm-linux-androideabi|g" \
|
||||
$TERMUX_PKG_BUILDER_DIR/trigger-header > "${file}"
|
||||
done
|
||||
sed 's|@COMMAND@|ln -sf "'$TERMUX_PREFIX'/opt/ndk-multilib/arm-linux-androideabi/lib/lib$so.so" "$install_path"|' \
|
||||
$TERMUX_PKG_BUILDER_DIR/trigger-command >> postinst
|
||||
sed 's|@COMMAND@|rm -f "$install_path/lib$so.so"|' \
|
||||
$TERMUX_PKG_BUILDER_DIR/trigger-command >> prerm
|
||||
chmod 0700 postinst prerm
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
TERMUX_SUBPKG_DESCRIPTION="Swift runtime libraries for Android x86_64"
|
||||
TERMUX_SUBPKG_INCLUDE="opt/ndk-multilib/x86_64-linux-android/lib/lib[FXs]*.so"
|
||||
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true
|
||||
TERMUX_SUBPKG_DEPEND_ON_PARENT=no
|
||||
TERMUX_SUBPKG_DEPENDS="ndk-multilib"
|
||||
|
||||
termux_step_create_subpkg_debscripts() {
|
||||
local file
|
||||
for file in postinst prerm; do
|
||||
sed -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
|
||||
-e "s|@TERMUX_PACKAGE_FORMAT@|${TERMUX_PACKAGE_FORMAT}|g" \
|
||||
-e "s|@SWIFT_TRIPLE@|x86_64-linux-android|g" \
|
||||
$TERMUX_PKG_BUILDER_DIR/trigger-header > "${file}"
|
||||
done
|
||||
sed 's|@COMMAND@|ln -sf "'$TERMUX_PREFIX'/opt/ndk-multilib/x86_64-linux-android/lib/lib$so.so" "$install_path"|' \
|
||||
$TERMUX_PKG_BUILDER_DIR/trigger-command >> postinst
|
||||
sed 's|@COMMAND@|rm -f "$install_path/lib$so.so"|' \
|
||||
$TERMUX_PKG_BUILDER_DIR/trigger-command >> prerm
|
||||
chmod 0700 postinst prerm
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
TERMUX_SUBPKG_DESCRIPTION="Swift SDK for Android AArch64"
|
||||
TERMUX_SUBPKG_INCLUDE="
|
||||
lib/swift/android/aarch64/*.swiftdoc
|
||||
lib/swift/android/aarch64/*.swiftmodule
|
||||
lib/swift/android/aarch64/glibc.modulemap
|
||||
lib/swift/android/aarch64/libcxxshim.h
|
||||
lib/swift/android/aarch64/libcxxshim.modulemap
|
||||
lib/swift/android/aarch64/libswiftCompatibilityBytecodeLayouts.a
|
||||
lib/swift/android/aarch64/libswiftCxx.a
|
||||
lib/swift/android/aarch64/SwiftGlibc.h
|
||||
lib/swift/android/aarch64/swiftrt.o
|
||||
lib/swift/android/*.swiftmodule/aarch64-*
|
||||
lib/swift_static/android/aarch64/
|
||||
lib/swift_static/android/*.swiftmodule/aarch64-*
|
||||
"
|
||||
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true
|
||||
TERMUX_SUBPKG_DEPENDS="swift-runtime-aarch64"
|
||||
TERMUX_SUBPKG_BREAKS="swift (<< 5.8)"
|
||||
TERMUX_SUBPKG_REPLACES="swift (<< 5.8)"
|
|
@ -0,0 +1,19 @@
|
|||
TERMUX_SUBPKG_DESCRIPTION="Swift SDK for Android armv7"
|
||||
TERMUX_SUBPKG_INCLUDE="
|
||||
lib/swift/android/armv7/*.swiftdoc
|
||||
lib/swift/android/armv7/*.swiftmodule
|
||||
lib/swift/android/armv7/glibc.modulemap
|
||||
lib/swift/android/armv7/libcxxshim.h
|
||||
lib/swift/android/armv7/libcxxshim.modulemap
|
||||
lib/swift/android/armv7/libswiftCompatibilityBytecodeLayouts.a
|
||||
lib/swift/android/armv7/libswiftCxx.a
|
||||
lib/swift/android/armv7/SwiftGlibc.h
|
||||
lib/swift/android/armv7/swiftrt.o
|
||||
lib/swift/android/*.swiftmodule/armv7-*
|
||||
lib/swift_static/android/armv7/
|
||||
lib/swift_static/android/*.swiftmodule/armv7-*
|
||||
"
|
||||
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true
|
||||
TERMUX_SUBPKG_DEPENDS="swift-runtime-arm"
|
||||
TERMUX_SUBPKG_BREAKS="swift (<< 5.8)"
|
||||
TERMUX_SUBPKG_REPLACES="swift (<< 5.8)"
|
|
@ -0,0 +1,19 @@
|
|||
TERMUX_SUBPKG_DESCRIPTION="Swift SDK for Android x86_64"
|
||||
TERMUX_SUBPKG_INCLUDE="
|
||||
lib/swift/android/x86_64/*.swiftdoc
|
||||
lib/swift/android/x86_64/*.swiftmodule
|
||||
lib/swift/android/x86_64/glibc.modulemap
|
||||
lib/swift/android/x86_64/libcxxshim.h
|
||||
lib/swift/android/x86_64/libcxxshim.modulemap
|
||||
lib/swift/android/x86_64/libswiftCompatibilityBytecodeLayouts.a
|
||||
lib/swift/android/x86_64/libswiftCxx.a
|
||||
lib/swift/android/x86_64/SwiftGlibc.h
|
||||
lib/swift/android/x86_64/swiftrt.o
|
||||
lib/swift/android/*.swiftmodule/x86_64-*
|
||||
lib/swift_static/android/x86_64/
|
||||
lib/swift_static/android/*.swiftmodule/x86_64-*
|
||||
"
|
||||
TERMUX_SUBPKG_PLATFORM_INDEPENDENT=true
|
||||
TERMUX_SUBPKG_DEPENDS="swift-runtime-x86-64"
|
||||
TERMUX_SUBPKG_BREAKS="swift (<< 5.8)"
|
||||
TERMUX_SUBPKG_REPLACES="swift (<< 5.8)"
|
|
@ -2,20 +2,6 @@ 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
|
||||
@@ -1652,6 +1688,13 @@ for host in "${ALL_HOSTS[@]}"; do
|
||||
-DLLVM_NATIVE_BUILD=$(build_directory "${LOCAL_HOST}" llvm)
|
||||
)
|
||||
cmake_options+=("${SWIFT_TARGET_CMAKE_OPTIONS[@]}")
|
||||
+ cmake_options+=(
|
||||
+ -DCMAKE_CXX_FLAGS="$CXXFLAGS --target=$CCTERMUX_HOST_PLATFORM $CPPFLAGS"
|
||||
+ -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS --target=$CCTERMUX_HOST_PLATFORM"
|
||||
+ -DCMAKE_FIND_ROOT_PATH:PATH="${CROSS_COMPILE_DEPS_PATH}"
|
||||
+ -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
|
||||
+ -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
|
||||
+ )
|
||||
fi
|
||||
|
||||
;;
|
||||
@@ -1854,6 +1854,9 @@ for host in "${ALL_HOSTS[@]}"; do
|
||||
"${cmake_options[@]}"
|
||||
-DLLVM_TABLEGEN=$(build_directory "${LOCAL_HOST}" llvm)/bin/llvm-tblgen
|
||||
|
@ -27,9 +13,9 @@ index b1d060328bc..218c9215260 100755
|
|||
fi
|
||||
|
||||
@@ -2035,6 +2035,7 @@ for host in "${ALL_HOSTS[@]}"; do
|
||||
-DSWIFT_TOOLS_ENABLE_LTO:STRING="${SWIFT_TOOLS_ENABLE_LTO}"
|
||||
-DSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER:BOOL=$(true_false "${BUILD_RUNTIME_WITH_HOST_COMPILER}")
|
||||
-DLIBDISPATCH_CMAKE_BUILD_TYPE:STRING="${LIBDISPATCH_BUILD_TYPE}"
|
||||
-DSWIFT_PATH_TO_SWIFT_SYNTAX_SOURCE:PATH="${SWIFT_SYNTAX_SOURCE_DIR}"
|
||||
+ -DSWIFT_CLANG_RESOURCE_DIR_SYMLINK_INSTALL_TARGET:STRING="../clang/${TERMUX_CLANG_VERSION}"
|
||||
"${swift_cmake_options[@]}"
|
||||
)
|
||||
|
|
|
@ -2,7 +2,7 @@ diff --git a/swift/utils/swift_build_support/swift_build_support/targets.py b/sw
|
|||
index 7ebcdc070c1..5a6ed88182e 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/targets.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/targets.py
|
||||
@@ -166,6 +166,7 @@ class AndroidPlatform(Platform):
|
||||
@@ -158,6 +158,7 @@ class AndroidPlatform(Platform):
|
||||
|
||||
flags += '-sdk %s/sysroot ' % (android_toolchain_path)
|
||||
flags += '-tools-directory %s/bin' % (android_toolchain_path)
|
||||
|
@ -10,7 +10,12 @@ index 7ebcdc070c1..5a6ed88182e 100644
|
|||
return flags
|
||||
|
||||
def cmake_options(self, args):
|
||||
@@ -174,8 +175,7 @@ class AndroidPlatform(Platform):
|
||||
@@ -167,12 +168,11 @@ class AndroidPlatform(Platform):
|
||||
options.define('CMAKE_SYSTEM_PROCESSOR', args.android_arch if not
|
||||
args.android_arch == 'armv7'
|
||||
else 'armv7-a')
|
||||
- options.define('CMAKE_ANDROID_NDK:PATH', args.android_ndk)
|
||||
+ options.define('CMAKE_ANDROID_STANDALONE_TOOLCHAIN:PATH', args.android_ndk)
|
||||
return options
|
||||
|
||||
def ndk_toolchain_path(self, args):
|
||||
|
@ -20,7 +25,7 @@ index 7ebcdc070c1..5a6ed88182e 100644
|
|||
|
||||
def swiftpm_config(self, args, output_dir, swift_toolchain, resource_path):
|
||||
config_file = '%s/swiftpm-android-%s.json' % (output_dir, args.android_arch)
|
||||
@@ -203,6 +203,7 @@ class AndroidPlatform(Platform):
|
||||
@@ -196,6 +196,7 @@ class AndroidPlatform(Platform):
|
||||
spm_json += ' "-tools-directory", "%s/bin",\n' % (
|
||||
self.ndk_toolchain_path(args))
|
||||
spm_json += ' "-Xcc", "-I%s/usr/include",\n' % args.cross_compile_deps_path
|
||||
|
|
|
@ -1,324 +0,0 @@
|
|||
commit e3a61c0c348646993d129bc39d13c938da3017b3
|
||||
Author: Saleem Abdulrasool <compnerd@compnerd.org>
|
||||
Date: Tue Aug 16 13:04:44 2022 -0700
|
||||
|
||||
Build: initial pass to support static archives on Windows (#5720)
|
||||
|
||||
Introduce a SPM controlled build rule for building static libraries.
|
||||
This is the intended way to use llbuild to drive the generation of
|
||||
static libraries. We would previously rely on the static default
|
||||
rule intended for testing to generate the static libraries. Not only
|
||||
did this tool not properly support Windows, it would actually cause
|
||||
problems on macOS due to the use of `ar` for the creation of the library
|
||||
over the preferred tool - `libtool`. We now locally determine the
|
||||
correct rule and generate the command.
|
||||
|
||||
This is incomplete support for Windows and in fact regresses
|
||||
functionality. We no longer honour `AR` as an environment variable on
|
||||
Windows and thus cannot switch the implementation of the librarian. We
|
||||
now drive the archiving through `lld-link` unconditionally while we
|
||||
should prefer `link` unless otherwise requested. This is covered as
|
||||
an issue in #5719.
|
||||
|
||||
diff --git a/swiftpm/Sources/Build/BuildPlan.swift b/swiftpm/Sources/Build/BuildPlan.swift
|
||||
index 23aedc70..a70003b5 100644
|
||||
--- a/swiftpm/Sources/Build/BuildPlan.swift
|
||||
+++ b/swiftpm/Sources/Build/BuildPlan.swift
|
||||
@@ -1344,6 +1344,19 @@ public final class ProductBuildDescription {
|
||||
}
|
||||
}
|
||||
|
||||
+ /// The arguments to the librarian to create a static library.
|
||||
+ public func archiveArguments() throws -> [String] {
|
||||
+ let librarian = buildParameters.toolchain.librarianPath.pathString
|
||||
+ let triple = buildParameters.triple
|
||||
+ if triple.isWindows(), librarian.hasSuffix("link") || librarian.hasSuffix("link.exe") {
|
||||
+ return [librarian, "/LIB", "/OUT:\(binary.pathString)", "@\(linkFileListPath.pathString)"]
|
||||
+ }
|
||||
+ if triple.isDarwin(), librarian.hasSuffix("libtool") {
|
||||
+ return [librarian, "-o", binary.pathString, "@\(linkFileListPath.pathString)"]
|
||||
+ }
|
||||
+ return [librarian, "crs", binary.pathString, "@\(linkFileListPath.pathString)"]
|
||||
+ }
|
||||
+
|
||||
/// The arguments to link and create this product.
|
||||
public func linkArguments() throws -> [String] {
|
||||
var args = [buildParameters.toolchain.swiftCompilerPath.pathString]
|
||||
diff --git a/swiftpm/Sources/Build/LLBuildManifestBuilder.swift b/swiftpm/Sources/Build/LLBuildManifestBuilder.swift
|
||||
index 4ca69495..47a4d0dc 100644
|
||||
--- a/swiftpm/Sources/Build/LLBuildManifestBuilder.swift
|
||||
+++ b/swiftpm/Sources/Build/LLBuildManifestBuilder.swift
|
||||
@@ -853,14 +853,17 @@ extension LLBuildManifestBuilder {
|
||||
private func createProductCommand(_ buildProduct: ProductBuildDescription) throws {
|
||||
let cmdName = try buildProduct.product.getCommandName(config: buildConfig)
|
||||
|
||||
- // Create archive tool for static library and shell tool for rest of the products.
|
||||
- if buildProduct.product.type == .library(.static) {
|
||||
- manifest.addArchiveCmd(
|
||||
+ switch buildProduct.product.type {
|
||||
+ case .library(.static):
|
||||
+ manifest.addShellCmd(
|
||||
name: cmdName,
|
||||
+ description: "Archiving \(buildProduct.binary.prettyPath())",
|
||||
inputs: buildProduct.objects.map(Node.file),
|
||||
- outputs: [.file(buildProduct.binary)]
|
||||
+ outputs: [.file(buildProduct.binary)],
|
||||
+ arguments: try buildProduct.archiveArguments()
|
||||
)
|
||||
- } else {
|
||||
+
|
||||
+ default:
|
||||
let inputs = buildProduct.objects + buildProduct.dylibs.map({ $0.binary })
|
||||
|
||||
manifest.addShellCmd(
|
||||
diff --git a/swiftpm/Sources/LLBuildManifest/BuildManifest.swift b/swiftpm/Sources/LLBuildManifest/BuildManifest.swift
|
||||
index dde10b7d..77e3a114 100644
|
||||
--- a/swiftpm/Sources/LLBuildManifest/BuildManifest.swift
|
||||
+++ b/swiftpm/Sources/LLBuildManifest/BuildManifest.swift
|
||||
@@ -88,16 +88,6 @@ public struct BuildManifest {
|
||||
commands[name] = Command(name: name, tool: tool)
|
||||
}
|
||||
|
||||
- public mutating func addArchiveCmd(
|
||||
- name: String,
|
||||
- inputs: [Node],
|
||||
- outputs: [Node]
|
||||
- ) {
|
||||
- assert(commands[name] == nil, "already had a command named '\(name)'")
|
||||
- let tool = ArchiveTool(inputs: inputs, outputs: outputs)
|
||||
- commands[name] = Command(name: name, tool: tool)
|
||||
- }
|
||||
-
|
||||
public mutating func addShellCmd(
|
||||
name: String,
|
||||
description: String,
|
||||
diff --git a/swiftpm/Sources/PackageModel/Toolchain.swift b/swiftpm/Sources/PackageModel/Toolchain.swift
|
||||
index 1c2b34ed..c932742f 100644
|
||||
--- a/swiftpm/Sources/PackageModel/Toolchain.swift
|
||||
+++ b/swiftpm/Sources/PackageModel/Toolchain.swift
|
||||
@@ -13,6 +13,9 @@
|
||||
import TSCBasic
|
||||
|
||||
public protocol Toolchain {
|
||||
+ /// Path of the librarian.
|
||||
+ var librarianPath: AbsolutePath { get }
|
||||
+
|
||||
/// Path of the `swiftc` compiler.
|
||||
var swiftCompilerPath: AbsolutePath { get }
|
||||
|
||||
diff --git a/swiftpm/Sources/PackageModel/ToolchainConfiguration.swift b/swiftpm/Sources/PackageModel/ToolchainConfiguration.swift
|
||||
index 00968aa8..7e377e29 100644
|
||||
--- a/swiftpm/Sources/PackageModel/ToolchainConfiguration.swift
|
||||
+++ b/swiftpm/Sources/PackageModel/ToolchainConfiguration.swift
|
||||
@@ -18,6 +18,9 @@ import TSCBasic
|
||||
/// These requirements are abstracted out to make it easier to add support for
|
||||
/// using the package manager with alternate toolchains in the future.
|
||||
public struct ToolchainConfiguration {
|
||||
+ /// The path of the librarian.
|
||||
+ public var librarianPath: AbsolutePath
|
||||
+
|
||||
/// The path of the swift compiler.
|
||||
public var swiftCompilerPath: AbsolutePath
|
||||
|
||||
@@ -43,13 +46,15 @@ public struct ToolchainConfiguration {
|
||||
/// Creates the set of manifest resources associated with a `swiftc` executable.
|
||||
///
|
||||
/// - Parameters:
|
||||
- /// - swiftCompilerPath: The absolute path of the associated swift compiler executable (`swiftc`).
|
||||
+ /// - librarianPath: The absolute path to the librarian
|
||||
+ /// - swiftCompilerPath: The absolute path of the associated swift compiler executable (`swiftc`).
|
||||
/// - swiftCompilerFlags: Extra flags to pass to the Swift compiler.
|
||||
/// - swiftCompilerEnvironment: Environment variables to pass to the Swift compiler.
|
||||
/// - swiftPMLibrariesRootPath: Custom path for SwiftPM libraries. Computed based on the compiler path by default.
|
||||
/// - sdkRootPath: Optional path to SDK root.
|
||||
/// - xctestPath: Optional path to XCTest.
|
||||
public init(
|
||||
+ librarianPath: AbsolutePath,
|
||||
swiftCompilerPath: AbsolutePath,
|
||||
swiftCompilerFlags: [String] = [],
|
||||
swiftCompilerEnvironment: EnvironmentVariables = .process(),
|
||||
@@ -61,6 +66,7 @@ public struct ToolchainConfiguration {
|
||||
return .init(swiftCompilerPath: swiftCompilerPath)
|
||||
}()
|
||||
|
||||
+ self.librarianPath = librarianPath
|
||||
self.swiftCompilerPath = swiftCompilerPath
|
||||
self.swiftCompilerFlags = swiftCompilerFlags
|
||||
self.swiftCompilerEnvironment = swiftCompilerEnvironment
|
||||
diff --git a/swiftpm/Sources/PackageModel/UserToolchain.swift b/swiftpm/Sources/PackageModel/UserToolchain.swift
|
||||
index a5248401..1e1c0bb6 100644
|
||||
--- a/swiftpm/Sources/PackageModel/UserToolchain.swift
|
||||
+++ b/swiftpm/Sources/PackageModel/UserToolchain.swift
|
||||
@@ -28,6 +28,9 @@ public final class UserToolchain: Toolchain {
|
||||
/// The toolchain configuration.
|
||||
private let configuration: ToolchainConfiguration
|
||||
|
||||
+ /// Path of the librarian.
|
||||
+ public let librarianPath: AbsolutePath
|
||||
+
|
||||
/// Path of the `swiftc` compiler.
|
||||
public let swiftCompilerPath: AbsolutePath
|
||||
|
||||
@@ -113,6 +116,43 @@ public final class UserToolchain: Toolchain {
|
||||
|
||||
// MARK: - public API
|
||||
|
||||
+ public static func determineLibrarian(triple: Triple, binDir: AbsolutePath,
|
||||
+ useXcrun: Bool,
|
||||
+ environment: EnvironmentVariables,
|
||||
+ searchPaths: [AbsolutePath]) throws
|
||||
+ -> AbsolutePath {
|
||||
+ let variable: String = triple.isDarwin() ? "LIBTOOL" : "AR"
|
||||
+ let tool: String = {
|
||||
+ if triple.isDarwin() { return "libtool" }
|
||||
+ if triple.isWindows() {
|
||||
+ if let librarian: AbsolutePath =
|
||||
+ UserToolchain.lookup(variable: "AR",
|
||||
+ searchPaths: searchPaths,
|
||||
+ environment: environment) {
|
||||
+ return librarian.basename
|
||||
+ }
|
||||
+ // TODO(5719) use `lld-link` if the build requests lld.
|
||||
+ return "link"
|
||||
+ }
|
||||
+ // TODO(compnerd) consider defaulting to `llvm-ar` universally with
|
||||
+ // a fallback to `ar`.
|
||||
+ return triple.isAndroid() ? "llvm-ar" : "ar"
|
||||
+ }()
|
||||
+
|
||||
+ if let librarian: AbsolutePath = UserToolchain.lookup(variable: variable,
|
||||
+ searchPaths: searchPaths,
|
||||
+ environment: environment) {
|
||||
+ if localFileSystem.isExecutableFile(librarian) {
|
||||
+ return librarian
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if let librarian = try? UserToolchain.getTool(tool, binDir: binDir) {
|
||||
+ return librarian
|
||||
+ }
|
||||
+ return try UserToolchain.findTool(tool, envSearchPaths: searchPaths, useXcrun: useXcrun)
|
||||
+ }
|
||||
+
|
||||
/// Determines the Swift compiler paths for compilation and manifest parsing.
|
||||
public static func determineSwiftCompilers(binDir: AbsolutePath, useXcrun: Bool, environment: EnvironmentVariables, searchPaths: [AbsolutePath]) throws -> SwiftCompilers {
|
||||
func validateCompiler(at path: AbsolutePath?) throws {
|
||||
@@ -339,6 +379,8 @@ public final class UserToolchain: Toolchain {
|
||||
// Use the triple from destination or compute the host triple using swiftc.
|
||||
var triple = destination.target ?? Triple.getHostTriple(usingSwiftCompiler: swiftCompilers.compile)
|
||||
|
||||
+ self.librarianPath = try UserToolchain.determineLibrarian(triple: triple, binDir: binDir, useXcrun: useXcrun, environment: environment, searchPaths: envSearchPaths)
|
||||
+
|
||||
// Change the triple to the specified arch if there's exactly one of them.
|
||||
// The Triple property is only looked at by the native build system currently.
|
||||
if archs.count == 1 {
|
||||
@@ -400,6 +442,7 @@ public final class UserToolchain: Toolchain {
|
||||
}
|
||||
|
||||
self.configuration = .init(
|
||||
+ librarianPath: librarianPath,
|
||||
swiftCompilerPath: swiftCompilers.manifest,
|
||||
swiftCompilerFlags: self.extraSwiftCFlags,
|
||||
swiftCompilerEnvironment: environment,
|
||||
diff --git a/swiftpm/Tests/BuildTests/BuildPlanTests.swift b/swiftpm/Tests/BuildTests/BuildPlanTests.swift
|
||||
index 166667d4..804bd5a0 100644
|
||||
--- a/swiftpm/Tests/BuildTests/BuildPlanTests.swift
|
||||
+++ b/swiftpm/Tests/BuildTests/BuildPlanTests.swift
|
||||
@@ -3227,6 +3227,77 @@ final class BuildPlanTests: XCTestCase {
|
||||
"""))
|
||||
}
|
||||
|
||||
+ func testArchiving() throws {
|
||||
+ let fs = InMemoryFileSystem(emptyFiles:
|
||||
+ "/Package/Sources/rary/rary.swift"
|
||||
+ )
|
||||
+
|
||||
+ let observability = ObservabilitySystem.makeForTesting()
|
||||
+ let graph = try loadPackageGraph(
|
||||
+ fileSystem: fs,
|
||||
+ manifests: [
|
||||
+ Manifest.createRootManifest(
|
||||
+ name: "Package",
|
||||
+ path: .init("/Package"),
|
||||
+ products: [
|
||||
+ ProductDescription(name: "rary", type: .library(.static), targets: ["rary"]),
|
||||
+ ],
|
||||
+ targets: [
|
||||
+ TargetDescription(name: "rary", dependencies: []),
|
||||
+ ]
|
||||
+ ),
|
||||
+ ],
|
||||
+ observabilityScope: observability.topScope
|
||||
+ )
|
||||
+ XCTAssertNoDiagnostics(observability.diagnostics)
|
||||
+
|
||||
+ let result = try BuildPlanResult(plan: BuildPlan(
|
||||
+ buildParameters: mockBuildParameters(),
|
||||
+ graph: graph,
|
||||
+ fileSystem: fs,
|
||||
+ observabilityScope: observability.topScope
|
||||
+ ))
|
||||
+
|
||||
+ let buildPath: AbsolutePath = result.plan.buildParameters.dataPath.appending(components: "debug")
|
||||
+
|
||||
+ let yaml = fs.tempDirectory.appending(components: UUID().uuidString, "debug.yaml")
|
||||
+ try fs.createDirectory(yaml.parentDirectory, recursive: true)
|
||||
+
|
||||
+ let llbuild = LLBuildManifestBuilder(result.plan, fileSystem: fs, observabilityScope: observability.topScope)
|
||||
+ try llbuild.generateManifest(at: yaml)
|
||||
+
|
||||
+ let contents: String = try fs.readFileContents(yaml)
|
||||
+
|
||||
+ if result.plan.buildParameters.triple.isWindows() {
|
||||
+ XCTAssertMatch(contents, .contains("""
|
||||
+ "C.rary-debug.a":
|
||||
+ tool: shell
|
||||
+ inputs: ["\(buildPath.appending(components: "rary.build", "rary.swift.o").escapedPathString())","\(buildPath.appending(components: "rary.build", "rary.swiftmodule.o").escapedPathString())"]
|
||||
+ outputs: ["\(buildPath.appending(components: "library.a").escapedPathString())"]
|
||||
+ description: "Archiving \(buildPath.appending(components: "library.a").escapedPathString())"
|
||||
+ args: ["\(result.plan.buildParameters.toolchain.librarianPath.escapedPathString())","/LIB","/OUT:\(buildPath.appending(components: "library.a").escapedPathString())","@\(buildPath.appending(components: "rary.product", "Objects.LinkFileList").escapedPathString())"]
|
||||
+ """))
|
||||
+ } else if result.plan.buildParameters.triple.isDarwin() {
|
||||
+ XCTAssertMatch(contents, .contains("""
|
||||
+ "C.rary-debug.a":
|
||||
+ tool: shell
|
||||
+ inputs: ["\(buildPath.appending(components: "rary.build", "rary.swift.o").escapedPathString())"]
|
||||
+ outputs: ["\(buildPath.appending(components: "library.a").escapedPathString())"]
|
||||
+ description: "Archiving \(buildPath.appending(components: "library.a").escapedPathString())"
|
||||
+ args: ["\(result.plan.buildParameters.toolchain.librarianPath.escapedPathString())","-o","\(buildPath.appending(components: "library.a").escapedPathString())","@\(buildPath.appending(components: "rary.product", "Objects.LinkFileList").escapedPathString())"]
|
||||
+ """))
|
||||
+ } else { // assume Unix `ar` is the librarian
|
||||
+ XCTAssertMatch(contents, .contains("""
|
||||
+ "C.rary-debug.a":
|
||||
+ tool: shell
|
||||
+ inputs: ["\(buildPath.appending(components: "rary.build", "rary.swift.o").escapedPathString())","\(buildPath.appending(components: "rary.build", "rary.swiftmodule.o").escapedPathString())"]
|
||||
+ outputs: ["\(buildPath.appending(components: "library.a").escapedPathString())"]
|
||||
+ description: "Archiving \(buildPath.appending(components: "library.a").escapedPathString())"
|
||||
+ args: ["\(result.plan.buildParameters.toolchain.librarianPath.escapedPathString())","crs","\(buildPath.appending(components: "library.a").escapedPathString())","@\(buildPath.appending(components: "rary.product", "Objects.LinkFileList").escapedPathString())"]
|
||||
+ """))
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
func testSwiftBundleAccessor() throws {
|
||||
// This has a Swift and ObjC target in the same package.
|
||||
let fs = InMemoryFileSystem(emptyFiles:
|
||||
diff --git a/swiftpm/Tests/BuildTests/MockBuildTestHelper.swift b/swiftpm/Tests/BuildTests/MockBuildTestHelper.swift
|
||||
index 90e9ec6d..e91ce847 100644
|
||||
--- a/swiftpm/Tests/BuildTests/MockBuildTestHelper.swift
|
||||
+++ b/swiftpm/Tests/BuildTests/MockBuildTestHelper.swift
|
||||
@@ -7,6 +7,15 @@ import TSCBasic
|
||||
import XCTest
|
||||
|
||||
struct MockToolchain: PackageModel.Toolchain {
|
||||
+#if os(Windows)
|
||||
+ let librarianPath = AbsolutePath("/fake/path/to/link.exe")
|
||||
+#elseif os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
|
||||
+ let librarianPath = AbsolutePath("/fake/path/to/libtool")
|
||||
+#elseif os(Android)
|
||||
+ let librarianPath = AbsolutePath("/fake/path/to/llvm-ar")
|
||||
+#else
|
||||
+ let librarianPath = AbsolutePath("/fake/path/to/ar")
|
||||
+#endif
|
||||
let swiftCompilerPath = AbsolutePath("/fake/path/to/swiftc")
|
||||
let extraCCFlags: [String] = []
|
||||
let extraSwiftCFlags: [String] = []
|
|
@ -0,0 +1,26 @@
|
|||
diff --git a/sourcekit-lsp/Utilities/build-script-helper.py b/sourcekit-lsp/Utilities/build-script-helper.py
|
||||
index 17ad9e3..953fffd 100755
|
||||
--- a/sourcekit-lsp/Utilities/build-script-helper.py
|
||||
+++ b/sourcekit-lsp/Utilities/build-script-helper.py
|
||||
@@ -142,6 +142,7 @@ def get_swiftpm_options(swift_exec: str, args: argparse.Namespace) -> List[str]:
|
||||
elif re.match('android-', args.cross_compile_host):
|
||||
print('Cross-compiling for %s' % args.cross_compile_host)
|
||||
swiftpm_args += ['--destination', args.cross_compile_config]
|
||||
+ swiftpm_args += ['--pkg-config-path', os.path.join(os.path.split(args.cross_compile_config)[0], 'lib/pkgconfig')]
|
||||
else:
|
||||
fatal_error("cannot cross-compile for %s" % args.cross_compile_host)
|
||||
|
||||
diff --git a/swiftpm/Utilities/bootstrap b/swiftpm/Utilities/bootstrap
|
||||
index 085056de..1ded1a90 100755
|
||||
--- a/swiftpm/Utilities/bootstrap
|
||||
+++ b/swiftpm/Utilities/bootstrap
|
||||
@@ -820,6 +820,9 @@ def get_swiftpm_flags(args):
|
||||
build_flags.extend(["-Xcc", "-I/usr/local/include"])
|
||||
build_flags.extend(["-Xlinker", "-L/usr/local/lib"])
|
||||
|
||||
+ if args.cross_compile_hosts and re.match('android-', args.cross_compile_hosts):
|
||||
+ build_flags.extend(["--pkg-config-path", os.path.join(os.path.split(args.cross_compile_config)[0], "lib/pkgconfig")])
|
||||
+
|
||||
# On ELF platforms, remove the host toolchain's stdlib absolute rpath from
|
||||
# installed executables and shared libraries.
|
||||
if platform.system() != "Darwin" and args.command == 'install':
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
if [ x"$native_triple" != x"$swift_runtime_triple" ]; then
|
||||
install_path=$install_path/$swift_runtime_triple
|
||||
fi
|
||||
install_path=$install_path/lib
|
||||
|
||||
for so in Foundation FoundationNetworking FoundationXML XCTest swiftCore swiftDispatch \
|
||||
swiftDistributed swiftGlibc swiftRegexBuilder swiftRemoteMirror swiftSwiftOnoneSupport \
|
||||
swift_Concurrency swift_Differentiation swift_RegexParser swift_StringProcessing
|
||||
do
|
||||
@COMMAND@
|
||||
done
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,20 @@
|
|||
#!@TERMUX_PREFIX@/bin/sh
|
||||
|
||||
pkg_format="@TERMUX_PACKAGE_FORMAT@"
|
||||
pkg_arch=unknown
|
||||
case "$pkg_format" in
|
||||
debian ) pkg_arch=$(dpkg --print-architecture) ;;
|
||||
pacman ) pkg_arch=$(pacman-conf Architecture) ;;
|
||||
* ) echo "Warning: unknown package format: $pkg_format" ;;
|
||||
esac
|
||||
native_triple=unknown
|
||||
case "$pkg_arch" in
|
||||
aarch64 ) native_triple=aarch64-linux-android ;;
|
||||
arm ) native_triple=arm-linux-androideabi ;;
|
||||
i686 ) native_triple=i686-linux-android ;;
|
||||
x86_64 ) native_triple=x86_64-linux-android ;;
|
||||
* ) echo "Warning: unknown arch: $pkg_arch" ;;
|
||||
esac
|
||||
|
||||
swift_runtime_triple=@SWIFT_TRIPLE@
|
||||
install_path=@TERMUX_PREFIX@
|
|
@ -19,7 +19,7 @@ termux_setup_swift() {
|
|||
termux_download \
|
||||
https://download.swift.org/swift-$TERMUX_SWIFT_VERSION-release/ubuntu2204/swift-$TERMUX_SWIFT_VERSION-$SWIFT_RELEASE/$SWIFT_BIN.tar.gz \
|
||||
$SWIFT_TAR \
|
||||
312a18d0d2f207620349e3a373200f369fc1a6aad1b7f2365d55aa8a10881a59
|
||||
352575d5f14d59978d27449b61ca4d6e5f638b83258fac0d66cd7d99034e2760
|
||||
|
||||
(cd $TERMUX_PKG_TMPDIR ; tar xf $SWIFT_TAR ; mv $SWIFT_BIN $SWIFT_FOLDER; rm $SWIFT_TAR)
|
||||
fi
|
||||
|
|
|
@ -60,6 +60,13 @@ termux_create_debian_subpackages() {
|
|||
[ "$TERMUX_SUBPKG_PLATFORM_INDEPENDENT" = "true" ] && SUB_PKG_ARCH=all
|
||||
|
||||
cd "$SUB_PKG_DIR/massage"
|
||||
# Check that files were actually installed, else don't subpackage.
|
||||
if [ "$(find . -type f -print | head -n1)" = "" ]; then
|
||||
echo "No files in subpackage '$SUB_PKG_NAME' when built for $SUB_PKG_ARCH with package '$TERMUX_PKG_NAME', so"
|
||||
echo "the subpackage was not created. If unexpected, check to make sure the files are where you expect."
|
||||
cd "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX"
|
||||
continue
|
||||
fi
|
||||
local SUB_PKG_INSTALLSIZE
|
||||
SUB_PKG_INSTALLSIZE=$(du -sk . | cut -f 1)
|
||||
tar -cJf "$SUB_PKG_PACKAGE_DIR/data.tar.xz" .
|
||||
|
|
|
@ -57,6 +57,13 @@ termux_create_pacman_subpackages() {
|
|||
[ "$TERMUX_SUBPKG_PLATFORM_INDEPENDENT" = "true" ] && SUB_PKG_ARCH=any
|
||||
|
||||
cd "$SUB_PKG_DIR/massage"
|
||||
# Check that files were actually installed, else don't subpackage.
|
||||
if [ "$(find . -type f -print | head -n1)" = "" ]; then
|
||||
echo "No files in subpackage '$SUB_PKG_NAME' when built for $SUB_PKG_ARCH with package '$TERMUX_PKG_NAME', so"
|
||||
echo "the subpackage was not created. If unexpected, check to make sure the files are where you expect."
|
||||
cd "$TERMUX_PKG_MASSAGEDIR/$TERMUX_PREFIX"
|
||||
continue
|
||||
fi
|
||||
local SUB_PKG_INSTALLSIZE
|
||||
SUB_PKG_INSTALLSIZE=$(du -bs . | cut -f 1)
|
||||
|
||||
|
|
|
@ -76,6 +76,9 @@ termux_step_setup_variables() {
|
|||
export prefix=${TERMUX_PREFIX}
|
||||
export PREFIX=${TERMUX_PREFIX}
|
||||
|
||||
# Explicitly export in case the default was set.
|
||||
export TERMUX_ARCH=${TERMUX_ARCH}
|
||||
|
||||
if [ "${TERMUX_PACKAGES_OFFLINE-false}" = "true" ]; then
|
||||
# In "offline" mode store/pick cache from directory with
|
||||
# build.sh script.
|
||||
|
|
|
@ -43,6 +43,10 @@ def parse_build_file_dependencies_with_vars(path, vars):
|
|||
for dependency_value in re.split(',|\\|', dependencies_string):
|
||||
# Replace parenthesis to ignore version qualifiers as in "gcc (>= 5.0)":
|
||||
dependency_value = re.sub(r'\(.*?\)', '', dependency_value).strip()
|
||||
arch = os.getenv('TERMUX_ARCH')
|
||||
if arch == "x86_64":
|
||||
arch = "x86-64"
|
||||
dependency_value = re.sub(r'\${TERMUX_ARCH/_/-}', arch, dependency_value)
|
||||
|
||||
dependencies.append(dependency_value)
|
||||
|
||||
|
|
Loading…
Reference in New Issue