From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1704206-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 (4096 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id CA70515812D
	for <garchives@archives.gentoo.org>; Mon, 30 Dec 2024 11:35:07 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id EB53EE0817;
	Mon, 30 Dec 2024 11:35:06 +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) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id C8B18E0817
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Dec 2024 11:35:06 +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 A073C335D6D
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Dec 2024 11:35:05 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 09D5218E7
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Dec 2024 11:35:04 +0000 (UTC)
From: "Michał Górny" <mgorny@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, "Michał Górny" <mgorny@gentoo.org>
Message-ID: <1735558349.ba77142fd668fd93a03f188cf2bcc791624ca05b.mgorny@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
X-VCS-Repository: repo/gentoo
X-VCS-Files: eclass/llvm-utils.eclass
X-VCS-Directories: eclass/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: ba77142fd668fd93a03f188cf2bcc791624ca05b
X-VCS-Branch: master
Date: Mon, 30 Dec 2024 11:35:04 +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: 6a685249-4972-480e-a2ce-b5d4e192a99e
X-Archives-Hash: c7073d4222527ecd3be40bc523a8e6ce

commit:     ba77142fd668fd93a03f188cf2bcc791624ca05b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 16 07:50:30 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec 30 11:32:29 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba77142f

llvm-utils.eclass: Support -b/-d to llvm_prepend_path

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/llvm-utils.eclass | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/eclass/llvm-utils.eclass b/eclass/llvm-utils.eclass
index 1ae3295484c8..b105e169fbc4 100644
--- a/eclass/llvm-utils.eclass
+++ b/eclass/llvm-utils.eclass
@@ -113,17 +113,38 @@ llvm_fix_tool_path() {
 }
 
 # @FUNCTION: llvm_prepend_path
-# @USAGE: <slot>
+# @USAGE: [-b|-d] <slot>
 # @DESCRIPTION:
 # Prepend the path to the specified LLVM slot to PATH variable,
 # and reexport it.
+#
+# With no option or "-d", the path is prefixed by ESYSROOT.  LLVM
+# dependencies should be in DEPEND then.
+#
+# With "-b" option, the path is prefixed by BROOT. LLVM dependencies
+# should be in BDEPEND then.
 llvm_prepend_path() {
 	debug-print-function ${FUNCNAME} "$@"
 
-	[[ ${#} -ne 1 ]] && die "Usage: ${FUNCNAME} <slot>"
+	local prefix
+	case ${1--d} in
+		-d)
+			prefix=${ESYSROOT}
+			shift
+			;;
+		-b)
+			prefix=${BROOT}
+			shift
+			;;
+		-*)
+			die "${FUNCNAME}: invalid option: ${1}"
+			;;
+	esac
+
+	[[ ${#} -ne 1 ]] && die "Usage: ${FUNCNAME} [-b|-d] <slot>"
 	local slot=${1}
 
-	local llvm_path=${ESYSROOT}/usr/lib/llvm/${slot}/bin
+	local llvm_path=${prefix}/usr/lib/llvm/${slot}/bin
 	local IFS=:
 	local split_path=( ${PATH} )
 	local new_path=()