build-system: update Android builder docker container

This adjusts the docker setup to create a container with the correct
NDK, SDK, tools, Qt version, etc, and updates the helper scripts that
are needed in order to do that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-11-18 22:01:29 +00:00
parent 3071ea06f0
commit cb4ccea3c2
3 changed files with 58 additions and 53 deletions

View file

@ -13,7 +13,6 @@ if [ "$(uname)" != Linux ] ; then
fi fi
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )" SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" > /dev/null && pwd )"
export SUBSURFACE_SOURCE="$SCRIPTDIR"/../..
# these are the current versions for Qt, Android SDK & NDK: # these are the current versions for Qt, Android SDK & NDK:
source "$SCRIPTDIR"/variables.sh source "$SCRIPTDIR"/variables.sh
@ -45,13 +44,14 @@ fi
# first we need to get the Android SDK and NDK # first we need to get the Android SDK and NDK
export JAVA_HOME=/usr export JAVA_HOME=/usr
export ANDROID_HOME=$(pwd) export ANDROID_HOME=$(pwd)
export PATH=$ANDROID_HOME/cmdline-tools/bin:/usr/local/bin:/bin export PATH=$ANDROID_HOME/cmdline-tools/bin:/usr/local/bin:/bin:/usr/bin
rm -rf cmdline-tools/latest 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" yes | 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 yes | sdkmanager --sdk_root=/android --licenses
# next check that Qt is installed # next check that Qt is installed
if [ ! -d "$LATEST_QT" ] ; then if [ ! -d "$LATEST_QT" ] ; then
pip3 install aqtinstall
aqt install -O /android "$LATEST_QT" linux android -m qtcharts aqt install -O /android "$LATEST_QT" linux android -m qtcharts
fi fi

View file

@ -5,12 +5,14 @@ RUN apt-get update && \
apt-get install -y \ apt-get install -y \
autoconf \ autoconf \
automake \ automake \
cmake \
git \ git \
libtool-bin \ libtool-bin \
make \ make \
wget \ wget \
unzip \ unzip \
python \ python \
python3-pip \
bzip2 \ bzip2 \
pkg-config \ pkg-config \
libx11-xcb1 \ libx11-xcb1 \
@ -18,65 +20,59 @@ RUN apt-get update && \
libglib2.0-0 \ libglib2.0-0 \
openjdk-8-jdk \ openjdk-8-jdk \
curl \ curl \
coreutils \
p7zip-full p7zip-full
# create our working directory and place the local copies of the Qt # create our working directory and place the local copies of the Qt
# install, NDK and SDK there, plus the three files from the Subsurface # install, NDK and SDK there, plus the three files from the Subsurface
# sources that we need to get the prep routines to run # sources that we need to get the prep routines to run
RUN mkdir -p /android RUN mkdir -p /android
ADD android-ndk-r*-linux-x86_64.zip /android/ ADD commandlinetools-linux-*.zip /android/
ADD sdk-tools-linux-*.zip /android/ RUN cd /android && unzip commandlinetools-linux-*.zip
ADD install-qt.sh android-build-wrapper.sh variables.sh /android/ ADD android-build-setup.sh variables.sh /android/
# install current cmake # run the build setup
ADD cmake-3.13.2.tar.gz /android/ RUN ls -l /android
RUN cd /android/cmake-3.13.2 && \ RUN cd /android && bash -x /android/android-build-setup.sh
bash ./bootstrap && \
make -j6 && make install
# run the build wrapper in prep mode
RUN cd /android && bash -x /android/android-build-wrapper.sh -prep-only
# clean up the files that we don't need to keep the container smaller # clean up the files that we don't need to keep the container smaller
RUN cd /android && \ RUN cd /android && \
apt-get remove -y gcc g++-7 libstdc++-7-dev && \
rm -rf \ rm -rf \
Qt/5*/android_arm*/lib/*x86* \ 5*/android/lib/*x86* \
Qt/5*/android_arm*/doc \ 5*/android/doc \
Qt/5*/android_arm*/include/QtHelp \ 5*/android/include/QtHelp \
Qt/5*/android_arm*/include/QtFbSupport \ 5*/android/include/QtFbSupport \
Qt/5*/android_arm*/include/QtFontDatabaseSupport \ 5*/android/include/QtFontDatabaseSupport \
Qt/5*/android_arm*/include/QtNfc \ 5*/android/include/QtNfc \
Qt/5*/android_arm*/include/QtPrintSupport \ 5*/android/include/QtPrintSupport \
Qt/5*/android_arm*/include/QtTest \ 5*/android/include/QtTest \
Qt/5*/android_arm*/include/QtXml \ 5*/android/include/QtXml \
Qt/5*/android_arm*/plugins/geoservices/libqtgeoservices_mapboxgl.so \ 5*/android/plugins/geoservices/libqtgeoservices_mapboxgl.so \
sdk-tools-linux-*.zip \ commandlinetools-linux-*.zip \
android-ndk-r*-linux-x86_64.zip \ $( find platforms -name arch-mips -o -name arch-x86 ) \
$( find android-ndk*/platforms -name arch-mips -o -name arch-x86 ) \ toolchains/x86-* android-ndk*/toolchains/llvm/prebuilt/x86-* \
android-ndk-r[0-9a-z]*/toolchains/x86-* android-ndk*/toolchains/llvm/prebuilt/x86-* \ platforms/android-[12][2345678] \
android-ndk-r[0-9a-z]*/platforms/android-[12][2345678] \ platforms/android-21/arch-x86_64 \
android-ndk-r[0-9a-z]*/platforms/android-21/arch-x86_64 \ ndk/*/sources/cxx-stl/llvm-libc++/libs/x* \
android-ndk-r[0-9a-z]*/prebuilt/linux-x86_64 \ ndk/*/sources/cxx-stl/llvm-libc++/libs/*/*static* \
android-ndk-r[0-9a-z]*/simpleperf \ ndk/*/sources/cxx-stl/llvm-libc++/test \
android-ndk-r[0-9a-z]*/sources/cxx-stl/llvm-libc++/libs/x* \ ndk/*/sources/cxx-stl/llvm-libc++/utils \
android-ndk-r[0-9a-z]*/sources/cxx-stl/llvm-libc++/libs/*/*static* \ ndk/*/sources/cxx-stl/llvmlibc++abi \
android-ndk-r[0-9a-z]*/sources/cxx-stl/llvm-libc++/test \ ndk/*/sources/cxx-stl/system \
android-ndk-r[0-9a-z]*/sources/cxx-stl/llvm-libc++/utils \ ndk/*/sources/third_party \
android-ndk-r[0-9a-z]*/sources/cxx-stl/llvmlibc++abi \ ndk/*/sysroot/usr/lib \
android-ndk-r[0-9a-z]*/sources/cxx-stl/system \ build-tools/*/renderscript \
android-ndk-r[0-9a-z]*/sources/third_party \ platform-tools/systrace \
android-ndk-r[0-9a-z]*/sysroot/usr/lib \ tools/lib \
android-sdk-linux/build-tools/28.0.3/renderscript \ tools/proguard \
android-sdk-linux/platform-tools/systrace \ tools/support \
android-sdk-linux/tools/lib \ emulator \
android-sdk-linux/tools/proguard \ platform-tools-2 \
android-sdk-linux/tools/support \ variables.sh \
android-sdk-linux/emulator \ android-build-setup.sh
/usr/lib/gcc \ /usr/lib/gcc && \
cmake-3.13* && \
ls -l && \ ls -l && \
du -sh * du -sh *
RUN apt-get clean RUN apt-get clean
RUN cd /android/android-ndk-r18b/toolchains && ln -s x86_64-4.9 x86-64-4.9 #RUN cd /android/android-ndk-r18b/toolchains && ln -s x86_64-4.9 x86-64-4.9
RUN touch /android/finished-"`date`" RUN touch /android/finished-"`date`"

View file

@ -2,10 +2,19 @@
# Use this to re-create a docker container for building Android binaries # Use this to re-create a docker container for building Android binaries
# Google makes it intentionally very hard to download the command line tools
# the URL is constantly changing and the website requires you to click through
# a license.
# Today this URL works:
if [ ! -f commandlinetools-linux-6858069_latest.zip ] ; then
wget https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip
fi
# if this fails, go to https://developer.android.com/studio#cmdline-tools and click through
# for yourself...
# copy the dependency script into this folder # copy the dependency script into this folder
cp ../../../packaging/android/android-build-wrapper.sh . cp ../../../packaging/android/android-build-setup.sh .
cp ../../../packaging/android/variables.sh . cp ../../../packaging/android/variables.sh .
cp ../../../packaging/android/install-qt.sh .
# create the container (this takes a while) # create the container (this takes a while)
sudo docker build -t android-builder --squash . sudo docker build -t android-builder --squash .