commit:     0653b35c94d4c071bd0fbc9760e44f1b53b62a7b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 30 15:08:50 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Aug 12 21:21:28 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0653b35c

llvm.eclass: Check for installed package rather than executable

Ensure that a specific LLVM slot is installed via using has_version on
"sys-devel/llvm:${SLOT}" rather than checking whether llvm-config is
installed in expected location. While it is a bit slower, this is closer
to a canonical way of testing it and will be useful when we allow
testing for more specific dependency strings. Right now, it could be
helpful if one has broken LLVM installation (i.e. stray files).

 eclass/llvm.eclass | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/eclass/llvm.eclass b/eclass/llvm.eclass
index 1128615cd35..4df3825e6e3 100644
--- a/eclass/llvm.eclass
+++ b/eclass/llvm.eclass
@@ -91,9 +91,9 @@ get_llvm_prefix() {
                        fi
                fi
 
-               local p=${EPREFIX}/usr/lib/llvm/${slot}
-               if [[ -x ${p}/bin/llvm-config ]]; then
-                       echo "${p}"
+               # check if LLVM package is installed
+               if has_version "sys-devel/llvm:${slot}"; then
+                       echo "${EPREFIX}/usr/lib/llvm/${slot}"
                        return
                fi
        done
@@ -105,13 +105,12 @@ get_llvm_prefix() {
 
        # fallback to :0
        # assume it's always <= 4 (the lower max_slot allowed)
-       p=${EPREFIX}/usr
-       if [[ -x ${p}/bin/llvm-config ]]; then
-               echo "${p}"
+       if has_version "sys-devel/llvm:0"; then
+               echo "${EPREFIX}/usr"
                return
        fi
 
-       die "No LLVM slot${1:+ <= ${1}} found in PATH!"
+       die "No LLVM slot${1:+ <= ${1}} found installed!"
 }
 
 # @FUNCTION: llvm_pkg_setup

Reply via email to