build-system/Android: use install-qt.sh to install Qt

The official installer now requires the user to log in which we can't
really do in a scripted manner. Let's see how long this way of
installing things will be available.

While doing this remove an ancient hack of some Qt settings that we no
longer need.

This also tries to prune some things that we don't need in the Docker
image to reduce image size.

The mapbox plugin is removed as it would add a dependency to QtSql which
we otherwise don't need. And since the plugin isn't used, no point in
installing it.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-04-23 08:23:19 -07:00
parent c0ecd3a597
commit f112be7a61
3 changed files with 52 additions and 27 deletions

View file

@ -53,7 +53,6 @@ PLATFORM=$(uname)
export SUBSURFACE_SOURCE="$SCRIPTDIR"/../.. export SUBSURFACE_SOURCE="$SCRIPTDIR"/../..
if [ "$PLATFORM" = Linux ] ; then if [ "$PLATFORM" = Linux ] ; then
QT_BINARIES=qt-opensource-linux-x64-${LATEST_QT}.run
NDK_BINARIES=${ANDROID_NDK}-linux-x86_64.zip NDK_BINARIES=${ANDROID_NDK}-linux-x86_64.zip
SDK_TOOLS=sdk-tools-linux-${SDK_VERSION}.zip SDK_TOOLS=sdk-tools-linux-${SDK_VERSION}.zip
else else
@ -117,24 +116,21 @@ fi
# due to https://bugreports.qt.io/browse/QTBUG-69494 # due to https://bugreports.qt.io/browse/QTBUG-69494
cp "$ANDROID_SDK"/platforms/"${ANDROID_PLATFORM}"/data/fonts/Roboto-Regular.ttf "$SUBSURFACE_SOURCE"/android-mobile || exit 1 cp "$ANDROID_SDK"/platforms/"${ANDROID_PLATFORM}"/data/fonts/Roboto-Regular.ttf "$SUBSURFACE_SOURCE"/android-mobile || exit 1
# download the Qt installer including Android bits and unpack / install
QT_DOWNLOAD_URL=https://download.qt.io/archive/qt/${QT_VERSION}/${LATEST_QT}/${QT_BINARIES}
if [ ! -d Qt/"${LATEST_QT}"/android_armv7 ] ; then if [ ! -d Qt/"${LATEST_QT}"/android_armv7 ] ; then
if [ -d Qt ] ; then # download the Qt installer including Android bits and unpack / install
# Over writing an exsisting installation stalls the installation script, bash "$SCRIPTDIR"/install-qt.sh --version ${LATEST_QT} --target android --toolchain android_armv7 \
# rename the exsisting Qt folder and notify then user. qtbase qtdeclarative qttranslations qttools qtsvg \
mv Qt Qt_OLD qtquickcontrols qtquickcontrols2 qtlocation qtimageformats \
echo "Qt installation found, backing it up to Qt_OLD." qtgraphicaleffects qtconnectivity qtandroidextras \
--directory Qt
fi fi
if [ ! -f "${QT_BINARIES}" ] ; then if [ ! -d Qt/"${LATEST_QT}"/android_arm64_v8a ] ; then
wget -q "${QT_DOWNLOAD_URL}" bash "$SCRIPTDIR"/install-qt.sh --version ${LATEST_QT} --target android --toolchain android_arm64_v8a \
qtbase qtdeclarative qttranslations qttools qtsvg \
qtquickcontrols qtquickcontrols2 qtlocation qtimageformats \
qtgraphicaleffects qtconnectivity qtandroidextras \
--directory Qt
fi fi
chmod +x ./"${QT_BINARIES}"
./"${QT_BINARIES}" --platform minimal --script "$SCRIPTDIR"/qt-installer-noninteractive.qs --no-force-installations
fi
# patch the cmake / Qt5.7.1 incompatibility mentioned above
sed -i 's/set_property(TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_FEATURES cxx_decltype)/# &/' Qt/"${LATEST_QT}"/android_armv7/lib/cmake/Qt5Core/Qt5CoreConfigExtras.cmake
if [ ! -z ${PREP_ONLY+x} ] ; then if [ ! -z ${PREP_ONLY+x} ] ; then
exit 0 exit 0

View file

@ -16,16 +16,17 @@ RUN apt-get update && \
libx11-xcb1 \ libx11-xcb1 \
libgl1-mesa-glx \ libgl1-mesa-glx \
libglib2.0-0 \ libglib2.0-0 \
openjdk-8-jdk openjdk-8-jdk \
curl \
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 qt-opensource-linux-x64-5.13.1.run /android/
ADD android-ndk-r*-linux-x86_64.zip /android/ ADD android-ndk-r*-linux-x86_64.zip /android/
ADD sdk-tools-linux-*.zip /android/ ADD sdk-tools-linux-*.zip /android/
ADD android-build-wrapper.sh variables.sh qt-installer-noninteractive.qs /android/ ADD install-qt.sh android-build-wrapper.sh variables.sh /android/
# install current cmake # install current cmake
ADD cmake-3.13.2.tar.gz /android/ ADD cmake-3.13.2.tar.gz /android/
@ -38,17 +39,45 @@ RUN cd /android && bash -x /android/android-build-wrapper.sh -prep-only
# uggly hack to work around some breakage in the NDK which makes our # uggly hack to work around some breakage in the NDK which makes our
# compiles fail # compiles fail
RUN sed -i '313,+13s/^using/\/\/using/' /android/android-ndk-r18b/sources/cxx-stl/llvm-libc++/include/cmath #RUN sed -i '313,+13s/^using/\/\/using/' /android/android-ndk-r21/sources/cxx-stl/llvm-libc++/include/cmath
# 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 && \
rm -rf qt-opensource-linux-x64-*.run \ apt-get remove -y gcc g++-7 libstdc++-7-dev && \
Qt/[a-zA-Z]* \ rm -rf \
Qt/5*/android_arm*/lib/*x86* \
Qt/5*/android_arm*/doc \
Qt/5*/android_arm*/include/QtHelp \
Qt/5*/android_arm*/include/QtFbSupport \
Qt/5*/android_arm*/include/QtFontDatabaseSupport \
Qt/5*/android_arm*/include/QtNfc \
Qt/5*/android_arm*/include/QtPrintSupport \
Qt/5*/android_arm*/include/QtTest \
Qt/5*/android_arm*/include/QtXml \
Qt/5*/android_arm*/plugins/geoservices/libqtgeoservices_mapboxgl.so \
sdk-tools-linux-*.zip \ sdk-tools-linux-*.zip \
android-ndk-r*-linux-x86_64.zip \ android-ndk-r*-linux-x86_64.zip \
android-sdk-linux/emulator \
$( find android-ndk*/platforms -name arch-mips -o -name arch-x86 ) \ $( find android-ndk*/platforms -name arch-mips -o -name arch-x86 ) \
android-ndk*/toolchains/x86-* android-ndk*/toolchains/llvm/prebuilt/x86-* \ android-ndk-r[0-9a-z]*/toolchains/x86-* android-ndk*/toolchains/llvm/prebuilt/x86-* \
android-ndk-r[0-9a-z]*/platforms/android-[12][2345678] \
android-ndk-r[0-9a-z]*/platforms/android-21/arch-x86_64 \
android-ndk-r[0-9a-z]*/prebuilt/linux-x86_64 \
android-ndk-r[0-9a-z]*/simpleperf \
android-ndk-r[0-9a-z]*/sources/cxx-stl/llvm-libc++/libs/x* \
android-ndk-r[0-9a-z]*/sources/cxx-stl/llvm-libc++/libs/*/*static* \
android-ndk-r[0-9a-z]*/sources/cxx-stl/llvm-libc++/test \
android-ndk-r[0-9a-z]*/sources/cxx-stl/llvm-libc++/utils \
android-ndk-r[0-9a-z]*/sources/cxx-stl/llvmlibc++abi \
android-ndk-r[0-9a-z]*/sources/cxx-stl/system \
android-ndk-r[0-9a-z]*/sources/third_party \
android-ndk-r[0-9a-z]*/sysroot/usr/lib \
android-sdk-linux/build-tools/28.0.3/renderscript \
android-sdk-linux/platform-tools/systrace \
android-sdk-linux/tools/lib \
android-sdk-linux/tools/proguard \
android-sdk-linux/tools/support \
android-sdk-linux/emulator \
/usr/lib/gcc \
cmake-3.13* && \ cmake-3.13* && \
ls -l && \ ls -l && \
du -sh * du -sh *

View file

@ -5,7 +5,7 @@
# 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-wrapper.sh .
cp ../../../packaging/android/variables.sh . cp ../../../packaging/android/variables.sh .
cp ../../../packaging/android/qt-installer-noninteractive.qs . 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 .