commit:     90da97e78ade65753dfb2e0fb30ec9067c5aa766
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 27 01:49:30 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Sep 27 01:51:44 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=90da97e7

media-libs/mesa: fix LLVM detection

Meson will prefer looking up LLVM via CMake to llvm-config and it's non-trivial
to try coerce CMake into looking at the right thing, so we end up trying to use
the wrong LLVM and exploding - fortunately just at configure time.

Add a patch to force using llvm-config - which llvm.eclass controls the 
availability
of - and avoid the CMake problem entirely.

Of course, it'd be far better if LLVM just finally adopted pkg-config.

Bug: https://bugs.gentoo.org/914632
Bug: https://bugs.gentoo.org/914742
Bug: https://bugs.gentoo.org/914775
Closes: https://bugs.gentoo.org/907965
Thanks-to: Eli Schwartz <eschwartz93 <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 media-libs/mesa/files/clang_config_tool.patch | 13 +++++++++++++
 media-libs/mesa/mesa-23.1.8.ebuild            |  3 +++
 media-libs/mesa/mesa-23.2.0_rc4.ebuild        |  5 +++++
 media-libs/mesa/mesa-9999.ebuild              |  5 +++++
 4 files changed, 26 insertions(+)

diff --git a/media-libs/mesa/files/clang_config_tool.patch 
b/media-libs/mesa/files/clang_config_tool.patch
new file mode 100644
index 000000000000..ed85b9215cdc
--- /dev/null
+++ b/media-libs/mesa/files/clang_config_tool.patch
@@ -0,0 +1,13 @@
+Workaround the CMake dependency lookup returning a different LLVM to 
llvm-config.
+
+Bug: https://bugs.gentoo.org/907965
+--- a/meson.build
++++ b/meson.build
+@@ -1691,6 +1691,7 @@ if _llvm.allowed()
+     static : not _shared_llvm,
+     fallback : ['llvm', 'dep_llvm'],
+     include_type : 'system',
++    method: 'config-tool',
+   )
+   with_llvm = dep_llvm.found()
+ endif

diff --git a/media-libs/mesa/mesa-23.1.8.ebuild 
b/media-libs/mesa/mesa-23.1.8.ebuild
index 0eff5117e2be..dabe2d09e96b 100644
--- a/media-libs/mesa/mesa-23.1.8.ebuild
+++ b/media-libs/mesa/mesa-23.1.8.ebuild
@@ -205,6 +205,9 @@ llvm_check_deps() {
 PATCHES=(
        # Temporary rusticl workaround: 
https://gitlab.freedesktop.org/mesa/mesa/-/issues/7717#note_1832122
        "${FILESDIR}/clang_resource_dir.patch"
+
+       # Workaround the CMake dependency lookup returning a different LLVM to 
llvm-config, bug #907965
+       "${FILESDIR}/clang_config_tool.patch"
 )
 
 pkg_pretend() {

diff --git a/media-libs/mesa/mesa-23.2.0_rc4.ebuild 
b/media-libs/mesa/mesa-23.2.0_rc4.ebuild
index 02661bf2530d..f2d088041259 100644
--- a/media-libs/mesa/mesa-23.2.0_rc4.ebuild
+++ b/media-libs/mesa/mesa-23.2.0_rc4.ebuild
@@ -193,6 +193,11 @@ x86? (
        usr/lib/libGLX_mesa.so.0.0.0
 )"
 
+PATCHES=(
+       # Workaround the CMake dependency lookup returning a different LLVM to 
llvm-config, bug #907965
+       "${FILESDIR}/clang_config_tool.patch"
+)
+
 llvm_check_deps() {
        if use opencl; then
                has_version "sys-devel/clang:${LLVM_SLOT}[${LLVM_USE_DEPS}]" || 
return 1

diff --git a/media-libs/mesa/mesa-9999.ebuild b/media-libs/mesa/mesa-9999.ebuild
index 62cd12fe1eee..25ed409ab65a 100644
--- a/media-libs/mesa/mesa-9999.ebuild
+++ b/media-libs/mesa/mesa-9999.ebuild
@@ -187,6 +187,11 @@ BDEPEND="
 S="${WORKDIR}/${MY_P}"
 EGIT_CHECKOUT_DIR=${S}
 
+PATCHES=(
+       # Workaround the CMake dependency lookup returning a different LLVM to 
llvm-config, bug #907965
+       "${FILESDIR}/clang_config_tool.patch"
+)
+
 QA_WX_LOAD="
 x86? (
        usr/lib/libglapi.so.0.0.0

Reply via email to