Mesa (main): ci: Add libelf to the Android image.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Nov 9 21:21:40 UTC 2021
Module: Mesa
Branch: main
Commit: d14cc308f97e2a54b2b4165f9a9e895261674fee
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d14cc308f97e2a54b2b4165f9a9e895261674fee
Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date: Sun Oct 3 17:34:29 2021 +0200
ci: Add libelf to the Android image.
Needed for RADV.
The mirror situation is kinda messy since the library is not
maintained and the original website is offline. Put a mirror
in that seemed to be used by some non-fdo CIs already, but
if reliability is still a concern we can discuss more mirrors.
There is an alternative implementation that is maintained in
elfutils, but that doesn't build on Android:
1) Doesn't build with clang (resolved in git, so next release probably)
2) Needs argp_parse with is a glibc specific feature.
There is a version of elfutils in AOSP but instead of fixing upstream
they just made an Android.bp that avoids building most stuff, which
isn't really usable here.
Reviewed-by: Eric Engestrom <eric at engestrom.ch>
Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13164>
---
.gitlab-ci.yml | 2 +-
.gitlab-ci/container/debian/android_build.sh | 45 ++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 360a53239c7..fc3509ccfd0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -376,7 +376,7 @@ debian/android_build:
extends:
- .use-debian/x86_build-base
variables:
- MESA_IMAGE_TAG: &debian-android_build "2021-10-02-bump-libdrm-3"
+ MESA_IMAGE_TAG: &debian-android_build "2021-10-02-libelf-2"
.use-debian/android_build:
extends:
diff --git a/.gitlab-ci/container/debian/android_build.sh b/.gitlab-ci/container/debian/android_build.sh
index 45f75e1eb1f..54ec8cff6d7 100644
--- a/.gitlab-ci/container/debian/android_build.sh
+++ b/.gitlab-ci/container/debian/android_build.sh
@@ -3,6 +3,7 @@
set -ex
EPHEMERAL="\
+ autoconf \
rdfind \
unzip \
"
@@ -58,4 +59,48 @@ done
rm -rf $LIBDRM_VERSION
+export LIBELF_VERSION=libelf-0.8.13
+wget https://fossies.org/linux/misc/old/$LIBELF_VERSION.tar.gz
+
+# Not 100% sure who runs the mirror above so be extra careful
+if ! echo "4136d7b4c04df68b686570afa26988ac ${LIBELF_VERSION}.tar.gz" | md5sum -c -; then
+ echo "Checksum failed"
+ exit 1
+fi
+
+tar -xf ${LIBELF_VERSION}.tar.gz
+cd $LIBELF_VERSION
+
+# Work around a bug in the original configure not enabling __LIBELF64.
+autoreconf
+
+for arch in \
+ x86_64-linux-android \
+ i686-linux-android \
+ aarch64-linux-android \
+ arm-linux-androideabi ; do
+
+ ccarch=${arch}
+ if [ "${arch}" == 'arm-linux-androideabi' ]
+ then
+ ccarch=armv7a-linux-androideabi
+ fi
+
+ export CC=/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/${arch}-ar
+ export CC=/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/${ccarch}29-clang
+ export CXX=/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/${ccarch}29-clang++
+ export LD=/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/${arch}-ld
+ export RANLIB=/android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin/${arch}-ranlib
+
+ # The configure script doesn't know about android, but doesn't really use the host anyway it
+ # seems
+ ./configure --host=x86_64-linux-gnu --disable-nls --disable-shared \
+ --libdir=/usr/local/lib/${arch}
+ make install
+ make distclean
+done
+
+cd ..
+rm -rf $LIBELF_VERSION
+
apt-get purge -y $EPHEMERAL
More information about the mesa-commit
mailing list