diff options
author | Martin Nowack <m.nowack@imperial.ac.uk> | 2019-03-12 09:49:14 +0000 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2019-03-17 15:43:21 +0000 |
commit | e06ab0db462c1c64bf26f856f4a8448d1ebf199d (patch) | |
tree | a9c54b7c950290fc96e05042089cf29a2ca06fd7 | |
parent | 1126134d15a293e0f7fceed881282b78ac8a37ef (diff) | |
download | klee-e06ab0db462c1c64bf26f856f4a8448d1ebf199d.tar.gz |
Generalise clang package detection for linux and mac osx
-rw-r--r-- | scripts/build/p-clang-linux-ubuntu-16.04.inc | 29 | ||||
-rw-r--r-- | scripts/build/p-clang-linux.inc | 28 | ||||
-rw-r--r-- | scripts/build/p-clang-osx.inc | 11 |
3 files changed, 41 insertions, 27 deletions
diff --git a/scripts/build/p-clang-linux-ubuntu-16.04.inc b/scripts/build/p-clang-linux-ubuntu-16.04.inc index 75023628..5e140f5d 100644 --- a/scripts/build/p-clang-linux-ubuntu-16.04.inc +++ b/scripts/build/p-clang-linux-ubuntu-16.04.inc @@ -10,8 +10,8 @@ install_binary_artifact_clang() { [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="-${LLVM_VERSION}" [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="-${LLVM_VERSION_MAJOR}" - - if [[ "${LLVM_VERSION_MAJOR}" -eq 3 && "${LLVM_VERSION_MINOR}" -gt 7 ]]; then + # apt.llvm packages for Trusty clang 5.0 package is broken with atomics. Don't use it. + if [[ "${LLVM_VERSION_MAJOR}" -gt 6 ]]; then # Add certificate apt update -y dependencies=( @@ -36,31 +36,6 @@ install_binary_artifact_clang() { apt -y --no-install-recommends install "${dependencies[@]}" } -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 - if [[ -z ${LLVM_CONFIG+x} ]]; then - LLVM_CONFIG=$(which "llvm-config${version}") - fi - - BITCODE_CC=$(which "clang${version}") - BITCODE_CXX=$(which "clang++${version}") - - SANITIZER_C_COMPILER="${BITCODE_CC}" - 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}" -} - get_docker_config_id_clang() { return 0 } 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 diff --git a/scripts/build/p-clang-osx.inc b/scripts/build/p-clang-osx.inc index fde236ca..e3634e5a 100644 --- a/scripts/build/p-clang-osx.inc +++ b/scripts/build/p-clang-osx.inc @@ -11,3 +11,14 @@ is_installed_clang() { LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}" [[ -f "/usr/local/opt/llvm@${LLVM_VERSION_MAJOR}/bin/llvm-config" ]] } + +setup_artifact_variables_clang() { + local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}" + + BITCODE_CC="/usr/local/opt/llvm@${LLVM_VERSION_MAJOR}/bin/clang" + BITCODE_CXX="/usr/local/opt/llvm@${LLVM_VERSION_MAJOR}/bin/clang++" + + SANITIZER_C_COMPILER="${BITCODE_CC}" + SANITIZER_CXX_COMPILER="${BITCODE_CXX}" + LLVM_CONFIG="/usr/local/opt/llvm@${LLVM_VERSION_MAJOR}/bin/llvm-config" +} \ No newline at end of file |