diff options
author | Martin Nowack <m.nowack@imperial.ac.uk> | 2019-02-28 11:56:19 +0000 |
---|---|---|
committer | Cristian Cadar <c.cadar@imperial.ac.uk> | 2019-03-10 20:10:32 +0000 |
commit | cf930214e12b49e89be4674043d9f461d667baae (patch) | |
tree | 90de5ea1c643d0d7ad2c5cf55e862d309e605d48 /scripts/build/p-z3.inc | |
parent | b4d8fe0301b82e8abff0336bf6d1347dff11a853 (diff) | |
download | klee-cf930214e12b49e89be4674043d9f461d667baae.tar.gz |
Updated dependency build system for KLEE
Provide a single `scripts/build/build.sh` file to build KLEE and its dependencies.
Diffstat (limited to 'scripts/build/p-z3.inc')
-rw-r--r-- | scripts/build/p-z3.inc | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/scripts/build/p-z3.inc b/scripts/build/p-z3.inc new file mode 100644 index 00000000..f6db455b --- /dev/null +++ b/scripts/build/p-z3.inc @@ -0,0 +1,68 @@ +setup_build_variables_z3() { + Z3_SUFFIX="${SANITIZER_SUFFIX}" + Z3_SRC_PATH="${BASE}/z3-${Z3_VERSION}" + Z3_INSTALL_PATH="${BASE}/z3-${Z3_VERSION}-install${Z3_SUFFIX}" +} + +download_z3() { + mkdir -p "${Z3_SRC_PATH}" + cd "${Z3_SRC_PATH}" + wget -qO- https://github.com/Z3Prover/z3/archive/z3-${Z3_VERSION}.tar.gz | tar xz --strip-components=1 +} + +build_z3() { + local CFLAGS="" + local CXXFLAGS="" + local LDFLAGS="" + local CC="" + local CXX="" + + # Check if sanitizers should be used to build z3 + if [[ "${SANITIZER_SUFFIX}x" != "x" ]]; then + CFLAGS="${SANITIZER_C_FLAGS[*]}" + CXXFLAGS="${SANITIZER_CXX_FLAGS[*]}" + LDFLAGS="${SANITIZER_LD_FLAGS[*]}" + + CC="${SANITIZER_C_COMPILER}" + CXX="${SANITIZER_CXX_COMPILER}" + fi + CFLAGS="${CFLAGS}" \ + CXXFLAGS="${CXXFLAGS}" \ + LDFLAGS="${LDFLAGS}" \ + CC="${CC}" \ + CXX="${CXX}" \ + python scripts/mk_make.py --prefix "${Z3_INSTALL_PATH}" -b "build${Z3_SUFFIX}" + cd "build${Z3_SUFFIX}" + make -j$(nproc) || make +} + +install_z3() { + cd "${Z3_SRC_PATH}/build${Z3_SUFFIX}" + make install + touch "${Z3_INSTALL_PATH}"/.is_installed +} + +is_installed_z3() { + ( + setup_build_variables_z3 + [[ -f "${Z3_INSTALL_PATH}"/.is_installed ]] + ) || return 1 +} + +get_build_artifacts_z3() { + ( + setup_build_variables_z3 + echo "${Z3_INSTALL_PATH}" + ) +} + +setup_artifact_variables_z3() { + setup_build_variables_z3 +} + +get_docker_config_id_z3() { + ( + setup_build_variables_z3 + echo "${Z3_VERSION}${Z3_SUFFIX}" + ) +} |