blob: 1fdc9f739d95039e00c6d70f06a2c2021c823875 [file] [log] [blame]
William A. Kennington IIIac69b482021-06-02 12:28:27 -07001From a530eed9e7e6872e10fe92efaf1e9739471c30ca Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sun, 30 May 2021 08:30:28 -0700
4Subject: [PATCH] meson: Add option to pass cpu
5
6This helps with cross compile setups, where host_cpu != target_cpu
7therefore detecting it on the fly will end up with wrong cpu to build
8for
9
10Upstream-Status: Submitted [https://github.com/kaniini/libucontext/pull/28]
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 meson.build | 6 +++++-
14 meson_options.txt | 4 +++-
15 2 files changed, 8 insertions(+), 2 deletions(-)
16
17diff --git a/meson.build b/meson.build
18index e863780..2b4bdbd 100644
19--- a/meson.build
20+++ b/meson.build
21@@ -6,7 +6,11 @@ project(
22 version : run_command('head', files('VERSION')).stdout()
23 )
24
25-cpu = host_machine.cpu_family()
26+cpu = get_option('cpu')
27+if cpu == ''
28+ cpu = host_machine.cpu_family()
29+endif
30+
31 if cpu == 'sh4'
32 cpu = 'sh'
33 endif
34diff --git a/meson_options.txt b/meson_options.txt
35index d4201d1..864d83c 100644
36--- a/meson_options.txt
37+++ b/meson_options.txt
38@@ -1,4 +1,6 @@
39 option('freestanding', type : 'boolean', value : false,
40 description: 'Do not use system headers')
41 option('export_unprefixed', type : 'boolean', value : true,
42- description: 'Export POSIX 2004 ucontext names as alises')
43\ No newline at end of file
44+ description: 'Export POSIX 2004 ucontext names as alises')
45+option('cpu', type : 'string', value : '',
46+ description: 'Target CPU architecture for cross compile')
47--
482.31.1
49