-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathswift-android-ci-release.patch
105 lines (103 loc) · 3.84 KB
/
swift-android-ci-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
95
96
97
98
99
100
101
102
103
104
105
diff --git a/sourcekit-lsp/Utilities/build-script-helper.py b/sourcekit-lsp/Utilities/build-script-helper.py
index bd31bec..4469cab 100755
--- a/sourcekit-lsp/Utilities/build-script-helper.py
+++ b/sourcekit-lsp/Utilities/build-script-helper.py
@@ -129,6 +129,7 @@ def get_swiftpm_options(swift_exec: str, args: argparse.Namespace) -> List[str]:
swiftpm_args += [
'-Xlinker', '-rpath', '-Xlinker', '$ORIGIN/../lib/swift/android',
# SwiftPM will otherwise try to compile against GNU strerror_r on
+ '-Xlinker', '-landroid-spawn',
# Android and fail.
'-Xswiftc', '-Xcc', '-Xswiftc', '-U_GNU_SOURCE',
]
diff --git a/swift-system/Sources/System/Internals/CInterop.swift b/swift-system/Sources/System/Internals/CInterop.swift
index 13abc75..2ad551a 100644
--- a/swift-system/Sources/System/Internals/CInterop.swift
+++ b/swift-system/Sources/System/Internals/CInterop.swift
@@ -25,6 +25,9 @@ import Glibc
#elseif canImport(Musl)
@_implementationOnly import CSystem
import Musl
+#elseif canImport(Bionic)
+@_implementationOnly import CSystem
+import Bionic
#else
#error("Unsupported Platform")
#endif
diff --git a/swift-system/Sources/System/Internals/Constants.swift b/swift-system/Sources/System/Internals/Constants.swift
index 53e215f..27039de 100644
--- a/swift-system/Sources/System/Internals/Constants.swift
+++ b/swift-system/Sources/System/Internals/Constants.swift
@@ -18,6 +18,8 @@ import CSystem
import ucrt
#elseif canImport(Glibc)
import Glibc
+#elseif canImport(Android)
+import Android
#elseif canImport(Musl)
import CSystem
import Musl
diff --git a/swift-system/Sources/System/Internals/Exports.swift b/swift-system/Sources/System/Internals/Exports.swift
index 5b08725..899be25 100644
--- a/swift-system/Sources/System/Internals/Exports.swift
+++ b/swift-system/Sources/System/Internals/Exports.swift
@@ -23,6 +23,9 @@ import Glibc
#elseif canImport(Musl)
@_implementationOnly import CSystem
import Musl
+#elseif canImport(Android)
+@_implementationOnly import CSystem
+import Android
#else
#error("Unsupported Platform")
#endif
@@ -58,6 +61,11 @@ internal var system_errno: CInt {
get { Musl.errno }
set { Musl.errno = newValue }
}
+#elseif canImport(Android)
+internal var system_errno: CInt {
+ get { Android.errno }
+ set { Android.errno = newValue }
+}
#endif
// MARK: C stdlib decls
diff --git a/swift-system/Sources/System/Internals/Syscalls.swift b/swift-system/Sources/System/Internals/Syscalls.swift
index 555f63b..f0db35f 100644
--- a/swift-system/Sources/System/Internals/Syscalls.swift
+++ b/swift-system/Sources/System/Internals/Syscalls.swift
@@ -15,6 +15,8 @@ import Glibc
import Musl
#elseif os(Windows)
import ucrt
+#elseif canImport(Android)
+import Android
#else
#error("Unsupported Platform")
#endif
diff --git a/swiftpm/Utilities/bootstrap b/swiftpm/Utilities/bootstrap
index 085056de..1ded1a90 100755
--- a/swiftpm/Utilities/bootstrap
+++ b/swiftpm/Utilities/bootstrap
@@ -827,6 +827,7 @@ def get_swiftpm_flags(args):
# Don't use GNU strerror_r on Android.
if '-android' in args.build_target:
build_flags.extend(["-Xswiftc", "-Xcc", "-Xswiftc", "-U_GNU_SOURCE"])
+ build_flags.extend(["-Xlinker", "-landroid-spawn"])
cross_compile_hosts = args.cross_compile_hosts
if cross_compile_hosts:
diff --git a/yams/Sources/Yams/Representer.swift b/yams/Sources/Yams/Representer.swift
index a749c52..b74ef8e 100644
--- a/yams/Sources/Yams/Representer.swift
+++ b/yams/Sources/Yams/Representer.swift
@@ -14,6 +14,10 @@ private let cpow: (_: Double, _: Double) -> Double = Darwin.pow
#elseif os(Windows)
import ucrt
private let cpow: (_: Double, _: Double) -> Double = ucrt.pow
+#elseif canImport(Bionic)
+import CoreFoundation
+import Bionic
+private let cpow: (_: Double, _: Double) -> Double = Bionic.pow
#else
import CoreFoundation
import Glibc