@@ -108,14 +108,11 @@ source_dir=
108
108
ndk_home=${ANDROID_NDK}
109
109
build_dir=$( pwd) /build
110
110
products_dir=
111
- patch_dir=
112
111
113
112
while [ " $# " -gt 0 ]; do
114
113
case " $1 " in
115
114
--source-dir)
116
115
source_dir=" $2 " ; shift ;;
117
- --patch-dir)
118
- patch_dir=" $2 " ; shift ;;
119
116
--ndk-home)
120
117
ndk_home=" $2 " ; shift ;;
121
118
--host-toolchain)
143
140
# Change the commas for spaces
144
141
archs=" ${archs// ,/ } "
145
142
146
- if [[ -z " $source_dir " || -z " $products_dir " || -z " $patch_dir " || -z " $ ndk_home" || -z " $host_toolchain " ]]; then
143
+ if [[ -z " $source_dir " || -z " $products_dir " || -z " $ndk_home " || -z " $host_toolchain " ]]; then
147
144
usage
148
145
exit 1
149
146
fi
@@ -222,30 +219,10 @@ function run() {
222
219
" $@ "
223
220
}
224
221
225
- HOST=linux-x86_64
226
- ndktoolchain=$ndk_home /toolchains/llvm/prebuilt/$HOST
227
-
228
- function export_toolchain_vars {
229
- # needed for libxml, but breaks Swift build-script,
230
- # so need to call unexport_toolchain_vars aferwards
231
- export AR=$ndktoolchain /bin/llvm-ar
232
- export AS=$ndktoolchain /bin/llvm-as
233
- export CC=$ndktoolchain /bin/$compiler_target_host -clang
234
- export CXX=$ndktoolchain /bin/$compiler_target_host -clang++
235
- export LD=$ndktoolchain /bin/ld
236
- export RANLIB=$ndktoolchain /bin/llvm-ranlib
237
- export STRIP=$ndktoolchain /bin/llvm-strip
238
- }
222
+ # HOST=linux-x86_64
223
+ HOST=$( uname -s -m | tr ' [:upper:]' ' [:lower:]' | tr ' ' ' -' )
239
224
240
- function unexport_toolchain_vars {
241
- export AR=
242
- export AS=
243
- export CC=
244
- export CXX=
245
- export LD=
246
- export RANLIB=
247
- export STRIP=
248
- }
225
+ ndktoolchain=$ndk_home /toolchains/llvm/prebuilt/$HOST
249
226
250
227
for arch in $archs ; do
251
228
case $arch in
@@ -341,26 +318,10 @@ for arch in $archs; do
341
318
quiet_pushd ${build_dir} /$arch /curl
342
319
run ninja -j$parallel_jobs install
343
320
quiet_popd
344
-
345
321
quiet_popd
346
322
347
323
header " Building Android SDK for ${compiler_target_host} "
348
324
quiet_pushd ${source_dir} /swift-project
349
- # TODO: need to selectively apply patches based on release or not release
350
- git apply $patch_dir /swift-android.patch || true
351
- git apply -C1 $patch_dir /swift-android-ci.patch || true
352
-
353
- # need to un-apply libandroid-spawn since we don't need it for API ???+
354
- perl -pi -e ' s/MATCHES "Android"/MATCHES "AndroidDISABLED"/g' llbuild/lib/llvm/Support/CMakeLists.txt
355
- perl -pi -e ' s/ STREQUAL Android\)/ STREQUAL AndroidDISABLED\)/g' swift-corelibs-foundation/Sources/Foundation/CMakeLists.txt
356
- # fix for Process.swift:953:57: error: value of optional type 'posix_spawnattr_t?' (aka 'Optional<OpaquePointer>') must be unwrapped to a value of type 'posix_spawnattr_t' (aka 'OpaquePointer')
357
- perl -pi -e ' s%canImport\(Darwin\) \|\| os\(Android\) \|\| os\(OpenBSD\)%canImport\(Darwin\) || os\(AndroidXXX\) || os\(OpenBSD\)%g' swift-corelibs-foundation/Sources/Foundation/Process.swift
358
-
359
- git apply $patch_dir /swift-android-ci-release.patch || true
360
- git apply $patch_dir /swift-android-testing-release.patch || true
361
-
362
- perl -pi -e ' s%String\(cString: getpass%\"fake\" //%' swiftpm/Sources/PackageRegistryCommand/PackageRegistryCommand+Auth.swift
363
-
364
325
# TODO: only for release (for some reason)
365
326
LSP_BUILD=" --sourcekit-lsp"
366
327
@@ -371,11 +332,9 @@ for arch in $archs; do
371
332
RelWithDebInfo) build_type_flag=" --release-debuginfo" ;;
372
333
esac
373
334
374
- # ./swift/utils/build-script --help
375
-
376
- # --reconfigure \
377
335
./swift/utils/build-script \
378
336
$build_type_flag \
337
+ --reconfigure \
379
338
--no-assertions \
380
339
--android \
381
340
--android-ndk $ndk_home \
@@ -408,6 +367,5 @@ for arch in $archs; do
408
367
echo " built: ${swiftc} "
409
368
410
369
quiet_popd
411
-
412
370
done
413
371
0 commit comments