- Add dependencies for clang and gcc-runtime to provide needed headers. Add a 
dependency
  for bindgen-cli-native to allow creating the rust bindings
- Disable rusticl build for mesa-native
- Add a PACKAGECONFIG for rusticl
- inherit rust to make rusticl buildable
- Add a crude hack to make the compiler includes visible to bindgen-cli
  Without this the headers will be taken from host and that is inappropriate 
for yocto/oe
  If they are not found the build fails

There is still a compile issue left that suggests to me that a rust update is 
required:
error[E0658]: use of unstable library feature 'offset_of'
 --> src/gallium/frontends/rusticl/rusticl_mesa_bindings.rs:3:13312
  |
3 | ...() - 8usize] ; ["Offset of field: _IO_FILE::_flags"] [:: std :: mem :: 
offset_of ! (_IO_FILE , _flags) - 0usize] ; ["Offset of field: ...
  |                                                          
^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #106655 <https://github.com/rust-lang/rust/issues/106655> 
for more information

error[E0658]: use of unstable library feature 'offset_of'
 --> src/gallium/frontends/rusticl/rusticl_mesa_bindings.rs:3:13418

Signed-off-by: Markus Volk <[email protected]>
---
 ...n.build-workaround-for-rusticl-build.patch | 27 +++++++++++++++++++
 meta/recipes-graphics/mesa/mesa.inc           | 22 ++++++++++-----
 2 files changed, 43 insertions(+), 6 deletions(-)
 create mode 100644 
meta/recipes-graphics/mesa/files/0001-rusticl-meson.build-workaround-for-rusticl-build.patch

diff --git 
a/meta/recipes-graphics/mesa/files/0001-rusticl-meson.build-workaround-for-rusticl-build.patch
 
b/meta/recipes-graphics/mesa/files/0001-rusticl-meson.build-workaround-for-rusticl-build.patch
new file mode 100644
index 0000000000..9c953f961d
--- /dev/null
+++ 
b/meta/recipes-graphics/mesa/files/0001-rusticl-meson.build-workaround-for-rusticl-build.patch
@@ -0,0 +1,27 @@
+From b34ee4014ee9e3466ebafbd53745d9f9a13379da Mon Sep 17 00:00:00 2001
+From: Markus Volk <[email protected]>
+Date: Thu, 11 Jul 2024 22:52:16 +0200
+Subject: [PATCH] rusticl/meson.build: workaround for rusticl build
+
+Signed-off-by: Markus Volk <[email protected]>
+
+Upstream-Status: Inappropriate [oe-specific]
+---
+ src/gallium/frontends/rusticl/meson.build | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/gallium/frontends/rusticl/meson.build 
b/src/gallium/frontends/rusticl/meson.build
+index eef09d8f01e..efac4cab964 100644
+--- a/src/gallium/frontends/rusticl/meson.build
++++ b/src/gallium/frontends/rusticl/meson.build
+@@ -211,6 +211,7 @@ rusticl_llvm_bindings_rs = rust.bindgen(
+   c_args : [
+     rusticl_bindgen_c_args,
+     pre_args,
++   '-I@include@', '-I@include_cpp@', '-I@include_cpp_target_sys@'
+   ],
+   dependencies : [
+     dep_clang,
+-- 
+2.45.2
+
diff --git a/meta/recipes-graphics/mesa/mesa.inc 
b/meta/recipes-graphics/mesa/mesa.inc
index b403a2481a..ba3c8c147f 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -16,6 +16,7 @@ PE = "2"
 
 SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
            file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
+           file://0001-rusticl-meson.build-workaround-for-rusticl-build.patch \
 "
 
 SRC_URI[sha256sum] = 
"63236426b25a745ba6aa2d6daf8cd769d5ea01887b0745ab7124d2ef33a9020d"
@@ -33,7 +34,7 @@ do_install:append() {
 }
 
 DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native 
zlib chrpath-replacement-native python3-mako-native gettext-native"
-DEPENDS:append:class-target = " ${@bb.utils.contains('PACKAGECONFIG', 
'opencl', 'mesa-native', '', d)}"
+DEPENDS:append:class-target = " ${@bb.utils.contains('PACKAGECONFIG', 
'opencl', 'mesa-native gcc-runtime', '', d)}"
 EXTRANATIVEPATH += "chrpath-native"
 PROVIDES = " \
     ${@bb.utils.contains('PACKAGECONFIG', 'opengl', 'virtual/libgl', '', d)} \
@@ -44,7 +45,7 @@ PROVIDES = " \
     virtual/mesa \
     "
 
-inherit meson pkgconfig python3native gettext features_check
+inherit meson rust pkgconfig python3native gettext features_check
 
 BBCLASSEXTEND = "native nativesdk"
 
@@ -72,7 +73,13 @@ EXTRA_OEMESON = " \
 "
 
 EXTRA_OEMESON:append:class-target = " ${@bb.utils.contains('PACKAGECONFIG', 
'opencl', '-Dintel-clc=system', '', d)}"
-EXTRA_OEMESON:append:class-native = " ${@bb.utils.contains('PACKAGECONFIG', 
'opencl', '-Dintel-clc=enabled', '', d)}"
+EXTRA_OEMESON:append:class-native = " ${@bb.utils.contains('PACKAGECONFIG', 
'opencl', '-Dintel-clc=enabled -Dgallium-rusticl=false', '', d)}"
+
+do_configure:prepend() {
+       sed -i "s|@include@|${STAGING_INCDIR}|" 
${S}/src/gallium/frontends/rusticl/meson.build
+       sed -i "s|@include_cpp@|${STAGING_INCDIR}\/c++\/14.1.0|" 
${S}/src/gallium/frontends/rusticl/meson.build
+       sed -i 
"s|@include_cpp_target_sys@|${STAGING_INCDIR}\/c++\/14.1.0\/${TARGET_SYS}|" 
${S}/src/gallium/frontends/rusticl/meson.build
+}
 
 def strip_comma(s):
     return s.strip(',')
@@ -139,8 +146,10 @@ PACKAGECONFIG[gles] = "-Dgles1=enabled -Dgles2=enabled, 
-Dgles1=disabled -Dgles2
 # "egl" requires "opengl"
 PACKAGECONFIG[egl] = "-Degl=enabled, -Degl=disabled"
 
-# "opencl" requires libclc from meta-clang
-PACKAGECONFIG[opencl] = "-Dgallium-opencl=icd 
-Dopencl-spirv=true,-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc 
spirv-tools python3-ply-native"
+# "opencl-clover" requires libclc from meta-clang
+PACKAGECONFIG[opencl-clover] = "-Dgallium-opencl=icd 
-Dopencl-spirv=true,-Dgallium-opencl=disabled -Dopencl-spirv=false,libclc 
spirv-tools python3-ply-native"
+# "opencl" requires libclc, bindgen-cli and clang from meta-clang
+PACKAGECONFIG[opencl] = "-Dgallium-rusticl=true,-Dgallium-rusticl=false,libclc 
bindgen-cli-native python3-ply-native clang"
 
 PACKAGECONFIG[broadcom] = ""
 PACKAGECONFIG[etnaviv] = ""
@@ -223,7 +232,8 @@ DEV_PKG_DEPENDENCY = ""
 # development package of libgles3.
 RDEPENDS:libgles3-mesa-dev += "libgles2-mesa-dev"
 
-RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 'opencl', 
'libclc spirv-tools', '', d)}"
+RDEPENDS:libopencl-mesa += "${@bb.utils.contains_any('PACKAGECONFIG', 'opencl 
opencl-clover', 'libclc', '', d)}"
+RDEPENDS:libopencl-mesa += "${@bb.utils.contains('PACKAGECONFIG', 
'opencl-clover', 'spirv-tools', '', d)}"
 
 PACKAGES =+ "libegl-mesa libegl-mesa-dev \
              libosmesa libosmesa-dev \
-- 
2.45.2

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#201818): 
https://lists.openembedded.org/g/openembedded-core/message/201818
Mute This Topic: https://lists.openembedded.org/mt/107179264/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to