From 575afde01a1280200721cb566aacc2db71adacb4 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Fri, 31 Jan 2025 12:40:01 +0000 Subject: [PATCH] build-aux: Add convenience files to cross-compile for arm64 This is a useful way to check that non-x86 builds aren't regressing, without actually needing a non-x86 device. Not all tests will pass in this configuration because qemu-user is not a perfect emulation of a real aarch64 machine (for example PR_GET_CHILD_SUBREAPER is unimplemented), but it's better than nothing. In particular, the adverb-preload and wrap-setup tests pass, and those are the ones I'm altering for steamrt/tasks#595. Signed-off-by: Simon McVittie <smcv@collabora.com> --- build-aux/many-builds.py | 13 +++++++++++++ build-aux/meson/arm64.txt | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 build-aux/meson/arm64.txt diff --git a/build-aux/many-builds.py b/build-aux/many-builds.py index 9b72d979c..abbd5449a 100755 --- a/build-aux/many-builds.py +++ b/build-aux/many-builds.py @@ -53,6 +53,8 @@ _build/ coverage/ Build for host system with coverage doc/ Build for host system with gtk-doc and pandoc host-no-asan/ No AddressSanitizer, for use with valgrind + arm64/ Build for host system for arm64, as an + example of a non-x86 platform i386/ Build for host system for i386 """ @@ -298,6 +300,17 @@ class Environment: ] + args, ) + self.setup_one( + 'arm64', + dev_build + [ + '-Dintrospection=disabled', + '-Dmultiarch_tuple=aarch64-linux-gnu', + '--cross-file=build-aux/meson/arm64.txt', + ] + args, + # Host system doesn't necessarily have an arm64 toolchain + check=False, + ) + self.setup_one( 'i386', asan_dev_build + [ diff --git a/build-aux/meson/arm64.txt b/build-aux/meson/arm64.txt new file mode 100644 index 000000000..afa1aed2f --- /dev/null +++ b/build-aux/meson/arm64.txt @@ -0,0 +1,41 @@ +# Copyright 2022-2025 Collabora Ltd. +# SPDX-License-Identifier: MIT +# +# Loosely based on the output of: +# /usr/share/meson/debcrossgen --arch arm64 + +[constants] +DEB_HOST_GNU_TYPE = 'aarch64-linux-gnu' +DEB_HOST_MULTIARCH = 'aarch64-linux-gnu' + +[binaries] +c = DEB_HOST_GNU_TYPE + '-gcc' +cpp = DEB_HOST_GNU_TYPE + '-g++' +ar = DEB_HOST_GNU_TYPE + '-ar' +strip = DEB_HOST_GNU_TYPE + '-strip' +objcopy = DEB_HOST_GNU_TYPE + '-objcopy' +ld = DEB_HOST_GNU_TYPE + '-ld' +pkgconfig = DEB_HOST_GNU_TYPE + '-pkg-config' +pkg-config = DEB_HOST_GNU_TYPE + '-pkg-config' +cmake = 'cmake' +cups-config = 'cups-config' +sdl2-config = 'sdl2-config' + +[built-in options] +libdir = 'lib' / DEB_HOST_MULTIARCH + +[properties] +# This assumes that if we will run tests, we have qemu-static installed +needs_exe_wrapper = false + +[cmake] +CMAKE_C_COMPILER = DEB_HOST_GNU_TYPE + '-gcc' +CMAKE_CXX_COMPILER = DEB_HOST_GNU_TYPE + '-g++' +CMAKE_SYSTEM_NAME = 'Linux' +CMAKE_SYSTEM_PROCESSOR = 'aarch64' + +[host_machine] +system = 'linux' +cpu_family = 'aarch64' +cpu = 'arm64' +endian = 'little' -- GitLab