-
Notifications
You must be signed in to change notification settings - Fork 15
/
swift-android-ci.patch
103 lines (99 loc) · 3.82 KB
/
swift-android-ci.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
diff --git a/llbuild/CMakeLists.txt b/llbuild/CMakeLists.txt
index 766e38e7..ad4d369f 100644
--- a/llbuild/CMakeLists.txt
+++ b/llbuild/CMakeLists.txt
@@ -158,6 +158,7 @@ elseif(MSVC)
else ()
add_compile_options(
# Enable additional Clang warnings.
+ "$<$<COMPILE_LANGUAGE:CXX>:-D_FORTIFY_SOURCE=0>"
"$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>"
"$<$<COMPILE_LANGUAGE:CXX>:-fno-exceptions>"
"$<$<COMPILE_LANGUAGE:CXX>:-Wbool-conversion>"
diff --git a/llbuild/lib/llvm/Support/CMakeLists.txt b/llbuild/lib/llvm/Support/CMakeLists.txt
index 9d5a714b..3f8f8c1d 100644
--- a/llbuild/lib/llvm/Support/CMakeLists.txt
+++ b/llbuild/lib/llvm/Support/CMakeLists.txt
@@ -66,4 +66,15 @@ endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Android|Darwin|Linux")
target_link_libraries(llvmSupport PRIVATE curses)
+if(${CMAKE_SYSTEM_NAME} MATCHES "Android")
+ target_link_libraries(llvmSupport PRIVATE android-spawn)
+ list(GET CMAKE_FIND_ROOT_PATH 0 SPAWN_DIR)
+ target_include_directories(llvmSupport
+ PUBLIC
+ ${SPAWN_DIR}/usr/include
+ )
+ target_link_directories(llvmSupport PUBLIC
+ ${SPAWN_DIR}/usr/lib
+ )
+endif()
endif()
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', '--pkg-config-path', os.path.join(os.path.split(args.cross_compile_config)[0], 'lib/pkgconfig'),
# Android and fail.
'-Xswiftc', '-Xcc', '-Xswiftc', '-U_GNU_SOURCE',
]
diff --git a/swift-argument-parser/Sources/ArgumentParser/Utilities/Platform.swift b/swift-argument-parser/Sources/ArgumentParser/Utilities/Platform.swift
index b7fa046..a94e3b8 100644
--- a/swift-argument-parser/Sources/ArgumentParser/Utilities/Platform.swift
+++ b/swift-argument-parser/Sources/ArgumentParser/Utilities/Platform.swift
@@ -19,6 +19,8 @@ import Darwin
import CRT
#elseif canImport(WASILibc)
import WASILibc
+#elseif canImport(Android)
+import Android
#endif
enum Platform {}
@@ -88,6 +90,8 @@ extension Platform {
ucrt._exit(code)
#elseif canImport(WASILibc)
WASILibc.exit(code)
+#elseif canImport(Android)
+ Android.exit(code)
#endif
}
}
@@ -108,7 +112,7 @@ extension Platform {
// MARK: Terminal size
-#if canImport(Glibc)
+#if canImport(Glibc) || canImport(Android)
func ioctl(_ a: Int32, _ b: Int32, _ p: UnsafeMutableRawPointer) -> Int32 {
ioctl(CInt(a), UInt(b), p)
}
diff --git a/swift-certificates/Sources/X509/Verifier/RFC5280/URIConstraints.swift b/swift-certificates/Sources/X509/Verifier/RFC5280/URIConstraints.swift
--- a/swift-certificates/Sources/X509/Verifier/RFC5280/URIConstraints.swift
+++ b/swift-certificates/Sources/X509/Verifier/RFC5280/URIConstraints.swift
@@ -21,6 +21,9 @@
#elseif canImport(Musl)
import Musl
import CoreFoundation
+#elseif canImport(Android)
+import Android
+import CoreFoundation
#elseif canImport(Darwin)
import Darwin
#endif
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