forked from finagolfin/swift-android-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
swift-android-foundation-except-release.patch
94 lines (93 loc) · 4.15 KB
/
swift-android-foundation-except-release.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
diff --git a/swift/utils/build-script-impl b/swift/utils/build-script-impl
index 16e05052609..7ab8cebfab8 100755
--- a/swift/utils/build-script-impl
+++ b/swift/utils/build-script-impl
@@ -2622,6 +2622,7 @@ for host in "${ALL_HOSTS[@]}"; do
echo "Cleaning the libdispatch build directory"
call rm -rf "${LIBDISPATCH_BUILD_DIR}"
fi
+ call ln -sf "${SWIFT_BUILD_PATH}/lib/swift" "${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib"
cmake_options=(
-DENABLE_SWIFT=YES
diff --git a/swift-corelibs-foundation/Package.swift b/swift-corelibs-foundation/Package.swift
index 2b5b5e05..60f1dde8 100644
--- a/swift-corelibs-foundation/Package.swift
+++ b/swift-corelibs-foundation/Package.swift
@@ -245,7 +245,8 @@ let package = Package(
"BlockRuntime",
"CMakeLists.txt"
],
- cSettings: coreFoundationBuildSettings
+ cSettings: coreFoundationBuildSettings,
+ linkerSettings: [.linkedLibrary("log", .when(platforms: [.android]))]
),
.target(
name: "BlocksRuntime",
@@ -262,7 +263,7 @@ let package = Package(
name: "_CFXMLInterface",
dependencies: [
"CoreFoundation",
- .target(name: "Clibxml2", condition: .when(platforms: [.linux])),
+ .target(name: "Clibxml2", condition: .when(platforms: [.linux, .android])),
],
path: "Sources/_CFXMLInterface",
exclude: [
@@ -275,7 +276,7 @@ let package = Package(
name: "_CFURLSessionInterface",
dependencies: [
"CoreFoundation",
- .target(name: "Clibcurl", condition: .when(platforms: [.linux])),
+ .target(name: "Clibcurl", condition: .when(platforms: [.linux, .android])),
],
path: "Sources/_CFURLSessionInterface",
exclude: [
@@ -348,7 +349,7 @@ let package = Package(
"FoundationNetworking",
"XCTest",
"Testing",
- .target(name: "xdgTestHelper", condition: .when(platforms: [.linux]))
+ .target(name: "xdgTestHelper", condition: .when(platforms: [.linux, .android]))
],
resources: [
.copy("Foundation/Resources")
diff --git a/swift-corelibs-foundation/Sources/Foundation/NSPathUtilities.swift b/swift-corelibs-foundation/Sources/Foundation/NSPathUtilities.swift
index 8043ef00..23b602f6 100644
--- a/swift-corelibs-foundation/Sources/Foundation/NSPathUtilities.swift
+++ b/swift-corelibs-foundation/Sources/Foundation/NSPathUtilities.swift
@@ -10,6 +10,8 @@
@_implementationOnly import CoreFoundation
#if os(Windows)
import WinSDK
+#elseif canImport(Android)
+import Android
#elseif os(WASI)
import WASILibc
#endif
diff --git a/swift-corelibs-foundation/Sources/Foundation/Process.swift b/swift-corelibs-foundation/Sources/Foundation/Process.swift
index 758dd1df..02970992 100644
--- a/swift-corelibs-foundation/Sources/Foundation/Process.swift
+++ b/swift-corelibs-foundation/Sources/Foundation/Process.swift
@@ -927,8 +927,8 @@ open class Process: NSObject, @unchecked Sendable {
}
let useFallbackChdir: Bool
if let dir = currentDirectoryURL?.path {
- let chdirResult = _CFPosixSpawnFileActionsChdir(fileActions, dir)
- useFallbackChdir = chdirResult == ENOSYS
+ // let chdirResult = _CFPosixSpawnFileActionsChdir(fileActions, dir)
+ useFallbackChdir = true ; let chdirResult = ENOSYS
if !useFallbackChdir {
try _throwIfPosixError(chdirResult)
}
diff --git a/swift-corelibs-foundation/Sources/Testing/Testing.swift b/swift-corelibs-foundation/Sources/Testing/Testing.swift
index 712d9dee..2483c14e 100644
--- a/swift-corelibs-foundation/Sources/Testing/Testing.swift
+++ b/swift-corelibs-foundation/Sources/Testing/Testing.swift
@@ -11,6 +11,8 @@
import Glibc
#elseif canImport(Musl)
import Musl
+#elseif canImport(Bionic)
+import Bionic
#elseif os(WASI)
import WASILibc
#elseif canImport(CRT)