nixos/homer: init (#368594)
[NixPkgs.git] / pkgs / development / libraries / mesa / cross_clc.patch
blobcb29e57ec349307512ac77a839557f387d98446e
1 commit f063e9f74b45f34e4ac570a90901253bf8e64efd
2 Author: Mary Guillemard <mary.guillemard@collabora.com>
3 Date: 2024-12-02 09:11:35 +0100
5 meson: Add mesa-clc and install-mesa-clc options
7 Due to the cross build issues in current meson, we adds new options to
8 allow mesa_clc and vtn_bindgen to be installed or searched on the
9 system.
11 Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
12 Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
13 Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
14 Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32719>
16 diff --git a/meson.build b/meson.build
17 index de9c9af53a1..e37325ec176 100644
18 --- a/meson.build
19 +++ b/meson.build
20 @@ -808,7 +808,7 @@ if with_gallium_rusticl or with_nouveau_vk or with_tools.contains('etnaviv')
21 endif
23 with_clover_spirv = with_gallium_clover and get_option('opencl-spirv')
24 -with_clc = with_microsoft_clc or with_intel_clc or with_gallium_asahi or with_asahi_vk or with_gallium_rusticl or with_clover_spirv
25 +with_clc = get_option('mesa-clc') != 'auto' or with_microsoft_clc or with_intel_clc or with_gallium_asahi or with_asahi_vk or with_gallium_rusticl
27 dep_clc = null_dep
28 if with_gallium_clover or with_clc
29 diff --git a/meson_options.txt b/meson_options.txt
30 index 79ee65e6094..8f22b36e5fb 100644
31 --- a/meson_options.txt
32 +++ b/meson_options.txt
33 @@ -744,3 +744,20 @@ option(
34 'none', 'dri2'
38 +option(
39 + 'mesa-clc',
40 + type : 'combo',
41 + value : 'auto',
42 + choices : [
43 + 'enabled', 'system', 'auto'
44 + ],
45 + description : 'Build the mesa-clc compiler or use a system version.'
48 +option(
49 + 'install-mesa-clc',
50 + type : 'boolean',
51 + value : false,
52 + description : 'Install the mesa-clc compiler (if needed for cross builds).'
54 diff --git a/src/compiler/clc/meson.build b/src/compiler/clc/meson.build
55 index 74767d08de2..4875d71ca21 100644
56 --- a/src/compiler/clc/meson.build
57 +++ b/src/compiler/clc/meson.build
58 @@ -117,15 +117,20 @@ idep_mesaclc = declare_dependency(
59 link_args : _idep_mesaclc_link_args,
62 -prog_mesa_clc = executable(
63 - 'mesa_clc',
64 - ['mesa_clc.c'],
65 - include_directories : [inc_include, inc_src],
66 - c_args : [pre_args, no_override_init_args],
67 - link_args : [ld_args_build_id],
68 - dependencies : [idep_mesaclc, dep_llvm, dep_spirv_tools, idep_getopt],
69 - # If we can run host binaries directly, just build mesa_clc for the host.
70 - # Most commonly this happens when doing a cross compile from an x86_64 build
71 - # machine to an x86 host
72 - native : not meson.can_run_host_binaries(),
74 +if get_option('mesa-clc') == 'system'
75 + prog_mesa_clc = find_program('mesa_clc', native : true)
76 +else
77 + prog_mesa_clc = executable(
78 + 'mesa_clc',
79 + ['mesa_clc.c'],
80 + include_directories : [inc_include, inc_src],
81 + c_args : [pre_args, no_override_init_args],
82 + link_args : [ld_args_build_id],
83 + dependencies : [idep_mesaclc, dep_llvm, dep_spirv_tools, idep_getopt],
84 + # If we can run host binaries directly, just build mesa_clc for the host.
85 + # Most commonly this happens when doing a cross compile from an x86_64 build
86 + # machine to an x86 host
87 + native : not meson.can_run_host_binaries(),
88 + install : get_option('install-mesa-clc'),
89 + )
90 +endif