[glib: 2/3] ci: Add latest Android API level 28
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/3] ci: Add latest Android API level 28
- Date: Wed, 27 Jun 2018 14:35:41 +0000 (UTC)
commit cf9613056c894e0525dd0e5c262e85cab64d5f83
Author: Xavier Claessens <xavier claessens collabora com>
Date: Tue Jun 26 13:18:29 2018 -0400
ci: Add latest Android API level 28
- Split the download part into a separate script to so docker keeps that
step in cache and avoid redownloading it.
- With API level >= 28 libiconv is not needed anymore because it's part
of Android's libc.
- Generate standalone toolchains to reduce the docker image size. It's
also easier because it doesn't need to pass sysroot args.
- Use clang compiler because gcc is deprecated in this Android NDK and
will be removed in the next release.
.gitlab-ci.yml | 9 +++-
.gitlab-ci/Dockerfile | 11 +++-
.gitlab-ci/android-download-ndk.sh | 31 +++++++++++
.gitlab-ci/android-setup-env.sh | 100 ++++++++++++++++++++++++++++++++++
.gitlab-ci/run-docker.sh | 2 +-
.gitlab-ci/setup-android-ndk.sh | 108 -------------------------------------
6 files changed, 149 insertions(+), 112 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2454479c0..e57122ece 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,4 @@
-image: registry.gitlab.gnome.org/gnome/glib/master:v4
+image: registry.gitlab.gnome.org/gnome/glib/master:v5
stages:
- build
@@ -48,6 +48,13 @@ cross-android_api21_arm64:
- meson --cross-file=/opt/cross_file_android_arm64_21.txt -Diconv=gnu -Dinternal_pcre=true --buildtype
debug _build
- ninja -C _build
+cross-android_api28_arm64:
+ <<: *cross-template
+ script:
+ # FIXME: add --werror
+ - meson --cross-file=/opt/cross_file_android_arm64_28.txt -Dinternal_pcre=true --buildtype debug _build
+ - ninja -C _build
+
cross-mingw64:
<<: *cross-template
script:
diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile
index eb21ed2a3..06944ae98 100644
--- a/.gitlab-ci/Dockerfile
+++ b/.gitlab-ci/Dockerfile
@@ -25,6 +25,7 @@ RUN dnf -y install \
mingw64-gettext \
mingw64-libffi \
mingw64-zlib \
+ ncurses-compat-libs \
ninja-build \
pcre-devel \
python3 \
@@ -36,8 +37,14 @@ RUN dnf -y install \
zlib-devel \
&& dnf clean all
-COPY setup-android-ndk.sh .
-RUN ./setup-android-ndk.sh
+WORKDIR /opt
+ENV ANDROID_NDK_PATH /opt/android-ndk
+COPY android-download-ndk.sh .
+RUN ./android-download-ndk.sh
+COPY android-setup-env.sh .
+RUN ./android-setup-env.sh arm64 21
+RUN ./android-setup-env.sh arm64 28
+RUN rm -rf $ANDROID_NDK_PATH
COPY cross_file_mingw64.txt /opt
diff --git a/.gitlab-ci/android-download-ndk.sh b/.gitlab-ci/android-download-ndk.sh
new file mode 100755
index 000000000..785ee0189
--- /dev/null
+++ b/.gitlab-ci/android-download-ndk.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+#
+# Copyright 2018 Collabora ltd.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Xavier Claessens <xavier claessens collabora com>
+#
+
+set -e
+
+# Download Android NDK
+ANDROID_NDK_VERSION="r17b"
+ANDROID_NDK_SHA512="062fac12f747730f5563995089a8b4abab683fbbc621aa8582fdf35fe327daee5d69ed2437af257c10ec4ef54ecd3805a8f134a1400eb8f34ee76f55c8dc9ae9"
+wget --quiet https://dl.google.com/android/repository/android-ndk-$ANDROID_NDK_VERSION-linux-x86_64.zip
+echo "$ANDROID_NDK_SHA512 android-ndk-$ANDROID_NDK_VERSION-linux-x86_64.zip" | sha512sum -c
+unzip android-ndk-$ANDROID_NDK_VERSION-linux-x86_64.zip
+rm android-ndk-$ANDROID_NDK_VERSION-linux-x86_64.zip
+mv android-ndk-$ANDROID_NDK_VERSION $ANDROID_NDK_PATH
diff --git a/.gitlab-ci/android-setup-env.sh b/.gitlab-ci/android-setup-env.sh
new file mode 100755
index 000000000..510056f66
--- /dev/null
+++ b/.gitlab-ci/android-setup-env.sh
@@ -0,0 +1,100 @@
+#!/bin/bash
+
+#
+# Copyright 2018 Collabora ltd.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, see <http://www.gnu.org/licenses/>.
+#
+# Author: Xavier Claessens <xavier claessens collabora com>
+#
+
+set -e
+
+arch=$1
+api=$2
+toolchain_path=$(pwd)/android-toolchain-$arch-$api
+prefix_path=$(pwd)/android-$arch-$api
+
+# Create standalone toolchains
+$ANDROID_NDK_PATH/build/tools/make_standalone_toolchain.py --arch $arch --api $api --install-dir
$toolchain_path
+
+target_host=aarch64-linux-android
+export AR=$target_host-ar
+export AS=$target_host-clang
+export CC=$target_host-clang
+export CXX=$target_host-clang++
+export LD=$target_host-ld
+export STRIP=$target_host-strip
+export PATH=$PATH:$toolchain_path/bin
+
+# Cross build libiconv when using API level <= 28.
+# Newer Android has it in its libc already.
+if [ "$api" -lt "28" ]; then
+ wget --quiet http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz
+ echo
"1233fe3ca09341b53354fd4bfe342a7589181145a1232c9919583a8c9979636855839049f3406f253a9d9829908816bb71fd6d34dd544ba290d6f04251376b1a
libiconv-1.15.tar.gz" | sha512sum -c
+ tar xzf libiconv-1.15.tar.gz
+ pushd libiconv-1.15
+ ./configure --host=$target_host --prefix=$prefix_path --libdir=$prefix_path/lib64
+ make
+ make install
+ popd
+ rm libiconv-1.15.tar.gz
+ rm -r libiconv-1.15
+fi
+
+# Cross build libffi
+wget --quiet https://github.com/libffi/libffi/releases/download/v3.3-rc0/libffi-3.3-rc0.tar.gz
+echo
"e6e695d32cd6eb7d65983f32986fccdfc786a593d2ea18af30ce741f58cfa1eb264b1a8d09df5084cb916001aea15187b005c2149a0620a44397a4453b6137d4
libffi-3.3-rc0.tar.gz" | sha512sum -c
+tar xzf libffi-3.3-rc0.tar.gz
+pushd libffi-3.3-rc0
+./configure --host=$target_host --prefix=$prefix_path --libdir=$prefix_path/lib64
+make
+make install
+popd
+rm libffi-3.3-rc0.tar.gz
+rm -r libffi-3.3-rc0
+
+# Create a pkg-config wrapper that won't pick fedora libraries
+mkdir -p $prefix_path/bin
+export PKG_CONFIG=$prefix_path/bin/pkg-config
+cat > $PKG_CONFIG <<- EOM
+#!/bin/sh
+SYSROOT=${prefix_path}
+export PKG_CONFIG_DIR=
+export PKG_CONFIG_LIBDIR=\${SYSROOT}/lib64/pkgconfig
+export PKG_CONFIG_SYSROOT_DIR=\${SYSROOT}
+exec pkg-config "\$@"
+EOM
+chmod +x $PKG_CONFIG
+
+# Create a cross file that can be passed to meson
+cat > cross_file_android_${arch}_${api}.txt <<- EOM
+[host_machine]
+system = 'android'
+cpu_family = 'arm64'
+cpu = 'arm64'
+endian = 'little'
+
+[properties]
+c_args = ['-I${prefix_path}/include']
+c_link_args = ['-L${prefix_path}/lib64',
+ '-fuse-ld=gold']
+
+[binaries]
+c = '${toolchain_path}/bin/${CC}'
+cpp = '${toolchain_path}/bin/${CXX}'
+ar = '${toolchain_path}/bin/${AR}'
+strip = '${toolchain_path}/bin/${STRIP}'
+pkgconfig = '${PKG_CONFIG}'
+EOM
diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh
index aeb878c9e..59b5c8d08 100755
--- a/.gitlab-ci/run-docker.sh
+++ b/.gitlab-ci/run-docker.sh
@@ -2,7 +2,7 @@
set -e
-TAG="registry.gitlab.gnome.org/gnome/glib/master:v4"
+TAG="registry.gitlab.gnome.org/gnome/glib/master:v5"
docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
--file "Dockerfile" .
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]