summaryrefslogtreecommitdiffstats
path: root/packaging/android/build.sh
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2018-11-24 10:38:15 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-12-30 11:20:34 -0800
commit2e5df6eda7d3e8b91a355efb952d417fa6bf9596 (patch)
tree7f0b70d1f95ddf3e161cc4375a2a0b5eabdadf9f /packaging/android/build.sh
parent13f108c9dd024ac1b12f84cda7362344caada8dd (diff)
downloadsubsurface-2e5df6eda7d3e8b91a355efb952d417fa6bf9596.tar.gz
Android build: add arm64 target and compile with clang
With a preparation done in the 4 commits before, now add the arm64 and use clang instead of gcc as compiler infrastructure. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Diffstat (limited to 'packaging/android/build.sh')
-rwxr-xr-xpackaging/android/build.sh29
1 files changed, 18 insertions, 11 deletions
diff --git a/packaging/android/build.sh b/packaging/android/build.sh
index cd869941e..86729de38 100755
--- a/packaging/android/build.sh
+++ b/packaging/android/build.sh
@@ -63,7 +63,7 @@ while [ "$#" -gt 0 ] ; do
SUBSURFACE_DESKTOP=ON
shift
;;
- arm|x86)
+ arm|arm64|x86)
ARCH=$1
shift
;;
@@ -117,10 +117,17 @@ if [ "$ARCH" = "arm" ] ; then
QT_ARCH=armv7
BUILDCHAIN=arm-linux-androideabi
OPENSSL_MACHINE=armv7
+ ANDROID_ABI=armeabi-v7a
+elif [ "$ARCH" = "arm64" ] ; then # requires Qt 5.12
+ QT_ARCH=arm64_v8a
+ BUILDCHAIN=aarch64-linux-android
+ ANDROID_ABI=arm64-v8a
+ OPENSSL_MACHINE=aarch64
elif [ "$ARCH" = "x86" ] ; then
QT_ARCH=$ARCH
BUILDCHAIN=i686-linux-android
OPENSSL_MACHINE=i686
+ ANDROID_ABI=x86
fi
# Verify Qt install and adjust for single-arch Qt install layout
@@ -142,15 +149,13 @@ export BUILDROOT=$PWD
export PATH=${BUILDROOT}/ndk-$ARCH/bin:$PATH
export PREFIX=${BUILDROOT}/ndk-$ARCH/sysroot/usr
export PKG_CONFIG_LIBDIR=$PREFIX/lib/pkgconfig
-export CC=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-gcc
-export CXX=${BUILDROOT}/ndk-$ARCH/bin/${BUILDCHAIN}-g++
+export CC=${BUILDROOT}/ndk-$ARCH/bin/clang
+export CXX=${BUILDROOT}/ndk-$ARCH/bin/clang++
# autoconf seems to get lost without this
export SYSROOT=${BUILDROOT}/ndk-$ARCH/sysroot
export CFLAGS=--sysroot=${SYSROOT}
export CPPFLAGS=--sysroot=${SYSROOT}
export CXXFLAGS=--sysroot=${SYSROOT}
-# Junk needed for qt-android-cmake
-export ANDROID_STANDALONE_TOOLCHAIN=${BUILDROOT}/ndk-$ARCH
if [ "$PLATFORM" = "Darwin" ] ; then
JAVA_HOME=$(/usr/libexec/java_home)
export JAVA_HOME
@@ -259,12 +264,13 @@ if [ "$QUICK" = "" ] ; then
cp -r openssl/* openssl-build-"$ARCH"
pushd openssl-build-"$ARCH"
perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org
+ perl -pi -e 's/-mandroid//g' Configure
# Use env to make all these temporary, so they don't pollute later builds.
env SYSTEM=android \
CROSS_COMPILE=${BUILDCHAIN}- \
MACHINE=$OPENSSL_MACHINE \
- HOSTCC=gcc \
- CC=gcc \
+ HOSTCC=clang \
+ CC=clang \
ANDROID_DEV="$PREFIX" \
bash -x ./config shared no-ssl2 no-ssl3 no-comp no-hw no-engine --openssldir="$PREFIX"
# sed -i.bak -e 's/soname=\$\$SHLIB\$\$SHLIB_SOVER\$\$SHLIB_SUFFIX/soname=\$\$SHLIB/g' Makefile.shared
@@ -396,14 +402,15 @@ fi
PKGCONF=$(which pkg-config)
cmake $MOBILE_CMAKE \
- -DPKG_CONFIG_EXECUTABLE="$PKGCONF" \
+ -DCMAKE_SYSTEM_NAME="Android" \
+ -DANDROID_ABI=$ANDROID_ABI \
+ -DANDROID_PLATFORM="$ANDROID_PLATFORM" \
-DQT_ANDROID_SDK_ROOT="$ANDROID_SDK_ROOT" \
-DQT_ANDROID_NDK_ROOT="$ANDROID_NDK_ROOT" \
- -DANDROID_TOOLCHAIN="gcc" \
- -DANDROID_PLATFORM="$ANDROID_PLATFORM" \
+ -DPKG_CONFIG_EXECUTABLE="$PKGCONF" \
-DCMAKE_TOOLCHAIN_FILE="$ANDROID_NDK_ROOT"/build/cmake/android.toolchain.cmake \
-DQT_ANDROID_CMAKE="$BUILDROOT"/qt-android-cmake/AddQtAndroidApk.cmake \
- -DANDROID_STL="gnustl_shared" \
+ -DANDROID_STL="c++_shared" \
-DFORCE_LIBSSH=OFF \
-DLIBDC_FROM_PKGCONFIG=ON \
-DLIBGIT2_FROM_PKGCONFIG=ON \