Changeset View
Changeset View
Standalone View
Standalone View
image/Dockerfile
1 | FROM ubuntu:wily | 1 | FROM ubuntu:bionic | ||
---|---|---|---|---|---|
2 | 2 | | |||
3 | LABEL Description="KDE on Android SDK" | 3 | LABEL Description="KDE on Android SDK" | ||
4 | MAINTAINER Andreas Cord-Landwehr <cordlandwehr@kde.org> | 4 | LABEL Maintainer="Andreas Cord-Landwehr <cordlandwehr@kde.org>" | ||
5 | 5 | | |||
6 | ENV ADIR /opt/android | 6 | # First get a base ubuntu system with the right packages installed | ||
7 | RUN mkdir -p $ADIR | | |||
8 | 7 | | |||
9 | # set ANDROID_* environment variables globally | 8 | ENV DEBIAN_FRONTEND noninteractive | ||
10 | RUN echo "\n\ | 9 | ENV DEBCONF_NONINTERACTIVE_SEEN true | ||
11 | ANDROID_NDK=/opt/android/android-ndk-r10e\n\ | | |||
12 | ANDROID_SDK_ROOT=/opt/android/android-sdk-linux\n\ | | |||
13 | " >> /etc/environment | | |||
14 | 10 | | |||
15 | # skeleton files that are used for all users | 11 | RUN echo "deb [arch=armhf] http://ports.ubuntu.com/ bionic main universe restricted\n\ | ||
16 | RUN echo "\n\ | 12 | deb-src [arch=armhf] http://ports.ubuntu.com/ bionic main universe restricted\n\ | ||
17 | export ADIR=$ADIR\n\ | | |||
18 | export Qt5_android=$ADIR/Qt5.6.0/5.6/android_armv7/\n\ | | |||
19 | export PATH=$ADIR/android-sdk-linux/platform-tools/:$PATH\n\ | | |||
20 | export ANT=/usr/bin/ant\n\ | | |||
21 | export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/\n\ | | |||
22 | \n\ | 13 | \n\ | ||
23 | function cmakeandroid {\n\ | 14 | deb [arch=armhf] http://ports.ubuntu.com/ bionic-updates main universe restricted\n\ | ||
24 | 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\ | 15 | deb-src [arch=armhf] http://ports.ubuntu.com/ bionic-updates main universe restricted\n\ | ||
25 | }\n\ | | |||
26 | " >> /etc/skel/.bashrc | | |||
27 | | ||||
28 | RUN echo "deb [arch=armhf] http://ports.ubuntu.com/ wily main universe restricted\n\ | | |||
29 | deb-src [arch=armhf] http://ports.ubuntu.com/ wily main universe restricted\n\ | | |||
30 | \n\ | 16 | \n\ | ||
31 | deb [arch=armhf] http://ports.ubuntu.com/ wily-updates main universe restricted\n\ | 17 | deb [arch=i386,amd64] http://archive.ubuntu.com/ubuntu bionic main universe restricted\n\ | ||
32 | deb-src [arch=armhf] http://ports.ubuntu.com/ wily-updates main universe restricted\n\ | 18 | deb-src [arch=i386,amd64] http://archive.ubuntu.com/ubuntu bionic main universe restricted\n\ | ||
33 | \n\ | 19 | \n\ | ||
34 | deb [arch=i386,amd64] http://archive.ubuntu.com/ubuntu wily main universe restricted\n\ | 20 | deb [arch=i386,amd64] http://archive.ubuntu.com/ubuntu bionic-updates main universe restricted\n\ | ||
35 | deb-src [arch=i386,amd64] http://archive.ubuntu.com/ubuntu wily main universe restricted\n\ | 21 | deb-src [arch=i386,amd64] http://archive.ubuntu.com/ubuntu bionic-updates main universe restricted\n\ | ||
36 | \n\ | | |||
37 | deb [arch=i386,amd64] http://archive.ubuntu.com/ubuntu wily-updates main universe restricted\n\ | | |||
38 | deb-src [arch=i386,amd64] http://archive.ubuntu.com/ubuntu wily-updates main universe restricted\n\ | | |||
39 | " > /etc/apt/sources.list | 22 | " > /etc/apt/sources.list | ||
40 | 23 | | |||
41 | # enable verbose apt-get output | 24 | # enable verbose apt-get output | ||
42 | RUN echo 'Debug::pkgProblemResolver "true";' > /etc/apt/apt.conf.d/debug | 25 | RUN echo 'Debug::pkgProblemResolver "true";' > /etc/apt/apt.conf.d/debug | ||
43 | RUN dpkg --add-architecture i386 && apt update && apt-get install -y \ | 26 | RUN dpkg --add-architecture i386 && apt update && apt-get install -y \ | ||
44 | ant \ | 27 | ant \ | ||
45 | build-essential \ | 28 | build-essential \ | ||
46 | cmake \ | 29 | cmake \ | ||
47 | curl \ | 30 | curl \ | ||
48 | expect \ | 31 | expect \ | ||
49 | git \ | 32 | git \ | ||
33 | unzip \ | ||||
50 | # required for running kdesrc-build | 34 | # required for running kdesrc-build | ||
51 | libxml-simple-perl \ | 35 | libxml-simple-perl \ | ||
52 | libjson-perl \ | 36 | libjson-perl \ | ||
53 | openjdk-7-jdk \ | 37 | libyaml-syck-perl \ | ||
54 | openjdk-7-jre \ | 38 | openjdk-8-jdk \ | ||
39 | openjdk-8-jre \ | ||||
55 | qt5-qmake \ | 40 | qt5-qmake \ | ||
56 | ssh \ | 41 | ssh \ | ||
57 | sudo \ | 42 | sudo \ | ||
58 | # required for ki18n | 43 | # required for ki18n | ||
59 | gettext \ | 44 | gettext \ | ||
60 | # virtual framebuffer to provide X window for the Qt installer and unit tests | 45 | # virtual framebuffer to provide X window for unit tests | ||
61 | xvfb \ | 46 | xvfb \ | ||
62 | # required for CI unit tests | 47 | # required for CI unit tests | ||
63 | openbox \ | 48 | openbox \ | ||
64 | # required i386 architecture libraries | 49 | # required i386 architecture libraries | ||
65 | libgcc1:i386 \ | 50 | libgcc1:i386 \ | ||
66 | libc6:i386 \ | 51 | libc6:i386 \ | ||
67 | zlib1g:i386 \ | 52 | zlib1g:i386 \ | ||
68 | # required for CI buildsystem | 53 | # required for CI buildsystem | ||
69 | python3-lxml \ | 54 | python3-lxml \ | ||
70 | python2.7 \ | 55 | python2.7 \ | ||
71 | python-lxml \ | 56 | python-lxml \ | ||
72 | gcovr | 57 | gcovr | ||
73 | 58 | | |||
59 | # Now let's start with the Android setup | ||||
60 | | ||||
61 | ENV ADIR /opt/android | ||||
62 | RUN mkdir -p $ADIR | ||||
63 | | ||||
64 | ENV ANDROID_NDK /opt/android/android-ndk-r15c | ||||
65 | ENV ANDROID_SDK_ROOT /opt/android/android-sdk-linux | ||||
66 | ENV QTPREFIX $ADIR/Qt | ||||
67 | | ||||
68 | # skeleton files that are used for all users | ||||
69 | RUN echo "\n\ | ||||
70 | export ANDROID_NDK=$ANDROID_NDK\n\ | ||||
71 | export ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT\n\ | ||||
72 | export ADIR=$ADIR\n\ | ||||
73 | export QTPREFIX=$QTPREFIX/\n\ | ||||
74 | export PATH=$ADIR/android-sdk-linux/platform-tools/:$PATH\n\ | ||||
75 | export ANT=/usr/bin/ant\n\ | ||||
76 | export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/\n\ | ||||
77 | \n\ | ||||
78 | function cmakeandroid {\n\ | ||||
79 | 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\ | ||||
80 | }\n\ | ||||
81 | " >> /etc/skel/.bashrc | ||||
82 | | ||||
74 | RUN groupadd -g 1000 jenkins && \ | 83 | RUN groupadd -g 1000 jenkins && \ | ||
75 | useradd -m -u 1000 -g 1000 -d /home/jenkins jenkins && \ | 84 | useradd -m -u 1000 -g 1000 -d /home/jenkins jenkins && \ | ||
76 | echo 'jenkins:jenkins' | chpasswd && \ | 85 | echo 'jenkins:jenkins' | chpasswd && \ | ||
77 | echo "jenkins ALL=NOPASSWD:ALL" >> /etc/sudoers | 86 | echo "jenkins ALL=NOPASSWD:ALL" >> /etc/sudoers | ||
78 | 87 | | |||
79 | RUN addgroup builders && \ | 88 | RUN addgroup builders && \ | ||
80 | usermod -G builders jenkins | 89 | usermod -G builders jenkins | ||
81 | 90 | | |||
Show All 26 Lines | 113 | RUN echo "Download SDK..." && \ | |||
108 | tar xfl $ADIR/android-sdk.tgz -C $ADIR/ && \ | 117 | tar xfl $ADIR/android-sdk.tgz -C $ADIR/ && \ | ||
109 | echo "SDK: updating..." && \ | 118 | echo "SDK: updating..." && \ | ||
110 | $ADIR/accept-sdk-license.sh $ADIR && \ | 119 | $ADIR/accept-sdk-license.sh $ADIR && \ | ||
111 | rm $ADIR/accept-sdk-license.sh && \ | 120 | rm $ADIR/accept-sdk-license.sh && \ | ||
112 | rm $ADIR/android-sdk.tgz && \ | 121 | rm $ADIR/android-sdk.tgz && \ | ||
113 | echo "SDK: done." | 122 | echo "SDK: done." | ||
114 | 123 | | |||
115 | # get NDK | 124 | # get NDK | ||
125 | # - should be more recent than 10e, as recommended when using clang, see https://wiki.qt.io/Android | ||||
126 | # - but can't be r18b because that requires cmake >= 3.12.2 (see commit ca97d4cb5 in cmake git) | ||||
116 | RUN echo "Download NDK..." && \ | 127 | RUN echo "Download NDK..." && \ | ||
117 | curl http://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin -o $ADIR/android-ndk.bin && \ | 128 | curl https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip -o $ADIR/android-ndk.zip && \ | ||
118 | echo "NDK: unpacking..." && \ | 129 | echo "NDK: unpacking..." && \ | ||
119 | chmod +x $ADIR/android-ndk.bin && \ | | |||
120 | cd $ADIR && \ | 130 | cd $ADIR && \ | ||
121 | ./android-ndk.bin && \ | 131 | unzip ./android-ndk.zip && \ | ||
122 | cd / && \ | 132 | cd / && \ | ||
123 | rm $ADIR/android-ndk.bin && \ | 133 | rm $ADIR/android-ndk.zip && \ | ||
124 | echo "NDK: done." | 134 | echo "NDK: done." | ||
125 | 135 | | |||
126 | #get Qt for Android | 136 | # Qt | ||
127 | RUN echo "Qt Installer: downloading..." && \ | 137 | # 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 | ||
128 | 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 && \ | 138 | ENV qtplatform android-clang | ||
129 | chmod +x $ADIR/qt-installer.run | 139 | ENV qtversion 5.12.0 | ||
130 | 140 | ENV qtversionshort 5.12 | |||
131 | COPY qtinstallerconfig.qs $ADIR/qtinstallerconfig.qs | 141 | | ||
132 | # run visual installer with simulated X window, filter out all warning messages due to not having a proper window | 142 | #build qtbase | ||
133 | RUN xvfb-run -a $ADIR/qt-installer.run --script $ADIR/qtinstallerconfig.qs|grep -v "Warning: QPainter" | grep -v "Warning: QWidget" && \ | 143 | ENV qtmodule qtbase | ||
134 | echo "Qt Installer: done." | 144 | RUN echo "$qtmodule: downloading and compiling..." && \ | ||
145 | curl http://master.qt.io/archive/qt/$qtversionshort/$qtversion/submodules/${qtmodule}-everywhere-src-$qtversion.tar.xz -o $ADIR/${qtmodule}.tar.xz && \ | ||||
146 | cd $ADIR && \ | ||||
147 | tar xf ${qtmodule}.tar.xz && \ | ||||
148 | cd ${qtmodule}-everywhere-src-$qtversion && \ | ||||
149 | 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" && \ | ||||
150 | ./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 && \ | ||||
151 | make -j `getconf _NPROCESSORS_ONLN` && \ | ||||
152 | make install && \ | ||||
153 | cd / && \ | ||||
154 | rm $ADIR/${qtmodule}.tar.xz && \ | ||||
155 | rm -rf $ADIR/${qtmodule}-everywhere-src-$qtversion | ||||
156 | | ||||
157 | #build qtdeclarative | ||||
158 | ENV qtmodule qtdeclarative | ||||
159 | RUN echo "$qtmodule: downloading and compiling..." && \ | ||||
160 | curl http://master.qt.io/archive/qt/$qtversionshort/$qtversion/submodules/${qtmodule}-everywhere-src-$qtversion.tar.xz -o $ADIR/${qtmodule}.tar.xz && \ | ||||
161 | cd $ADIR && \ | ||||
162 | tar xf ${qtmodule}.tar.xz && \ | ||||
163 | cd ${qtmodule}-everywhere-src-$qtversion && \ | ||||
164 | $QTPREFIX/bin/qmake && \ | ||||
165 | make -j `getconf _NPROCESSORS_ONLN` && \ | ||||
166 | make install && \ | ||||
167 | cd / && \ | ||||
168 | rm $ADIR/${qtmodule}.tar.xz && \ | ||||
169 | rm -rf $ADIR/${qtmodule}-everywhere-src-$qtversion | ||||
170 | | ||||
171 | #build qtlocation | ||||
172 | ENV qtmodule qtlocation | ||||
173 | RUN echo "$qtmodule: downloading and compiling..." && \ | ||||
174 | curl http://master.qt.io/archive/qt/$qtversionshort/$qtversion/submodules/${qtmodule}-everywhere-src-$qtversion.tar.xz -o $ADIR/${qtmodule}.tar.xz && \ | ||||
175 | cd $ADIR && \ | ||||
176 | tar xf ${qtmodule}.tar.xz && \ | ||||
177 | cd ${qtmodule}-everywhere-src-$qtversion && \ | ||||
178 | $QTPREFIX/bin/qmake && \ | ||||
179 | make -j `getconf _NPROCESSORS_ONLN` && \ | ||||
180 | make install && \ | ||||
181 | cd / && \ | ||||
182 | rm $ADIR/${qtmodule}.tar.xz && \ | ||||
183 | rm -rf $ADIR/${qtmodule}-everywhere-src-$qtversion | ||||
135 | 184 | | |||
136 | # cleanup | 185 | # cleanup | ||
137 | RUN sudo apt-get remove -y\ | 186 | RUN sudo apt-get remove -y\ | ||
138 | expect \ | 187 | expect \ | ||
139 | curl && \ | 188 | curl && \ | ||
140 | sudo apt-get autoremove -y && \ | 189 | sudo apt-get autoremove -y | ||
141 | rm $ADIR/qt-installer.run && \ | | |||
142 | rm $ADIR/qtinstallerconfig.qs | | |||
143 | 190 | | |||
144 | # get KDESRC build and android configurations | 191 | # get KDESRC build and android configurations | ||
145 | RUN git clone git://anongit.kde.org/scratch/cordlandwehr/kdesrc-conf-android.git $ADIR/kdesrc-conf-android && \ | 192 | RUN git clone git://anongit.kde.org/scratch/cordlandwehr/kdesrc-conf-android.git $ADIR/kdesrc-conf-android && \ | ||
146 | mkdir -p $ADIR/extragear/kdesrc-build && \ | 193 | mkdir -p $ADIR/extragear/kdesrc-build && \ | ||
147 | git clone git://anongit.kde.org/kdesrc-build $ADIR/extragear/kdesrc-build && \ | 194 | git clone git://anongit.kde.org/kdesrc-build $ADIR/extragear/kdesrc-build && \ | ||
148 | ln -s $ADIR/extragear/kdesrc-build/kdesrc-build $ADIR/kdesrc-build && \ | 195 | ln -s $ADIR/extragear/kdesrc-build/kdesrc-build $ADIR/kdesrc-build && \ | ||
149 | ln -s $ADIR/kdesrc-conf-android/kdesrc-buildrc $ADIR/kdesrc-buildrc | 196 | ln -s $ADIR/kdesrc-conf-android/kdesrc-buildrc $ADIR/kdesrc-buildrc | ||
150 | 197 | | |||
198 | # Build ECM so it's ready, and build KArchive to test that the cmake + ECM android toolchain setup is working OK | ||||
151 | RUN cd $ADIR && \ | 199 | RUN cd $ADIR && \ | ||
152 | ./kdesrc-build extra-cmake-modules | 200 | ./kdesrc-build \ | ||
201 | extra-cmake-modules \ | ||||
202 | karchive | ||||
153 | 203 | | |||
154 | RUN echo "Configuration finished, finalizing Docker image..." | 204 | RUN echo "Configuration finished, finalizing Docker image..." | ||
155 | 205 | | |||
156 | USER root | 206 | USER root | ||
157 | 207 | | |||
158 | CMD ["/usr/sbin/sshd", "-D"] | 208 | CMD ["/usr/sbin/sshd", "-D"] | ||
159 | 209 | |