From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1557774-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 0F38A158089
	for <garchives@archives.gentoo.org>; Wed, 27 Sep 2023 01:52:26 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 3D5F62BC018;
	Wed, 27 Sep 2023 01:52:25 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 237152BC018
	for <gentoo-commits@lists.gentoo.org>; Wed, 27 Sep 2023 01:52:25 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 2F7A6335CD2
	for <gentoo-commits@lists.gentoo.org>; Wed, 27 Sep 2023 01:52:24 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 6AF4311C8
	for <gentoo-commits@lists.gentoo.org>; Wed, 27 Sep 2023 01:52:22 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1695779504.90da97e78ade65753dfb2e0fb30ec9067c5aa766.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/mesa/, media-libs/mesa/files/
X-VCS-Repository: repo/gentoo
X-VCS-Files: media-libs/mesa/files/clang_config_tool.patch media-libs/mesa/mesa-23.1.8.ebuild media-libs/mesa/mesa-23.2.0_rc4.ebuild media-libs/mesa/mesa-9999.ebuild
X-VCS-Directories: media-libs/mesa/files/ media-libs/mesa/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 90da97e78ade65753dfb2e0fb30ec9067c5aa766
X-VCS-Branch: master
Date: Wed, 27 Sep 2023 01:52:22 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: d84576bd-47c0-4cc3-b7b1-fd4b44cc68c1
X-Archives-Hash: 1adf1cf435daeeb457ea2d99282952cc

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