diff options
author | Michał Górny <mgorny@gentoo.org> | 2024-02-07 17:38:19 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2024-02-10 11:47:21 +0100 |
commit | 118145de3992a8249131bd0eb30ea89ad0bd0bdf (patch) | |
tree | 55f652e91bdb670abb388c529ba9f146aa4110a6 /eclass/llvm.eclass | |
parent | llvm-utils.eclass: Introduce an eclass for common helpers (diff) | |
download | gentoo-118145de3992a8249131bd0eb30ea89ad0bd0bdf.tar.gz gentoo-118145de3992a8249131bd0eb30ea89ad0bd0bdf.tar.bz2 gentoo-118145de3992a8249131bd0eb30ea89ad0bd0bdf.zip |
llvm-utils.eclass: Split out PATH prepending logic
Split the logic prepending PATH from pkg_setup() into a dedicated
llvm_prepend_path() function.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/llvm.eclass')
-rw-r--r-- | eclass/llvm.eclass | 25 |
1 files changed, 1 insertions, 24 deletions
diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass index 05ffcfd7cc6d..e297fe992c9f 100644 --- a/eclass/llvm.eclass +++ b/eclass/llvm.eclass @@ -212,30 +212,7 @@ llvm_pkg_setup() { llvm_fix_tool_path LLVM_CONFIG fi - local prefix=${ESYSROOT} - local llvm_path=${prefix}/usr/lib/llvm/${LLVM_SLOT}/bin - local IFS=: - local split_path=( ${PATH} ) - local new_path=() - local x added= - - # prepend new path before first LLVM version found - for x in "${split_path[@]}"; do - if [[ ${x} == */usr/lib/llvm/*/bin ]]; then - if [[ ${x} != ${llvm_path} ]]; then - new_path+=( "${llvm_path}" ) - elif [[ ${added} && ${x} == ${llvm_path} ]]; then - # deduplicate - continue - fi - added=1 - fi - new_path+=( "${x}" ) - done - # ...or to the end of PATH - [[ ${added} ]] || new_path+=( "${llvm_path}" ) - - export PATH=${new_path[*]} + llvm_prepend_path "${LLVM_SLOT}" fi } |