blob: ba63812ca4183378959fab8414fdb6d7f1952d66 [file] [log] [blame]
Eric Anholt188916b2020-05-13 11:54:04 -07001#!/bin/bash
2
3arch=$1
4cross_file="/cross_file-$arch.txt"
5/usr/share/meson/debcrossgen --arch $arch -o "$cross_file"
6# Explicitly set ccache path for cross compilers
7sed -i "s|/usr/bin/\([^-]*\)-linux-gnu\([^-]*\)-g|/usr/lib/ccache/\\1-linux-gnu\\2-g|g" "$cross_file"
8if [ "$arch" = "i386" ]; then
9 # Work around a bug in debcrossgen that should be fixed in the next release
10 sed -i "s|cpu_family = 'i686'|cpu_family = 'x86'|g" "$cross_file"
11fi
12# Rely on qemu-user being configured in binfmt_misc on the host
13sed -i -e '/\[properties\]/a\' -e "needs_exe_wrapper = False" "$cross_file"
Eric Anholt588ea312020-05-14 10:38:12 -070014
15# Set up cmake cross compile toolchain file for dEQP builds
16toolchain_file="/toolchain-$arch.cmake"
17if [[ "$arch" = "arm64" ]]; then
18 GCC_ARCH="aarch64-linux-gnu"
19 DE_CPU="DE_CPU_ARM_64"
20 CMAKE_ARCH=arm
21elif [[ "$arch" = "armhf" ]]; then
22 GCC_ARCH="arm-linux-gnueabihf"
23 DE_CPU="DE_CPU_ARM"
24 CMAKE_ARCH=arm
25fi
26
27if [[ -n "$GCC_ARCH" ]]; then
28 echo "set(CMAKE_SYSTEM_NAME Linux)" > "$toolchain_file"
29 echo "set(CMAKE_SYSTEM_PROCESSOR arm)" >> "$toolchain_file"
30 echo "set(CMAKE_C_COMPILER /usr/lib/ccache/$GCC_ARCH-gcc)" >> "$toolchain_file"
31 echo "set(CMAKE_CXX_COMPILER /usr/lib/ccache/$GCC_ARCH-g++)" >> "$toolchain_file"
32 echo "set(ENV{PKG_CONFIG} \"/usr/bin/$GCC_ARCH-pkg-config\")" >> "$toolchain_file"
33 echo "set(DE_CPU $DE_CPU)" >> "$toolchain_file"
34fi