From 05967a1cd8f1a28a8507c6a684393398e73f1486 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Mon, 4 Nov 2019 20:00:18 +0000
Subject: [PATCH] build: Take multiarch tuple from Debian packaging

This allows steam-runtime-tools to be built as a Debian package with
nearly full functionality for as-yet-unsupported architectures, such as
the ARM family.

Builds using the upstream build system won't be fully functional without
something like -Dmultiarch_tuple=arm-linux-gnueabi (so maybe don't use
a Raspberry Pi as your primary development machine yet), and there is no
well-known constant SRT_ABI_xxx for non-x86 architectures.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 debian/rules      | 1 +
 meson.build       | 4 +++-
 meson_options.txt | 7 +++++++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/debian/rules b/debian/rules
index 110cd9dce..f419379e5 100755
--- a/debian/rules
+++ b/debian/rules
@@ -40,6 +40,7 @@ override_dh_auto_configure:
 		--libexecdir=/usr/libexec \
 		-Dgtk_doc=$(gtk_doc_has_cflags) \
 		-Dintrospection=false \
+		-Dmultiarch_tuple=$(DEB_HOST_MULTIARCH) \
 		$(NULL)
 
 override_dh_auto_build:
diff --git a/meson.build b/meson.build
index 55ca00642..046d480fc 100644
--- a/meson.build
+++ b/meson.build
@@ -155,7 +155,9 @@ pkglibexecdir = join_paths(
   'steam-runtime-tools-' + api_major,
 )
 
-if host_machine.cpu_family() == 'x86_64'
+if get_option('multiarch_tuple') != ''
+  multiarch = get_option('multiarch_tuple')
+elif host_machine.cpu_family() == 'x86_64'
   multiarch = 'x86_64-linux-gnu'
 elif host_machine.cpu_family() == 'x86'
   multiarch = 'i386-linux-gnu'
diff --git a/meson_options.txt b/meson_options.txt
index 9e52f2064..e4e201722 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -25,3 +25,10 @@ option(
   value : true,
   description : 'enable man pages',
 )
+
+option(
+  'multiarch_tuple',
+  type : 'string',
+  value : '',
+  description : 'Debian-style multiarch tuple',
+)
-- 
GitLab