summaryrefslogtreecommitdiffstats
path: root/packaging/android/android-build-setup.sh
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-11-18 21:55:36 +0000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-11-19 17:18:33 -0800
commit3a00ac0157ca4ad680c79da269a52bcd4f71f8d6 (patch)
tree629aa8ad21c591210a736616b0b3ed9038ac394a /packaging/android/android-build-setup.sh
parentfd88058060003b3b82e38becca25ca9905e6efb2 (diff)
downloadsubsurface-3a00ac0157ca4ad680c79da269a52bcd4f71f8d6.tar.gz
android: add new build setup script
This installs the required versions for most components, switches us to Qt 5.15, current SDK, NDK, and the current OpenSSL version. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'packaging/android/android-build-setup.sh')
-rwxr-xr-xpackaging/android/android-build-setup.sh62
1 files changed, 62 insertions, 0 deletions
diff --git a/packaging/android/android-build-setup.sh b/packaging/android/android-build-setup.sh
new file mode 100755
index 000000000..88f2d99be
--- /dev/null
+++ b/packaging/android/android-build-setup.sh
@@ -0,0 +1,62 @@
+#!/bin/bash -eu
+
+# run this in the top level folder you want to create Android binaries in
+#
+# the script requires the Android Command Line Tools to be in cmdline-tools/bin
+#
+
+exec 1> >(tee ./build.log) 2>&1
+
+if [ "$(uname)" != Linux ] ; then
+ echo "only on Linux so far"
+ exit 1
+fi
+
+SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
+export SUBSURFACE_SOURCE="$SCRIPTDIR"/../..
+
+# these are the current versions for Qt, Android SDK & NDK:
+source "$SCRIPTDIR"/variables.sh
+
+# make sure we were started from the right directory
+if [ ! -d cmdline-tools ] ; then
+ echo "Start from within your Android build directory which needs to already include the Android Cmdline Tools"
+ exit 1
+fi
+
+# make sure we have the required commands installed
+MISSING=
+for i in git cmake autoconf libtool java wget unzip; do
+ command -v $i >/dev/null ||
+ if [ $i = libtool ] ; then
+ MISSING="${MISSING}libtool-bin "
+ elif [ $i = java ] ; then
+ MISSING="${MISSING}openjdk-8-jdk "
+ else
+ MISSING="${MISSING}${i} "
+ fi
+done
+if [ "$MISSING" ] ; then
+ echo "The following packages are missing: $MISSING"
+ echo "Please install via your package manager."
+ exit 1
+fi
+
+# first we need to get the Android SDK and NDK
+export JAVA_HOME=/usr
+export ANDROID_HOME=$(pwd)
+export PATH=$ANDROID_HOME/cmdline-tools/bin:/usr/local/bin:/bin
+rm -rf cmdline-tools/latest
+sdkmanager --sdk_root="$ANDROID_HOME" "ndk;$NDK_VERSION" "cmdline-tools;latest" "platform-tools" "platforms;$ANDROID_PLATFORMS" "build-tools;$ANDROID_BUILDTOOLS_REVISION"
+echo "yyyyyyyy" | sdkmanager --sdk_root=/android --licenses
+
+# next check that Qt is installed
+if [ ! -d "$LATEST_QT" ] ; then
+ aqt install -O /android "$LATEST_QT" linux android -m qtcharts
+fi
+
+# now that we have an NDK, copy the font that we need for OnePlus phones
+# due to https://bugreports.qt.io/browse/QTBUG-69494
+cp "$ANDROID_HOME"/platforms/"$ANDROID_PLATFORMS"/data/fonts/Roboto-Regular.ttf "$SUBSURFACE_SOURCE"/android-mobile || exit 1
+
+echo "things are set up for the Android build"