about summary refs log tree commit diff homepage
path: root/scripts/build/p-clang-linux.inc
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2019-03-12 09:49:14 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2019-03-17 15:43:21 +0000
commite06ab0db462c1c64bf26f856f4a8448d1ebf199d (patch)
treea9c54b7c950290fc96e05042089cf29a2ca06fd7 /scripts/build/p-clang-linux.inc
parent1126134d15a293e0f7fceed881282b78ac8a37ef (diff)
downloadklee-e06ab0db462c1c64bf26f856f4a8448d1ebf199d.tar.gz
Generalise clang package detection for linux and mac osx
Diffstat (limited to 'scripts/build/p-clang-linux.inc')
-rw-r--r--scripts/build/p-clang-linux.inc28
1 files changed, 28 insertions, 0 deletions
diff --git a/scripts/build/p-clang-linux.inc b/scripts/build/p-clang-linux.inc
new file mode 100644
index 00000000..ff9b8b81
--- /dev/null
+++ b/scripts/build/p-clang-linux.inc
@@ -0,0 +1,28 @@
+setup_artifact_variables_clang() {
+  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}"
+
+  # Only set LLVM_CONFIG if not set yet
+  [[ -z ${LLVM_CONFIG+x} ]] && LLVM_CONFIG=$(which "llvm-config${version}")
+
+
+  local bin_path=""
+  bin_path="$(dirname "$(readlink -f "$(which "clang${version}")")")"
+
+  BITCODE_CC="${bin_path}/clang"
+  BITCODE_CXX="${bin_path}/clang++"
+
+  #[[ -z ${SANITIZER_C_COMPILER+x} ]] && 
+  SANITIZER_C_COMPILER="${BITCODE_CC}"
+  #[[ -z ${SANITIZER_CXX_COMPILER+x} ]] && 
+  SANITIZER_CXX_COMPILER="${BITCODE_CXX}"
+}
+
+# Check if the binary artifact is installed
+is_installed_clang() {
+    # Check if llvm-config with the right version exists    
+    which "llvm-config-${LLVM_VERSION}"
+}
\ No newline at end of file