termux-packages/packages/swift/swift-android-spawn.patch

79 lines
3.7 KiB
Diff
Raw Normal View History

2022-02-08 20:48:18 +01:00
diff --git a/llbuild/lib/llvm/Support/CMakeLists.txt b/llbuild/lib/llvm/Support/CMakeLists.txt
index 8e79e18..a844183 100644
--- a/llbuild/lib/llvm/Support/CMakeLists.txt
+++ b/llbuild/lib/llvm/Support/CMakeLists.txt
@@ -65,5 +65,5 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Android|Darwin|Linux")
- target_link_libraries(llvmSupport PRIVATE curses)
+ target_link_libraries(llvmSupport PRIVATE android-spawn curses)
endif()
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.
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
+++ b/swift-corelibs-foundation/Sources/Foundation/CMakeLists.txt
@@ -166,6 +166,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL Windows)
$<TARGET_OBJECTS:CoreFoundationResources>)
elseif(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
target_link_options(Foundation PRIVATE "SHELL:-no-toolchain-stdlib-rpath")
+ if(${CMAKE_SYSTEM_NAME} STREQUAL Android)
+ target_link_libraries(Foundation PRIVATE android-spawn)
+ if(CMAKE_FIND_ROOT_PATH)
+ target_include_directories(Foundation PUBLIC ${CMAKE_FIND_ROOT_PATH}/usr/include)
+ target_link_directories(Foundation PUBLIC ${CMAKE_FIND_ROOT_PATH}/usr/lib)
+ endif()
+ endif()
endif()
diff --git a/swift-driver/Utilities/build-script-helper.py b/swift-driver/Utilities/build-script-helper.py
index 18f22fb0..bc2b1308 100755
--- a/swift-driver/Utilities/build-script-helper.py
+++ b/swift-driver/Utilities/build-script-helper.py
@@ -103,6 +103,7 @@ def get_swiftpm_options(args):
if 'ANDROID_DATA' in os.environ or (args.cross_compile_hosts and re.match(
'android-', args.cross_compile_hosts[0])):
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-tools-support-core/Sources/TSCBasic/CMakeLists.txt b/swift-tools-support-core/Sources/TSCBasic/CMakeLists.txt
index bbc43d98..bc5ee576 100644
--- a/swift-tools-support-core/Sources/TSCBasic/CMakeLists.txt
+++ b/swift-tools-support-core/Sources/TSCBasic/CMakeLists.txt
@@ -53,7 +53,7 @@ target_link_libraries(TSCBasic PUBLIC
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
if(Foundation_FOUND)
target_link_libraries(TSCBasic PUBLIC
- Foundation)
+ Foundation android-spawn)
endif()
endif()
target_link_libraries(TSCBasic PRIVATE
diff --git a/swiftpm/Utilities/bootstrap b/swiftpm/Utilities/bootstrap
index 085056de..1ded1a90 100755
--- a/swiftpm/Utilities/bootstrap
+++ b/swiftpm/Utilities/bootstrap
@@ -764,6 +764,7 @@ def get_swiftpm_flags(args):
if 'ANDROID_DATA' in os.environ or (args.cross_compile_hosts and re.match(
'android-', args.cross_compile_hosts)):
build_flags.extend(["-Xswiftc", "-Xcc", "-Xswiftc", "-U_GNU_SOURCE"])
+ build_flags.extend(["-Xlinker", "-landroid-spawn"])
if platform.system() == "OpenBSD":
build_flags.extend(["-Xcc", "-I/usr/local/include"])