William A. Kennington III | ac69b48 | 2021-06-02 12:28:27 -0700 | [diff] [blame] | 1 | From a530eed9e7e6872e10fe92efaf1e9739471c30ca Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Sun, 30 May 2021 08:30:28 -0700 |
| 4 | Subject: [PATCH] meson: Add option to pass cpu |
| 5 | |
| 6 | This helps with cross compile setups, where host_cpu != target_cpu |
| 7 | therefore detecting it on the fly will end up with wrong cpu to build |
| 8 | for |
| 9 | |
| 10 | Upstream-Status: Submitted [https://github.com/kaniini/libucontext/pull/28] |
| 11 | Signed-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 | |
| 17 | diff --git a/meson.build b/meson.build |
| 18 | index 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 |
| 34 | diff --git a/meson_options.txt b/meson_options.txt |
| 35 | index 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 | -- |
| 48 | 2.31.1 |
| 49 | |