diff --git a/image/Dockerfile b/image/Dockerfile --- a/image/Dockerfile +++ b/image/Dockerfile @@ -1,41 +1,24 @@ -FROM ubuntu:wily +FROM ubuntu:bionic LABEL Description="KDE on Android SDK" -MAINTAINER Andreas Cord-Landwehr +LABEL Maintainer="Andreas Cord-Landwehr " -ENV ADIR /opt/android -RUN mkdir -p $ADIR +# First get a base ubuntu system with the right packages installed -# set ANDROID_* environment variables globally -RUN echo "\n\ -ANDROID_NDK=/opt/android/android-ndk-r10e\n\ -ANDROID_SDK_ROOT=/opt/android/android-sdk-linux\n\ -" >> /etc/environment +ENV DEBIAN_FRONTEND noninteractive +ENV DEBCONF_NONINTERACTIVE_SEEN true -# skeleton files that are used for all users -RUN echo "\n\ -export ADIR=$ADIR\n\ -export Qt5_android=$ADIR/Qt5.6.0/5.6/android_armv7/\n\ -export PATH=$ADIR/android-sdk-linux/platform-tools/:$PATH\n\ -export ANT=/usr/bin/ant\n\ -export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/\n\ +RUN echo "deb [arch=armhf] http://ports.ubuntu.com/ bionic main universe restricted\n\ +deb-src [arch=armhf] http://ports.ubuntu.com/ bionic main universe restricted\n\ \n\ -function cmakeandroid {\n\ - cmake \$@ -DCMAKE_INSTALL_PREFIX=$ADIR/kde/install -DCMAKE_PREFIX_PATH=\"$ADIR/Qt5.6.0/5.6/android_armv7/;$ADIR/kde/install\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$ADIR/kde/install/share/ECM/toolchain/Android.cmake\n\ -}\n\ -" >> /etc/skel/.bashrc - -RUN echo "deb [arch=armhf] http://ports.ubuntu.com/ wily main universe restricted\n\ -deb-src [arch=armhf] http://ports.ubuntu.com/ wily main universe restricted\n\ -\n\ -deb [arch=armhf] http://ports.ubuntu.com/ wily-updates main universe restricted\n\ -deb-src [arch=armhf] http://ports.ubuntu.com/ wily-updates main universe restricted\n\ +deb [arch=armhf] http://ports.ubuntu.com/ bionic-updates main universe restricted\n\ +deb-src [arch=armhf] http://ports.ubuntu.com/ bionic-updates main universe restricted\n\ \n\ -deb [arch=i386,amd64] http://archive.ubuntu.com/ubuntu wily main universe restricted\n\ -deb-src [arch=i386,amd64] http://archive.ubuntu.com/ubuntu wily main universe restricted\n\ +deb [arch=i386,amd64] http://archive.ubuntu.com/ubuntu bionic main universe restricted\n\ +deb-src [arch=i386,amd64] http://archive.ubuntu.com/ubuntu bionic main universe restricted\n\ \n\ -deb [arch=i386,amd64] http://archive.ubuntu.com/ubuntu wily-updates main universe restricted\n\ -deb-src [arch=i386,amd64] http://archive.ubuntu.com/ubuntu wily-updates main universe restricted\n\ +deb [arch=i386,amd64] http://archive.ubuntu.com/ubuntu bionic-updates main universe restricted\n\ +deb-src [arch=i386,amd64] http://archive.ubuntu.com/ubuntu bionic-updates main universe restricted\n\ " > /etc/apt/sources.list # enable verbose apt-get output @@ -47,17 +30,19 @@ curl \ expect \ git \ + unzip \ # required for running kdesrc-build libxml-simple-perl \ libjson-perl \ - openjdk-7-jdk \ - openjdk-7-jre \ + libyaml-syck-perl \ + openjdk-8-jdk \ + openjdk-8-jre \ qt5-qmake \ ssh \ sudo \ # required for ki18n gettext \ -# virtual framebuffer to provide X window for the Qt installer and unit tests +# virtual framebuffer to provide X window for unit tests xvfb \ # required for CI unit tests openbox \ @@ -70,7 +55,31 @@ python2.7 \ python-lxml \ gcovr - + +# Now let's start with the Android setup + +ENV ADIR /opt/android +RUN mkdir -p $ADIR + +ENV ANDROID_NDK /opt/android/android-ndk-r15b +ENV ANDROID_SDK_ROOT /opt/android/android-sdk-linux +ENV QTPREFIX $ADIR/Qt + +# skeleton files that are used for all users +RUN echo "\n\ +export ANDROID_NDK=$ANDROID_NDK\n\ +export ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT\n\ +export ADIR=$ADIR\n\ +export QTPREFIX=$QTPREFIX/\n\ +export PATH=$ADIR/android-sdk-linux/platform-tools/:$PATH\n\ +export ANT=/usr/bin/ant\n\ +export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/\n\ +\n\ +function cmakeandroid {\n\ + cmake \$@ -DCMAKE_INSTALL_PREFIX=$ADIR/kde/install -DCMAKE_PREFIX_PATH=\"$QTPREFIX/;$ADIR/kde/install\" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=$ADIR/kde/install/share/ECM/toolchain/Android.cmake\n\ +}\n\ +" >> /etc/skel/.bashrc + RUN groupadd -g 1000 jenkins && \ useradd -m -u 1000 -g 1000 -d /home/jenkins jenkins && \ echo 'jenkins:jenkins' | chpasswd && \ @@ -113,44 +122,85 @@ echo "SDK: done." # get NDK +# - should be more recent than 10e, as recommended when using clang, see https://wiki.qt.io/Android +# - but can't be r18b because that requires cmake >= 3.12.2 (see commit ca97d4cb5 in cmake git) RUN echo "Download NDK..." && \ - curl http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin -o $ADIR/android-ndk.bin && \ + curl https://dl.google.com/android/repository/android-ndk-r15b-linux-x86_64.zip -o $ADIR/android-ndk.zip && \ echo "NDK: unpacking..." && \ - chmod +x $ADIR/android-ndk.bin && \ cd $ADIR && \ - ./android-ndk.bin && \ + unzip ./android-ndk.zip && \ cd / && \ - rm $ADIR/android-ndk.bin && \ + rm $ADIR/android-ndk.zip && \ echo "NDK: done." -#get Qt for Android -RUN echo "Qt Installer: downloading..." && \ - curl http://master.qt.io/archive/qt/5.6/5.6.0/qt-opensource-linux-x64-android-5.6.0.run -o $ADIR/qt-installer.run && \ - chmod +x $ADIR/qt-installer.run +# Qt +# We use clang for Qt 5.12, as recommended at https://wiki.qt.io/Android and https://wiki.qt.io/Qt_for_Android_known_issues +ENV qtplatform android-clang +ENV qtversion 5.12.0 +ENV qtversionshort 5.12 -COPY qtinstallerconfig.qs $ADIR/qtinstallerconfig.qs -# run visual installer with simulated X window, filter out all warning messages due to not having a proper window -RUN xvfb-run -a $ADIR/qt-installer.run --script $ADIR/qtinstallerconfig.qs|grep -v "Warning: QPainter" | grep -v "Warning: QWidget" && \ - echo "Qt Installer: done." +#build qtbase +ENV qtmodule qtbase +RUN echo "$qtmodule: downloading and compiling..." && \ + curl http://master.qt.io/archive/qt/$qtversionshort/$qtversion/submodules/${qtmodule}-everywhere-src-$qtversion.tar.xz -o $ADIR/${qtmodule}.tar.xz && \ + cd $ADIR && \ + tar xf ${qtmodule}.tar.xz && \ + cd ${qtmodule}-everywhere-src-$qtversion && \ + echo "./configure -xplatform ${qtplatform} --disable-rpath -nomake tests -nomake examples -android-ndk $ANDROID_NDK -android-sdk $ANDROID_SDK_ROOT -android-ndk-host linux-x86_64 -opensource -confirm-license -no-warnings-are-errors -prefix $QTPREFIX" && \ + ./configure -xplatform ${qtplatform} --disable-rpath -nomake tests -nomake examples -android-ndk $ANDROID_NDK -android-sdk $ANDROID_SDK_ROOT -android-ndk-host linux-x86_64 -opensource -confirm-license -no-warnings-are-errors -prefix $QTPREFIX && \ + make -j `getconf _NPROCESSORS_ONLN` && \ + make install && \ + cd / && \ + rm $ADIR/${qtmodule}.tar.xz && \ + rm -rf $ADIR/${qtmodule}-everywhere-src-$qtversion + +#build qtdeclarative +ENV qtmodule qtdeclarative +RUN echo "$qtmodule: downloading and compiling..." && \ + curl http://master.qt.io/archive/qt/$qtversionshort/$qtversion/submodules/${qtmodule}-everywhere-src-$qtversion.tar.xz -o $ADIR/${qtmodule}.tar.xz && \ + cd $ADIR && \ + tar xf ${qtmodule}.tar.xz && \ + cd ${qtmodule}-everywhere-src-$qtversion && \ + $QTPREFIX/bin/qmake && \ + make -j `getconf _NPROCESSORS_ONLN` && \ + make install && \ + cd / && \ + rm $ADIR/${qtmodule}.tar.xz && \ + rm -rf $ADIR/${qtmodule}-everywhere-src-$qtversion + +#build qtlocation +ENV qtmodule qtlocation +RUN echo "$qtmodule: downloading and compiling..." && \ + curl http://master.qt.io/archive/qt/$qtversionshort/$qtversion/submodules/${qtmodule}-everywhere-src-$qtversion.tar.xz -o $ADIR/${qtmodule}.tar.xz && \ + cd $ADIR && \ + tar xf ${qtmodule}.tar.xz && \ + cd ${qtmodule}-everywhere-src-$qtversion && \ + $QTPREFIX/bin/qmake && \ + make -j `getconf _NPROCESSORS_ONLN` && \ + make install && \ + cd / && \ + rm $ADIR/${qtmodule}.tar.xz && \ + rm -rf $ADIR/${qtmodule}-everywhere-src-$qtversion # cleanup RUN sudo apt-get remove -y\ expect \ curl && \ - sudo apt-get autoremove -y && \ - rm $ADIR/qt-installer.run && \ - rm $ADIR/qtinstallerconfig.qs + sudo apt-get autoremove -y # get KDESRC build and android configurations RUN git clone git://anongit.kde.org/scratch/cordlandwehr/kdesrc-conf-android.git $ADIR/kdesrc-conf-android && \ mkdir -p $ADIR/extragear/kdesrc-build && \ git clone git://anongit.kde.org/kdesrc-build $ADIR/extragear/kdesrc-build && \ ln -s $ADIR/extragear/kdesrc-build/kdesrc-build $ADIR/kdesrc-build && \ ln -s $ADIR/kdesrc-conf-android/kdesrc-buildrc $ADIR/kdesrc-buildrc +# Build ECM so it's ready, and build KArchive to test that the cmake + ECM android toolchain setup is working OK RUN cd $ADIR && \ - ./kdesrc-build extra-cmake-modules - + ./kdesrc-build \ + extra-cmake-modules \ + karchive + RUN echo "Configuration finished, finalizing Docker image..." USER root diff --git a/image/qtinstallerconfig.qs b/image/qtinstallerconfig.qs deleted file mode 100644 --- a/image/qtinstallerconfig.qs +++ /dev/null @@ -1,118 +0,0 @@ -/* - Copyright 2015-2016 Andreas Cord-Landwehr - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -function Controller() -{ - console.log("Control script loaded: Qt 5.6 Android with Linux 64 bit host.") - installer.autoRejectMessageBoxes -} - -Controller.prototype.WelcomePageCallback = function() -{ - gui.clickButton(buttons.NextButton) -} - -Controller.prototype.LicenseAgreementPageCallback = function() -{ - var page = gui.pageWidgetByObjectName("LicenseAgreementPage") - page.AcceptLicenseRadioButton.setChecked(true) -} - -// skip qt account creation -Controller.prototype.CredentialsPageCallback = function() -{ - var page = gui.pageWidgetByObjectName("CredentialsPage") - page.EmailLineEdit.setText("[no-mail]") - page.PasswordLineEdit.setText("[your_password_here]") - page.ServiceTermsCheckBox.setChecked(true) - // installer logic expects clicked signal to be set - // to enable switch to next page - page.ServiceTermsCheckBox.clicked() - gui.clickButton(buttons.NextButton) -} - -Controller.prototype.IntroductionPageCallback = function() -{ - gui.clickButton(buttons.NextButton) -} - -Controller.prototype.TargetDirectoryPageCallback = function() -{ - var page = gui.pageWidgetByObjectName("TargetDirectoryPage") - // set target directory - page.TargetDirectoryLineEdit.text = "/opt/android/Qt5.6.0" - gui.clickButton(buttons.NextButton) -} - -// accept license agreement -Controller.prototype.LicenseAgreementPageCallback = function() -{ - var pageAgreement = gui.pageWidgetByObjectName("LicenseAgreementPage") - pageAgreement.AcceptLicenseRadioButton.setChecked(true) - gui.clickButton(buttons.NextButton) -} - -// select components -Controller.prototype.ComponentSelectionPageCallback = function() -{ - var page = gui.pageWidgetByObjectName("ComponentSelectionPage") - page.deselectAll() - page.selectComponent("qt.56.android_armv7") - page.selectComponent("qt.56.qtquickcontrols") - page.selectComponent("qt.56.qtscript") - page.selectComponent("qt.56.qtlocation") - page.selectComponent("qt.56.qt3d") - - gui.clickButton(buttons.NextButton) -} - -// confirm selected components -Controller.prototype.ReadyForInstallationPageCallback = function() -{ - gui.clickButton(buttons.CommitButton) -} - -Controller.prototype.PerformInstallationPageCallback = function() -{ - // IMPORTANT: if you ever run this script with "--verbose", - // then you will encounter the "funny" behavior that the - // commit-button is not activated correctly after the installation - // finished. - // A possible workaround is to uncomment the following line, which - // calls the next-button with a 60-second timeout. This means, after - // the button gets enabled in the UI. - // console.log("Timeout for installation: 60 sec, next-button is activated afterward.") - // gui.clickButton(buttons.NextButton, 60000) - gui.clickButton(buttons.CommitButton) -} - -Controller.prototype.FinishedPageCallback = function() -{ - console.log("Installation finished.") - var page = gui.pageWidgetByObjectName("FinishedPage") - console.log(page.LaunchQtCreatorCheckBoxForm.launchQtCreatorCheckBox.setChecked(false)); - gui.clickButton(buttons.FinishButton) -} -