diff --git a/Makefile b/Makefile
index f50e200..f004f5b 100644
--- a/Makefile
+++ b/Makefile
@@ -80,6 +80,8 @@ $(foreach i,$(TOOLCHAINS),$(eval $(call DEPEND_COMMON,$(i))))
# Add here all dependencies between toolchains
$(BUILDDIR)/toolchains/devkit3ds: $(BUILDDIR)/toolchains/devkitarm
$(BUILDDIR)/toolchains/devkitnds: $(BUILDDIR)/toolchains/devkitarm
+$(BUILDDIR)/toolchains/android: $(BUILDDIR)/toolchains/android-common
+$(BUILDDIR)/toolchains/android-old: $(BUILDDIR)/toolchains/android-common
clean-toolchains:
docker rmi $(TOOLCHAINS)
diff --git a/master/platforms.py b/master/platforms.py
index 6128907..e2ee2cd 100644
--- a/master/platforms.py
+++ b/master/platforms.py
@@ -114,65 +114,51 @@ def _3ds():
platforms.append(platform)
_3ds()
-def android(suffix, scummvm_target, ndk_target, cxx_target, abi_version,
- android_master_root = "/opt/android/master",
- android_stable_root = "/opt/android/stable"):
- android_master_toolchain = "{0}/ndk/toolchains/llvm/prebuilt/linux-x86_64".format(
- android_master_root)
- android_stable_toolchain = "{0}/toolchain".format(android_stable_root)
+def android(suffix, scummvm_target, ndk_target, cxx_target, abi_version):
platform = Platform("android_{0}".format(suffix))
- platform.workerimage = "android"
platform.compatibleBuilds = (builds.ScummVMBuild, )
+
+ platform.workerimage = {
+ builds.ScummVMBuild: "android",
+ builds.ScummVMStableBuild: "android-old",
+ }
platform.buildenv = {
builds.ScummVMBuild: {
- "ANDROID_NDK_ROOT": "{0}/ndk".format(android_master_root),
- # configure script will find everything from this
- "ANDROID_TOOLCHAIN": "{0}".format(android_master_toolchain),
- # We keep SDK and gradle dynamic and outside the container
- # Their versions can change without the need to regenerate the image
- # Android build system can be shared across all versions so we don't specialize
- # the directory in /data/bshomes
- "ANDROID_SDK_ROOT": "/data/bshomes/android/sdk",
- "ANDROID_SDK_HOME": "/data/bshomes/android/sdk-home",
- "GRADLE_USER_HOME": "/data/bshomes/android/gradle",
- "CXX": "ccache {0}/bin/{1}{2}-clang++".format(
- android_master_toolchain, cxx_target, abi_version),
+ "CXX": "ccache ${{ANDROID_TOOLCHAIN}}/bin/{0}{1}-clang++".format(
+ cxx_target, abi_version),
# Worker has all libraries installed in the NDK sysroot
- "PKG_CONFIG_LIBDIR": "{0}/sysroot/usr/lib/{1}/{2}/pkgconfig".format(
- android_master_toolchain, ndk_target, abi_version),
+ "PKG_CONFIG_LIBDIR": "${{ANDROID_TOOLCHAIN}}/sysroot/usr/lib/{0}/{1}/pkgconfig".format(
+ ndk_target, abi_version),
+ # Altering PATH for curl-config, that lets us reuse environment variables instead of using configure args
+ "PATH": [ "${PATH}", "${{ANDROID_TOOLCHAIN}}/sysroot/usr/bin/{0}/{1}".format(
+ ndk_target, abi_version)],
},
builds.ScummVMStableBuild: {
- "ANDROID_NDK": "{0}/ndk".format(android_stable_root),
- "ANDROID_SDK": "{0}/sdk".format(android_stable_root),
- "ANDROID_SDK_HOME": "/data/bshomes/android/sdk-home",
- "AR": "{0}/bin/{1}-ar".format(
- android_stable_toolchain, ndk_target),
- "AS": "{0}/bin/{1}-as".format(
- android_stable_toolchain, ndk_target),
- "RANLIB": "{0}/bin/{1}-ranlib".format(
- android_stable_toolchain, ndk_target),
- "STRIP": "{0}/bin/{1}-strip".format(
- android_stable_toolchain, ndk_target),
- "STRINGS": "{0}/bin/{1}-strings".format(
- android_stable_toolchain, ndk_target),
- "CXX": "ccache {0}/bin/{1}-clang++".format(
- android_stable_toolchain, ndk_target),
- "CC": "ccache {0}/bin/{1}-clang".format(
- android_stable_toolchain, ndk_target),
+ "AR": "${{ANDROID_TOOLCHAIN}}/bin/{0}-ar".format(
+ ndk_target),
+ "AS": "${{ANDROID_TOOLCHAIN}}/bin/{0}-as".format(
+ ndk_target),
+ "RANLIB": "${{ANDROID_TOOLCHAIN}}/bin/{0}-ranlib".format(
+ ndk_target),
+ "STRIP": "${{ANDROID_TOOLCHAIN}}/bin/{0}-strip".format(
+ ndk_target),
+ "STRINGS": "${{ANDROID_TOOLCHAIN}}/bin/{0}-strings".format(
+ ndk_target),
+ "CXX": "ccache ${{ANDROID_TOOLCHAIN}}/bin/{0}-clang++".format(
+ ndk_target),
+ "CC": "ccache ${{ANDROID_TOOLCHAIN}}/bin/{0}-clang".format(
+ ndk_target),
# Worker has all libraries installed in the toolchain
- "PKG_CONFIG_LIBDIR": "{0}/sysroot/usr/lib/{1}/pkgconfig".format(
- android_stable_toolchain, ndk_target),
+ "PKG_CONFIG_LIBDIR": "${{ANDROID_TOOLCHAIN}}/sysroot/usr/lib/{0}/pkgconfig".format(
+ ndk_target),
+ # Altering PATH for curl-config, that lets us reuse environment variables instead of using configure args
+ "PATH": [ "${PATH}", "${{ANDROID_TOOLCHAIN}}/sysroot/usr/bin/{0}".format(
+ ndk_target)],
}
}
+
platform.configureargs.append("--host=android-{0}".format(scummvm_target))
- platform.buildconfigureargs = {
- builds.ScummVMBuild: [ "--enable-debug",
- # libcurl is detected using curl-config. Instead of modifying PATH just provide path to it to configure.
- "--with-libcurl-prefix={0}/sysroot/usr/bin/{1}/{2}".format(android_master_toolchain, ndk_target, abi_version)],
- builds.ScummVMStableBuild: [ "--enable-debug",
- # libcurl is detected using curl-config. Instead of modifying PATH just provide path to it to configure.
- "--with-libcurl-prefix={0}/sysroot/usr/bin/{1}".format(android_stable_toolchain, ndk_target)],
- }
+ platform.configureargs.append("--enable-debug")
platform.packaging_cmd = "androiddistdebug"
platform.built_files = {
builds.ScummVMBuild: [ "debug" ],
diff --git a/toolchains/android-common/Dockerfile b/toolchains/android-common/Dockerfile
new file mode 100644
index 0000000..cb63065
--- /dev/null
+++ b/toolchains/android-common/Dockerfile
@@ -0,0 +1,4 @@
+FROM scratch
+
+COPY functions-platform.sh functions-sdk.sh multi-build.sh /lib-helpers/
+COPY packages /lib-helpers/packages/
diff --git a/toolchains/android/functions-platform.sh b/toolchains/android-common/functions-platform.sh
similarity index 100%
rename from toolchains/android/functions-platform.sh
rename to toolchains/android-common/functions-platform.sh
diff --git a/toolchains/android/functions-sdk.sh b/toolchains/android-common/functions-sdk.sh
similarity index 100%
rename from toolchains/android/functions-sdk.sh
rename to toolchains/android-common/functions-sdk.sh
diff --git a/toolchains/android/multi-build.sh b/toolchains/android-common/multi-build.sh
similarity index 100%
rename from toolchains/android/multi-build.sh
rename to toolchains/android-common/multi-build.sh
diff --git a/toolchains/android/packages/fluidsynth-lite/patches/fix-install-dirs.patch b/toolchains/android-common/packages/fluidsynth-lite/patches/fix-install-dirs.patch
similarity index 100%
rename from toolchains/android/packages/fluidsynth-lite/patches/fix-install-dirs.patch
rename to toolchains/android-common/packages/fluidsynth-lite/patches/fix-install-dirs.patch
diff --git a/toolchains/android/packages/libsdl2-net/patches/no-sdl.patch b/toolchains/android-common/packages/libsdl2-net/patches/no-sdl.patch
similarity index 100%
rename from toolchains/android/packages/libsdl2-net/patches/no-sdl.patch
rename to toolchains/android-common/packages/libsdl2-net/patches/no-sdl.patch
diff --git a/toolchains/android/packages/libsdl2/build.sh b/toolchains/android-common/packages/libsdl2/build.sh
similarity index 100%
rename from toolchains/android/packages/libsdl2/build.sh
rename to toolchains/android-common/packages/libsdl2/build.sh
diff --git a/toolchains/android/packages/libvorbis/patches/remove-mno-ieee-fp-for-clang.patch b/toolchains/android-common/packages/libvorbis/patches/remove-mno-ieee-fp-for-clang.patch
similarity index 100%
rename from toolchains/android/packages/libvorbis/patches/remove-mno-ieee-fp-for-clang.patch
rename to toolchains/android-common/packages/libvorbis/patches/remove-mno-ieee-fp-for-clang.patch
diff --git a/toolchains/android/packages/openssl/build.sh b/toolchains/android-common/packages/openssl/build.sh
similarity index 100%
rename from toolchains/android/packages/openssl/build.sh
rename to toolchains/android-common/packages/openssl/build.sh
diff --git a/toolchains/android/packages/zlib/build.sh b/toolchains/android-common/packages/zlib/build.sh
similarity index 100%
rename from toolchains/android/packages/zlib/build.sh
rename to toolchains/android-common/packages/zlib/build.sh
diff --git a/toolchains/android-old/Dockerfile.m4 b/toolchains/android-old/Dockerfile.m4
new file mode 100644
index 0000000..57401ae
--- /dev/null
+++ b/toolchains/android-old/Dockerfile.m4
@@ -0,0 +1,36 @@
+##### Old toolchain : NDK r14b and SDK 25 #####
+m4_include(`android/start.m4')m4_dnl
+
+# Ant is needed by old Android build system
+# file and python are needed by NDK
+# libncurses5 is needed by all binaries
+RUN apt-get update && \
+ DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
+ ant \
+ file \
+ libncurses5 \
+ python && \
+ rm -rf /var/lib/apt/lists/*
+
+# Unlike the newer toolchain, this one is quite static because it shouldn't evolve in time
+# and many tricks may depend on the NDK version
+
+ENV ANDROID_ROOT=/opt/android
+
+# ABIS is for ndk-old package and determine how the unified toolchain will be composed
+# API is none because we don't have new style folder hierarchy
+ENV ANDROID_NDK_ROOT=${ANDROID_ROOT}/ndk \
+ TOOLCHAIN=${ANDROID_ROOT}/toolchain \
+ ABIS="arm/9 arm64/21 x86/9 x86_64/21" \
+ API="none" \
+ HOST_TAG=linux-x86_64
+
+# Install NDK using settings above
+local_sdk_package(ndk-old)
+
+# Include the packaging instructions
+m4_include(`android/packages_list.m4')
+
+# Install an old (unsupported) SDK because build process depends on android project command
+ENV ANDROID_SDK_ROOT=${ANDROID_ROOT}/sdk
+local_sdk_package(sdk-old)
diff --git a/toolchains/android/packages/ndk-old/build.sh b/toolchains/android-old/packages/ndk-old/build.sh
similarity index 100%
rename from toolchains/android/packages/ndk-old/build.sh
rename to toolchains/android-old/packages/ndk-old/build.sh
diff --git a/toolchains/android/packages/sdk-old/build.sh b/toolchains/android-old/packages/sdk-old/build.sh
similarity index 89%
rename from toolchains/android/packages/sdk-old/build.sh
rename to toolchains/android-old/packages/sdk-old/build.sh
index 13156ea..e8e4ce3 100755
--- a/toolchains/android/packages/sdk-old/build.sh
+++ b/toolchains/android-old/packages/sdk-old/build.sh
@@ -10,10 +10,10 @@ NO_FUNCTIONS_PLATFORM=yes
. $HELPERS_DIR/functions.sh
-export ANDROID_SDK_HOME=$(pwd)
-
do_make_bdir
+export ANDROID_SDK_HOME=$(pwd)
+
do_http_fetch tools "https://dl.google.com/android/repository/tools_r${SDK_VERSION}-${HOST_TAG%-*}.zip" 'unzip' \
"sha1:${SDK_SHA1}"
@@ -46,6 +46,14 @@ sed -ie 's## "${GRADLE_USER_HOME}"/gradle.properties