Eric Anholt | 0767af3 | 2020-09-09 16:37:54 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | set -ex |
| 4 | |
| 5 | EPHEMERAL="\ |
| 6 | rdfind \ |
| 7 | unzip \ |
| 8 | " |
| 9 | |
| 10 | apt-get install -y --no-remove $EPHEMERAL |
| 11 | |
| 12 | # Fetch the NDK and extract just the toolchain we want. |
| 13 | ndk=android-ndk-r21d |
| 14 | wget -O $ndk.zip https://dl.google.com/android/repository/$ndk-linux-x86_64.zip |
| 15 | unzip -d / $ndk.zip "$ndk/toolchains/llvm/*" |
| 16 | rm $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. |
| 19 | rdfind -makehardlinks true -makeresultsfile false /android-ndk-r21d/ |
| 20 | # Drop some large tools we won't use in this build. |
| 21 | find /android-ndk-r21d/ -type f | egrep -i "clang-check|clang-tidy|lldb" | xargs rm -f |
| 22 | |
| 23 | sh .gitlab-ci/create-android-ndk-pc.sh /$ndk zlib.pc "" "-lz" "1.2.3" |
| 24 | |
| 25 | sh .gitlab-ci/create-android-cross-file.sh /$ndk x86_64-linux-android x86_64 x86_64 |
| 26 | sh .gitlab-ci/create-android-cross-file.sh /$ndk i686-linux-android x86 x86 |
| 27 | sh .gitlab-ci/create-android-cross-file.sh /$ndk aarch64-linux-android arm armv8 |
| 28 | sh .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. |
| 32 | export LIBDRM_VERSION=libdrm-2.4.102 |
| 33 | wget https://dri.freedesktop.org/libdrm/$LIBDRM_VERSION.tar.xz |
| 34 | tar -xf $LIBDRM_VERSION.tar.xz && rm $LIBDRM_VERSION.tar.xz |
| 35 | |
| 36 | for 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 .. |
| 56 | done |
| 57 | |
| 58 | rm -rf $LIBDRM_VERSION |
| 59 | |
| 60 | apt-get purge -y $EPHEMERAL |