summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2024-12-16 08:50:30 +0100
committerMichał Górny <mgorny@gentoo.org>2024-12-30 12:32:29 +0100
commitba77142fd668fd93a03f188cf2bcc791624ca05b (patch)
tree7530d51408dc6a1091ef14b04db0be083e83c92f /eclass
parentllvm-r2.eclass: Copy from llvm-r1.eclass (diff)
downloadgentoo-ba77142fd668fd93a03f188cf2bcc791624ca05b.tar.gz
gentoo-ba77142fd668fd93a03f188cf2bcc791624ca05b.tar.bz2
gentoo-ba77142fd668fd93a03f188cf2bcc791624ca05b.zip
llvm-utils.eclass: Support -b/-d to llvm_prepend_path
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/llvm-utils.eclass27
1 files 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=()