diff mbox series

[1/3] mesa: Fix build with upcoming LLVM 17

Message ID 20230624053223.228117-1-raj.khem@gmail.com
State New
Headers show
Series [1/3] mesa: Fix build with upcoming LLVM 17 | expand

Commit Message

Khem Raj June 24, 2023, 5:32 a.m. UTC
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../0001-gallium-Fix-build-with-llvm-17.patch | 34 +++++++++++++++++++
 meta/recipes-graphics/mesa/mesa.inc           |  6 ++++
 2 files changed, 40 insertions(+)
 create mode 100644 meta/recipes-graphics/mesa/files/0001-gallium-Fix-build-with-llvm-17.patch

Comments

Alexander Kanavin June 25, 2023, 6:30 a.m. UTC | #1
On Sat, 24 Jun 2023 at 07:32, Khem Raj <raj.khem@gmail.com> wrote:
> +# llvm-config should be the one from llvm-native and not from build host ( if llvm is installed on host )
> +do_write_config:append() {
> +    sed -i -e '/\[binaries\]/a\' -e "llvm-config = '${STAGING_BINDIR_NATIVE}/llvm-config'" ${WORKDIR}/meson.native
> +}
> +

This change should be in a separate commit, and with a separate
explanation please. Is there a mistake in how meson.native is formed,
and if so, should it be fixed at the source?

Alex
diff mbox series

Patch

diff --git a/meta/recipes-graphics/mesa/files/0001-gallium-Fix-build-with-llvm-17.patch b/meta/recipes-graphics/mesa/files/0001-gallium-Fix-build-with-llvm-17.patch
new file mode 100644
index 00000000000..3631a918b0c
--- /dev/null
+++ b/meta/recipes-graphics/mesa/files/0001-gallium-Fix-build-with-llvm-17.patch
@@ -0,0 +1,34 @@ 
+From 865762e0a767a121206d818bdd58301afbf30104 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Fri, 23 Jun 2023 01:20:38 -0700
+Subject: [PATCH] gallium: Fix build with llvm 17
+
+These headers are not available for C files in llvm 17+
+and they seem to be not needed to compile after all with llvm 17
+so add conditions to exclude them for llvm >= 17
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23827]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/gallium/auxiliary/gallivm/lp_bld_init.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
+index 24d0823..3d4573e 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
+@@ -42,8 +42,10 @@
+ 
+ #include <llvm/Config/llvm-config.h>
+ #include <llvm-c/Analysis.h>
++#if LLVM_VERSION_MAJOR < 17
+ #include <llvm-c/Transforms/Scalar.h>
+-#if LLVM_VERSION_MAJOR >= 7
++#endif
++#if LLVM_VERSION_MAJOR >= 7 && LLVM_VERSION_MAJOR < 17
+ #include <llvm-c/Transforms/Utils.h>
+ #endif
+ #include <llvm-c/BitWriter.h>
+-- 
+2.41.0
+
diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index ac42a8dd4f3..c988c77115b 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -17,6 +17,7 @@  PE = "2"
 SRC_URI = "https://mesa.freedesktop.org/archive/mesa-${PV}.tar.xz \
            file://0001-meson.build-check-for-all-linux-host_os-combinations.patch \
            file://0001-meson-misdetects-64bit-atomics-on-mips-clang.patch \
+           file://0001-gallium-Fix-build-with-llvm-17.patch \
            "
 
 SRC_URI[sha256sum] = "a2679031ed5b73b29c4f042ac64d96f83b0cfe4858617de32e2efc196c653a40"
@@ -74,6 +75,11 @@  EXTRA_OEMESON = " \
 def strip_comma(s):
     return s.strip(',')
 
+# llvm-config should be the one from llvm-native and not from build host ( if llvm is installed on host )
+do_write_config:append() {
+    sed -i -e '/\[binaries\]/a\' -e "llvm-config = '${STAGING_BINDIR_NATIVE}/llvm-config'" ${WORKDIR}/meson.native
+}
+
 PACKAGECONFIG = " \
 	gallium \
 	${@bb.utils.filter('DISTRO_FEATURES', 'x11 vulkan wayland', d)} \