This directory contains scripts used in the port of Foundation to an Android toolchain. The short version of the story is that after downloading the swift sources use the script “prepare.sh” in this directory to install prebuilt binaries and headers for libxml, libcurl and libdispatch then run the script “builder.sh”.
This build requires the path to a r12 Android NDK in the
ANDROID_NDK_HOME environment variable and the path to the android port of the “icu” libraries in
ANDROID_ICU_UC downloaded from here. The port was tested against api 21 on a Android v5.1.1 LG K4 Phone (Lollipop) and requires an Ubuntu 15 host with the Android NDK Gold linker from
toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/arm-linux-androideabi/bin installed as /usr/bin/ld.gold.
The pre-built binaries were built from the following repos:
To build these the recipe was generally the same. autogen or configure for Linux then alter their Makefiles to have CFLAGS = include: --target=armv7-none-linux-androideabi --sysroot=$(ANDROID_NDK_HOME)/platforms/android-21/arch-arm.
There is a known issue when libdispatch background tasks exit they will cause an exception as DetachCurrentThread has not been called. To avoid this your app must include the line:
DispatchGroup.threadCleanupCallback = JNI_DetachCurrentThread
JNI_DetachCurrentThread is available in the package java_swift available here: https://github.com/SwiftJava/java_swift
Pre-built binaries of an Swift compiler with support for Android including Foundation available here: