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@engestrom.ch>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13164>
This commit is contained in:
Bas Nieuwenhuizen 2021-10-03 17:34:29 +02:00 committed by Marge Bot
parent 1b945a695a
commit d14cc308f9
2 changed files with 46 additions and 1 deletions

View File

@ -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:

View File

@ -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