Source0: https://archive.mesa3d.org/mesa-%{version}.tar.xz
# Source0-md5: 0d89ec154ac9f06a1e876214114ed9af
Patch0: llvm17.patch
+Patch1: no-rust-proc-macro-link.patch
URL: https://www.mesa3d.org/
%if %{with opencl_spirv} || %{with gallium_rusticl}
BuildRequires: SPIRV-LLVM-Translator-devel >= 8.0.1.3
%prep
%setup -q -n mesa-%{version}
%patch0 -p1
+%patch1 -p1
%build
%if %{with opencl}
--- /dev/null
+From b9e6e1b10bf7eaa27c3b62e7b466b9b31cfa7cb2 Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Date: Wed, 18 Oct 2023 07:37:55 +0300
+Subject: [PATCH] rusticl: use native build for proc-macro library
+
+The proc-macro libraries are used on the build machine rather than on
+the target system, so enforce perfoming native build of the
+rusticl_proc_macro crate.
+
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+---
+ src/gallium/frontends/rusticl/meson.build | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build
+index d7aee75240ce4..0522fc4c13da5 100644
+--- a/src/gallium/frontends/rusticl/meson.build
++++ b/src/gallium/frontends/rusticl/meson.build
+@@ -350,6 +350,7 @@ rusticl_proc_macros = shared_library(
+ 'rusticl_proc_macros',
+ [rusticl_proc_macros_files],
+ rust_crate_type : 'proc-macro',
++ native: true,
+ rust_args : [
+ rusticl_args,
+ ],
+@@ -361,6 +362,7 @@ librusticl = static_library(
+ gnu_symbol_visibility : 'hidden',
+ rust_crate_type : 'staticlib',
+ rust_args : [
++ '--extern', 'rusticl_proc_macros=' + meson.current_build_dir() / 'librusticl_proc_macros.so',
+ rusticl_args,
+ ],
+ link_with : [
+@@ -368,7 +370,6 @@ librusticl = static_library(
+ libmesa_rust_gen,
+ libmesa_rust_util,
+ rusticl_opencl_gen,
+- rusticl_proc_macros,
+ ],
+ dependencies : [
+ idep_rusticl_gen,
+--
+GitLab
+