aboutsummaryrefslogtreecommitdiff
path: root/ci/test
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@protonmail.com>2021-03-24 19:01:56 +0100
committerWladimir J. van der Laan <laanwj@protonmail.com>2021-03-24 19:02:01 +0100
commit23b15601dfeb0f4e61343acce3bf3111f54ea6e7 (patch)
treef58adb112d9d22267d26f07b309b0aa9f6a9047f /ci/test
parentb1281b5d8fe346bb275929acbc7fba82c24621cd (diff)
parent246774e26459cb3652e308880abdd140e8e9d204 (diff)
downloadbitcoin-23b15601dfeb0f4e61343acce3bf3111f54ea6e7.tar.xz
Merge #17227: Qt: Add Android packaging support
246774e26459cb3652e308880abdd140e8e9d204 depends: fix Qt precompiled headers bug (Igor Cota) 8e7ad4146d55f472e3d1dacaabb6b7dee704a896 depends: disable Qt Vulkan support on Android (Igor Cota) ba46adaa1abd51798394b5bad3799021adc237d2 CI: add Android APK build to cirrus (Igor Cota) 7563720e30a3052b7ee390f1b3d2874856fd073a CI: add Android APK build script (Igor Cota) ebfb10cb75adb704418d08197681c1e742e63bd5 Qt: add Android packaging support (Igor Cota) Pull request description: ![bitcoin-qt](https://user-images.githubusercontent.com/762502/67396157-62f3d000-f5a7-11e9-8a6f-9425823fcd6c.gif) This PR is the third and final piece of the basic Android support puzzle - it depends on https://github.com/bitcoin/bitcoin/pull/16110 and is related to https://github.com/bitcoin/bitcoin/pull/16883. It introduces an `android` directory under `qt` and a simple way to build an Android package of `bitcoin-qt`: 1. Build depends for Android as described in the [README](https://github.com/bitcoin/bitcoin/blob/master/depends/README.md) 2. Configure with one of the resulting prefixes 3. Run `make && make apk` in `src/qt` The resulting APK files will be in `android/build/outputs/apk`. You can install them manually or with [adb](https://developer.android.com/studio/command-line/adb). One can also open the `android` directory in Android Studio for that integrated development and debugging experience. `BitcoinQtActivity` is your starting point. Under the hood makefile `apk` target: 1. Renames the `bitcoin-qt` binary to `libbitcoin-qt.so` and copies it over to a folder under `android/libs` depending on which prefix and corresponding [ABI](https://developer.android.com/ndk/guides/abis.html#sa) `bitcoin-qt` was built for 2. Takes `libc++_shared.so` from the Android NDK and puts in the same place. It [must be included](https://developer.android.com/ndk/guides/cpp-support) in the APK 3. Extracts Qt for Android Java support files from the `qtbase` archive in `depends/sources` to `android/src` There is also just a tiny bit of `ifdef`'d code to make the Qt Widgets menus usable. It's not pretty but it works and is a stepping stone towards https://github.com/bitcoin/bitcoin/pull/16883. ACKs for top commit: MarcoFalke: cr ACK 246774e264 laanwj: Code review ACK 246774e26459cb3652e308880abdd140e8e9d204 Tree-SHA512: ba30a746576a167545223c35a51ae60bb0838818779fc152c210f5af1413961b2a6ab6af520ff92cbc8dcd5dcb663e81ca960f021218430c1f76397ed4cead6c
Diffstat (limited to 'ci/test')
-rw-r--r--ci/test/00_setup_env_android.sh17
-rwxr-xr-xci/test/05_before_script.sh14
-rwxr-xr-xci/test/06_script_a.sh8
3 files changed, 39 insertions, 0 deletions
diff --git a/ci/test/00_setup_env_android.sh b/ci/test/00_setup_env_android.sh
new file mode 100644
index 0000000000..8b872faec5
--- /dev/null
+++ b/ci/test/00_setup_env_android.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2019-2020 The Bitcoin Core developers
+# Distributed under the MIT software license, see the accompanying
+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
+
+export LC_ALL=C.UTF-8
+
+export CONTAINER_NAME=ci_android
+export PACKAGES="clang llvm unzip openjdk-8-jdk gradle"
+
+export ANDROID_API_LEVEL=28
+export ANDROID_BUILD_TOOLS_VERSION=28.0.3
+export ANDROID_NDK_VERSION=21.1.6352462
+export ANDROID_TOOLS_URL=https://dl.google.com/android/repository/commandlinetools-linux-6609375_latest.zip
+
+export BITCOIN_CONFIG="--disable-ccache" \ No newline at end of file
diff --git a/ci/test/05_before_script.sh b/ci/test/05_before_script.sh
index f69afd8a26..3bfeb2d67f 100755
--- a/ci/test/05_before_script.sh
+++ b/ci/test/05_before_script.sh
@@ -22,6 +22,20 @@ if [ -n "$XCODE_VERSION" ] && [ ! -f "$OSX_SDK_PATH" ]; then
DOCKER_EXEC curl --location --fail "${SDK_URL}/${OSX_SDK_BASENAME}" -o "$OSX_SDK_PATH"
fi
+if [ -n "$ANDROID_TOOLS_URL" ]; then
+ ANDROID_TOOLS_PATH=$DEPENDS_DIR/sdk-sources/android-tools.zip
+ ANDROID_HOME="$DEPENDS_DIR"/SDKs/android
+ ANDROID_NDK_HOME=${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}
+
+ DOCKER_EXEC curl --location --fail "${ANDROID_TOOLS_URL}" -o "$ANDROID_TOOLS_PATH"
+ DOCKER_EXEC mkdir -p "${ANDROID_HOME}/cmdline-tools"
+ DOCKER_EXEC unzip -o "$ANDROID_TOOLS_PATH" -d "${ANDROID_HOME}/cmdline-tools"
+ DOCKER_EXEC "yes | ${ANDROID_HOME}/cmdline-tools/tools/bin/sdkmanager --install \"build-tools;${ANDROID_BUILD_TOOLS_VERSION}\" \"platform-tools\" \"platforms;android-${ANDROID_API_LEVEL}\" \"ndk;${ANDROID_NDK_VERSION}\""
+
+ MAKE_COMMAND="ANDROID_SDK=${ANDROID_HOME} ANDROID_NDK=${ANDROID_NDK_HOME} make $MAKEJOBS -C depends HOST=aarch64-linux-android ANDROID_API_LEVEL=${ANDROID_API_LEVEL} ANDROID_TOOLCHAIN_BIN=${ANDROID_HOME}/ndk/${ANDROID_NDK_VERSION}/toolchains/llvm/prebuilt/linux-x86_64/bin/ $DEP_OPTS"
+ DOCKER_EXEC "$MAKE_COMMAND" HOST=aarch64-linux-android
+fi
+
if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
# Use BDB compiled using install_db4.sh script to work around linking issue when using BDB
# from depends. See https://github.com/bitcoin/bitcoin/pull/18288#discussion_r433189350 for
diff --git a/ci/test/06_script_a.sh b/ci/test/06_script_a.sh
index 7986f7665a..a42cd6cee1 100755
--- a/ci/test/06_script_a.sh
+++ b/ci/test/06_script_a.sh
@@ -6,6 +6,14 @@
export LC_ALL=C.UTF-8
+if [ -n "$ANDROID_TOOLS_URL" ]; then
+ DOCKER_EXEC make distclean || true
+ DOCKER_EXEC ./autogen.sh
+ DOCKER_EXEC ./configure $BITCOIN_CONFIG --prefix=$DEPENDS_DIR/aarch64-linux-android || ( (DOCKER_EXEC cat config.log) && false)
+ DOCKER_EXEC "cd src/qt && make $MAKEJOBS && ANDROID_HOME=${ANDROID_HOME} ANDROID_NDK_HOME=${ANDROID_NDK_HOME} make apk"
+ exit 0
+fi
+
BITCOIN_CONFIG_ALL="--enable-suppress-external-warnings --disable-dependency-tracking --prefix=$DEPENDS_DIR/$HOST --bindir=$BASE_OUTDIR/bin --libdir=$BASE_OUTDIR/lib"
if [ -z "$NO_WERROR" ]; then
BITCOIN_CONFIG_ALL="${BITCOIN_CONFIG_ALL} --enable-werror"