blob: ffc42fff1496c84b8444efd0eb18c7e7be6ad697 [file] [log] [blame]
Eric Anholt0767af32020-09-09 16:37:54 -07001#!/bin/bash
2
3set -ex
4
5EPHEMERAL="\
6 rdfind \
7 unzip \
8 "
9
10apt-get install -y --no-remove $EPHEMERAL
11
12# Fetch the NDK and extract just the toolchain we want.
13ndk=android-ndk-r21d
14wget -O $ndk.zip https://dl.google.com/android/repository/$ndk-linux-x86_64.zip
15unzip -d / $ndk.zip "$ndk/toolchains/llvm/*"
16rm $ndk.zip
17# Since it was packed as a zip file, symlinks/hardlinks got turned into
18# duplicate files. Turn them into hardlinks to save on container space.
19rdfind -makehardlinks true -makeresultsfile false /android-ndk-r21d/
20# Drop some large tools we won't use in this build.
21find /android-ndk-r21d/ -type f | egrep -i "clang-check|clang-tidy|lldb" | xargs rm -f
22
23sh .gitlab-ci/create-android-ndk-pc.sh /$ndk zlib.pc "" "-lz" "1.2.3"
24
25sh .gitlab-ci/create-android-cross-file.sh /$ndk x86_64-linux-android x86_64 x86_64
26sh .gitlab-ci/create-android-cross-file.sh /$ndk i686-linux-android x86 x86
27sh .gitlab-ci/create-android-cross-file.sh /$ndk aarch64-linux-android arm armv8
28sh .gitlab-ci/create-android-cross-file.sh /$ndk arm-linux-androideabi arm armv7hl armv7a-linux-androideabi
29
30# Not using build-libdrm.sh because we don't want its cleanup after building
31# each arch. Fetch and extract now.
32export LIBDRM_VERSION=libdrm-2.4.102
33wget https://dri.freedesktop.org/libdrm/$LIBDRM_VERSION.tar.xz
34tar -xf $LIBDRM_VERSION.tar.xz && rm $LIBDRM_VERSION.tar.xz
35
36for arch in \
37 x86_64-linux-android \
38 i686-linux-android \
39 aarch64-linux-android \
40 arm-linux-androideabi ; do
41
42 cd $LIBDRM_VERSION
43 rm -rf build-$arch
44 meson build-$arch \
45 --cross-file=/cross_file-$arch.txt \
46 --libdir=lib/$arch \
47 -Dlibkms=false \
48 -Dnouveau=false \
49 -Dvc4=false \
50 -Detnaviv=false \
51 -Dfreedreno=false \
52 -Dintel=false \
53 -Dcairo-tests=false
54 ninja -C build-$arch install
55 cd ..
56done
57
58rm -rf $LIBDRM_VERSION
59
60apt-get purge -y $EPHEMERAL