[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    [gentoo-dev] [PATCH 1/4] llvm.eclass: Check for installed package rather than executable
From:       Michał Górny <mgorny () gentoo ! org>
Date:       2017-06-30 21:34:28
Message-ID: 20170630213431.17767-2-mgorny () gentoo ! org
[Download RAW message or body]

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 294e27b019b9..94adba17a2b7 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
-- 
2.13.2


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic