Set LLVM_SLOT in pkg_setup() to the selected LLVM slot, for inspection
from the package. For example, it can be used to easily compare
the version number.
Split get_llvm_slot() out of get_llvm_prefix() to factor out the common
code.
Signed-off-by: Michał Górny <
mgorny@gentoo.org>
---
eclass/llvm.eclass | 53 ++++++++++++++++++++++++++++++----------------
1 file changed, 35 insertions(+), 18 deletions(-)
diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
index 16596ec2ea66..92c05c308f91 100644
--- a/eclass/llvm.eclass
+++ b/eclass/llvm.eclass
@@ -87,11 +87,10 @@ DEPEND="!!sys-devel/llvm:0"
# Correct values of LLVM slots, newest first.
declare -g -r _LLVM_KNOWN_SLOTS=( {16..8} )
-# @FUNCTION: get_llvm_prefix
+# @FUNCTION: get_llvm_slot
# @USAGE: [-b|-d] [<max_slot>]
-# @DESCRIPTION:
# Find the newest LLVM install that is acceptable for the package,
-# and print an absolute path to it.
+# and print its major version number (i.e. slot).
#
# If -b is specified, the checks are performed relative to BROOT,
# and BROOT-path is returned. This is appropriate when your package
@@ -114,7 +113,7 @@ declare -g -r _LLVM_KNOWN_SLOTS=( {16..8} )
# is acceptable, false otherwise. If llvm_check_deps() is not defined,
# the function defaults to checking whether sys-