From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1553375-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 D1D20158089
	for <garchives@archives.gentoo.org>; Sun, 10 Sep 2023 07:06:42 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 200AE2BC015;
	Sun, 10 Sep 2023 07:06:42 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(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 pigeon.gentoo.org (Postfix) with ESMTPS id 0058E2BC015
	for <gentoo-commits@lists.gentoo.org>; Sun, 10 Sep 2023 07:06:41 +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))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 2BBBE335CDF
	for <gentoo-commits@lists.gentoo.org>; Sun, 10 Sep 2023 07:06:41 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id BB7D010DC
	for <gentoo-commits@lists.gentoo.org>; Sun, 10 Sep 2023 07:06:39 +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: <1694329584.9981a41f95601118673e177101688eedfb4b8652.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/clang-common/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sys-devel/clang-common/clang-common-17.0.0.9999.ebuild sys-devel/clang-common/clang-common-17.0.0_rc4-r1.ebuild sys-devel/clang-common/clang-common-17.0.0_rc4.ebuild sys-devel/clang-common/clang-common-18.0.0.9999.ebuild sys-devel/clang-common/clang-common-18.0.0_pre20230906-r1.ebuild sys-devel/clang-common/clang-common-18.0.0_pre20230906.ebuild
X-VCS-Directories: sys-devel/clang-common/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 9981a41f95601118673e177101688eedfb4b8652
X-VCS-Branch: master
Date: Sun, 10 Sep 2023 07:06:39 +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: 79d9bd3f-b12c-4e68-8082-40ff2ea59c09
X-Archives-Hash: 85326c6e42f7513394520fde0d362b92

commit:     9981a41f95601118673e177101688eedfb4b8652
Author:     Violet Purcell <vimproved <AT> inventati <DOT> org>
AuthorDate: Fri Sep  8 23:10:40 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Sep 10 07:06:24 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9981a41f

sys-devel/clang-common: Install configuration files for extra triples

This commit makes clang-common install clang configuration files for the
gentoo, pc, and unknown vendors. Some software (eg rust) pass tuples
with vendors different from CHOST to clang, causing clang to not
properly use the configuration file.

Signed-off-by: Violet Purcell <vimproved <AT> inventati.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../clang-common/clang-common-17.0.0.9999.ebuild   | 35 +++++++++++++++++-----
 ...c4.ebuild => clang-common-17.0.0_rc4-r1.ebuild} | 35 +++++++++++++++++-----
 .../clang-common/clang-common-18.0.0.9999.ebuild   | 35 +++++++++++++++++-----
 ...d => clang-common-18.0.0_pre20230906-r1.ebuild} | 35 +++++++++++++++++-----
 4 files changed, 108 insertions(+), 32 deletions(-)

diff --git a/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild b/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild
index 8bca701cfc0b..5e56c5f7b4e6 100644
--- a/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-17.0.0.9999.ebuild
@@ -63,6 +63,30 @@ pkg_pretend() {
 	fi
 }
 
+doclang_cfg() {
+	local triple="${1}"
+
+	local tool
+	for tool in ${triple}-clang{,++,-cpp}; do
+		newins - "${tool}.cfg" <<-EOF
+			# This configuration file is used by ${tool} driver.
+			@gentoo-common.cfg
+		EOF
+	done
+
+	# Install symlinks for triples with other vendor strings since some
+	# programs insist on mangling the triple.
+	local vendor
+	for vendor in gentoo pc unknown; do
+		local vendor_triple="${triple%%-*}-${vendor}-${triple#*-*-}"
+		for tool in clang{,++,-cpp}; do
+			if [[ ! -f "${ED}/etc/clang/${vendor_triple}-${tool}.cfg" ]]; then
+				dosym "${triple}-${tool}.cfg" "/etc/clang/${vendor_triple}-${tool}.cfg"
+			fi
+		done
+	done
+}
+
 src_install() {
 	newbashcomp bash-autocomplete.sh clang
 
@@ -176,18 +200,13 @@ src_install() {
 	# We only install config files for supported ABIs because unprefixed tools
 	# might be used for crosscompilation where e.g. PIE may not be supported.
 	# See bug #912237 and bug #901247.
+	doclang_cfg "${CHOST}"
+
 	# Just ${CHOST} won't do due to bug #912685.
 	local abi
 	for abi in $(get_all_abis); do
 		local abi_chost=$(get_abi_CHOST "${abi}")
-
-		local tool
-		for tool in ${abi_chost}-clang{,++,-cpp}; do
-			newins - "${tool}.cfg" <<-EOF
-				# This configuration file is used by ${tool} driver.
-				@gentoo-common.cfg
-			EOF
-		done
+		doclang_cfg "${abi_chost}"
 	done
 }
 

diff --git a/sys-devel/clang-common/clang-common-17.0.0_rc4.ebuild b/sys-devel/clang-common/clang-common-17.0.0_rc4-r1.ebuild
similarity index 89%
rename from sys-devel/clang-common/clang-common-17.0.0_rc4.ebuild
rename to sys-devel/clang-common/clang-common-17.0.0_rc4-r1.ebuild
index 8bca701cfc0b..5e56c5f7b4e6 100644
--- a/sys-devel/clang-common/clang-common-17.0.0_rc4.ebuild
+++ b/sys-devel/clang-common/clang-common-17.0.0_rc4-r1.ebuild
@@ -63,6 +63,30 @@ pkg_pretend() {
 	fi
 }
 
+doclang_cfg() {
+	local triple="${1}"
+
+	local tool
+	for tool in ${triple}-clang{,++,-cpp}; do
+		newins - "${tool}.cfg" <<-EOF
+			# This configuration file is used by ${tool} driver.
+			@gentoo-common.cfg
+		EOF
+	done
+
+	# Install symlinks for triples with other vendor strings since some
+	# programs insist on mangling the triple.
+	local vendor
+	for vendor in gentoo pc unknown; do
+		local vendor_triple="${triple%%-*}-${vendor}-${triple#*-*-}"
+		for tool in clang{,++,-cpp}; do
+			if [[ ! -f "${ED}/etc/clang/${vendor_triple}-${tool}.cfg" ]]; then
+				dosym "${triple}-${tool}.cfg" "/etc/clang/${vendor_triple}-${tool}.cfg"
+			fi
+		done
+	done
+}
+
 src_install() {
 	newbashcomp bash-autocomplete.sh clang
 
@@ -176,18 +200,13 @@ src_install() {
 	# We only install config files for supported ABIs because unprefixed tools
 	# might be used for crosscompilation where e.g. PIE may not be supported.
 	# See bug #912237 and bug #901247.
+	doclang_cfg "${CHOST}"
+
 	# Just ${CHOST} won't do due to bug #912685.
 	local abi
 	for abi in $(get_all_abis); do
 		local abi_chost=$(get_abi_CHOST "${abi}")
-
-		local tool
-		for tool in ${abi_chost}-clang{,++,-cpp}; do
-			newins - "${tool}.cfg" <<-EOF
-				# This configuration file is used by ${tool} driver.
-				@gentoo-common.cfg
-			EOF
-		done
+		doclang_cfg "${abi_chost}"
 	done
 }
 

diff --git a/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild b/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
index 8bca701cfc0b..5e56c5f7b4e6 100644
--- a/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
+++ b/sys-devel/clang-common/clang-common-18.0.0.9999.ebuild
@@ -63,6 +63,30 @@ pkg_pretend() {
 	fi
 }
 
+doclang_cfg() {
+	local triple="${1}"
+
+	local tool
+	for tool in ${triple}-clang{,++,-cpp}; do
+		newins - "${tool}.cfg" <<-EOF
+			# This configuration file is used by ${tool} driver.
+			@gentoo-common.cfg
+		EOF
+	done
+
+	# Install symlinks for triples with other vendor strings since some
+	# programs insist on mangling the triple.
+	local vendor
+	for vendor in gentoo pc unknown; do
+		local vendor_triple="${triple%%-*}-${vendor}-${triple#*-*-}"
+		for tool in clang{,++,-cpp}; do
+			if [[ ! -f "${ED}/etc/clang/${vendor_triple}-${tool}.cfg" ]]; then
+				dosym "${triple}-${tool}.cfg" "/etc/clang/${vendor_triple}-${tool}.cfg"
+			fi
+		done
+	done
+}
+
 src_install() {
 	newbashcomp bash-autocomplete.sh clang
 
@@ -176,18 +200,13 @@ src_install() {
 	# We only install config files for supported ABIs because unprefixed tools
 	# might be used for crosscompilation where e.g. PIE may not be supported.
 	# See bug #912237 and bug #901247.
+	doclang_cfg "${CHOST}"
+
 	# Just ${CHOST} won't do due to bug #912685.
 	local abi
 	for abi in $(get_all_abis); do
 		local abi_chost=$(get_abi_CHOST "${abi}")
-
-		local tool
-		for tool in ${abi_chost}-clang{,++,-cpp}; do
-			newins - "${tool}.cfg" <<-EOF
-				# This configuration file is used by ${tool} driver.
-				@gentoo-common.cfg
-			EOF
-		done
+		doclang_cfg "${abi_chost}"
 	done
 }
 

diff --git a/sys-devel/clang-common/clang-common-18.0.0_pre20230906.ebuild b/sys-devel/clang-common/clang-common-18.0.0_pre20230906-r1.ebuild
similarity index 89%
rename from sys-devel/clang-common/clang-common-18.0.0_pre20230906.ebuild
rename to sys-devel/clang-common/clang-common-18.0.0_pre20230906-r1.ebuild
index 8bca701cfc0b..5e56c5f7b4e6 100644
--- a/sys-devel/clang-common/clang-common-18.0.0_pre20230906.ebuild
+++ b/sys-devel/clang-common/clang-common-18.0.0_pre20230906-r1.ebuild
@@ -63,6 +63,30 @@ pkg_pretend() {
 	fi
 }
 
+doclang_cfg() {
+	local triple="${1}"
+
+	local tool
+	for tool in ${triple}-clang{,++,-cpp}; do
+		newins - "${tool}.cfg" <<-EOF
+			# This configuration file is used by ${tool} driver.
+			@gentoo-common.cfg
+		EOF
+	done
+
+	# Install symlinks for triples with other vendor strings since some
+	# programs insist on mangling the triple.
+	local vendor
+	for vendor in gentoo pc unknown; do
+		local vendor_triple="${triple%%-*}-${vendor}-${triple#*-*-}"
+		for tool in clang{,++,-cpp}; do
+			if [[ ! -f "${ED}/etc/clang/${vendor_triple}-${tool}.cfg" ]]; then
+				dosym "${triple}-${tool}.cfg" "/etc/clang/${vendor_triple}-${tool}.cfg"
+			fi
+		done
+	done
+}
+
 src_install() {
 	newbashcomp bash-autocomplete.sh clang
 
@@ -176,18 +200,13 @@ src_install() {
 	# We only install config files for supported ABIs because unprefixed tools
 	# might be used for crosscompilation where e.g. PIE may not be supported.
 	# See bug #912237 and bug #901247.
+	doclang_cfg "${CHOST}"
+
 	# Just ${CHOST} won't do due to bug #912685.
 	local abi
 	for abi in $(get_all_abis); do
 		local abi_chost=$(get_abi_CHOST "${abi}")
-
-		local tool
-		for tool in ${abi_chost}-clang{,++,-cpp}; do
-			newins - "${tool}.cfg" <<-EOF
-				# This configuration file is used by ${tool} driver.
-				@gentoo-common.cfg
-			EOF
-		done
+		doclang_cfg "${abi_chost}"
 	done
 }