From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 DBBF91580FD for ; Sat, 21 Dec 2024 16:02:23 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 0D722E09AD; Sat, 21 Dec 2024 16:01:03 +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 A9B89E09A4 for ; Sat, 21 Dec 2024 16:01:02 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 04/11] llvm-utils.eclass: Support -b/-d to llvm_prepend_path Date: Sat, 21 Dec 2024 16:48:37 +0100 Message-ID: <20241221160053.780079-5-mgorny@gentoo.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241221160053.780079-1-mgorny@gentoo.org> References: <20241221160053.780079-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 49aa553d-385d-4f81-a569-f99071d50c69 X-Archives-Hash: abb48baf77bb77c493803953a284fbc0 Signed-off-by: Michał Górny --- 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: +# @USAGE: [-b|-d] # @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} " + 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] " 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=() -- 2.47.1