about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2020-09-24 15:59:22 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2020-09-30 16:34:47 +0100
commit90b2e80fb5f7cf7c455a01b0a0de8abe366bd39b (patch)
treec74ee5aff86d5ed7f6405c6abe3cc6e0ad616465
parent73b90b322bafdb9da22b21cfeeba11a430492037 (diff)
downloadklee-90b2e80fb5f7cf7c455a01b0a0de8abe366bd39b.tar.gz
Fix detection of installed clang
Any clang is fine as long as it is the right version.
The current assumption is that it is suffixed with version.
-rw-r--r--scripts/build/p-clang-linux.inc14
1 files changed, 11 insertions, 3 deletions
diff --git a/scripts/build/p-clang-linux.inc b/scripts/build/p-clang-linux.inc
index ff9b8b81..f3dfbb6e 100644
--- a/scripts/build/p-clang-linux.inc
+++ b/scripts/build/p-clang-linux.inc
@@ -6,7 +6,9 @@ setup_artifact_variables_clang() {
   [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="-${LLVM_VERSION_MAJOR}"
 
   # Only set LLVM_CONFIG if not set yet
-  [[ -z ${LLVM_CONFIG+x} ]] && LLVM_CONFIG=$(which "llvm-config${version}")
+  if [[ -z "${LLVM_CONFIG-}" ]]; then
+    LLVM_CONFIG=$(which "llvm-config${version}")
+  fi
 
 
   local bin_path=""
@@ -23,6 +25,12 @@ setup_artifact_variables_clang() {
 
 # Check if the binary artifact is installed
 is_installed_clang() {
-    # Check if llvm-config with the right version exists    
-    which "llvm-config-${LLVM_VERSION}"
+  local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
+  local LLVM_VERSION_MINOR="${LLVM_VERSION/*./}"
+  local version=""
+  [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="${LLVM_VERSION}"
+  [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="${LLVM_VERSION_MAJOR}"
+
+  # Check if clang with the right version exists
+  which "clang-${version}"
 }
\ No newline at end of file