about summary refs log tree commit diff homepage
path: root/scripts
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2020-12-01 11:29:15 +0000
committerMartinNowack <2443641+MartinNowack@users.noreply.github.com>2020-12-02 15:11:39 +0000
commit26b13da1c032ff3426012f43b17a8fa86598857b (patch)
treecabb68a0dbfd14c6075f0a9873f2ad907f856548 /scripts
parentd83484b63c089281a32e3d3fb8b59b21a3eb7d79 (diff)
downloadklee-26b13da1c032ff3426012f43b17a8fa86598857b.tar.gz
Handle LLVM version selection more robust
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/v-llvm.inc19
1 files changed, 18 insertions, 1 deletions
diff --git a/scripts/build/v-llvm.inc b/scripts/build/v-llvm.inc
index 5ec6f713..9d84f6c2 100644
--- a/scripts/build/v-llvm.inc
+++ b/scripts/build/v-llvm.inc
@@ -22,7 +22,24 @@ export_variables_llvm=(
 artifact_dependency_llvm=("sanitizer")
 
 setup_variables_llvm() {
-  LLVM_VERSION_SHORT="${LLVM_VERSION/./}"
+  local v_a
+  v_a=(${LLVM_VERSION//./ })
+
+  LLVM_VERSION_MAJOR="0"
+  LLVM_VERSION_MINOR="0"
+  LLVM_VERSION_PATCH="0"
+
+  if [[ "${#v_a[@]}" -ge 1 ]]; then
+    LLVM_VERSION_MAJOR="${v_a[0]}"
+  fi
+  if [[ "${#v_a[@]}" -ge 2 ]]; then
+    LLVM_VERSION_MINOR="${v_a[1]}"
+  fi
+  if [[ "${#v_a[@]}" -ge 3 ]]; then
+    LLVM_VERSION_PATCH="${v_a[2]}"
+  fi
+
+  LLVM_VERSION_SHORT="${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR}"
 }
 
 check_export_variables_llvm() {