From e513fc339bd92c95db8981c360f3d6e7e755cc01 Mon Sep 17 00:00:00 2001 From: Aleksei Babushkin Date: Wed, 23 Oct 2024 12:07:35 +0300 Subject: [PATCH] Fix stp build (#200) * STP master branch now uses submodules -- initialise them * STP now has ABC as a dependency -- keep libabc build results * STP now needs libtinfo-dev installed * Add functions for comparing versions to build scripts * When handling the ABC dependency of STP, compare the version with 2.3.4 instead of master, which will also handle future releases --------- Co-authored-by: Cristian Cadar --- scripts/build/common-functions | 18 ++++++++++++++++++ scripts/build/p-klee-linux-ubuntu.inc | 1 + scripts/build/p-stp-linux-ubuntu.inc | 2 +- scripts/build/p-stp.inc | 16 +++++++++++++++- 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/scripts/build/common-functions b/scripts/build/common-functions index d7ae4654c4..3e5e2acda3 100644 --- a/scripts/build/common-functions +++ b/scripts/build/common-functions @@ -41,3 +41,21 @@ function with_sudo() { "$@" fi } + +function version_lte() { + local v1="$1" + local v2="$2" + printf '%s\n%s\n' "$1" "$2" | sort -C -V +} + +function version_lt() { + ! version_lte "$2" "$1" +} + +function version_gte() { + version_lte "$2" "$1" +} + +function version_gt() { + ! version_gte "$2" "$1" +} diff --git a/scripts/build/p-klee-linux-ubuntu.inc b/scripts/build/p-klee-linux-ubuntu.inc index 70af8dc110..b87cb5af7e 100644 --- a/scripts/build/p-klee-linux-ubuntu.inc +++ b/scripts/build/p-klee-linux-ubuntu.inc @@ -13,6 +13,7 @@ install_build_dependencies_klee() { pkg-config cmake-data coreutils + libtinfo-dev ) if [[ "${SOLVERS:-}" == "metaSMT" ]]; then diff --git a/scripts/build/p-stp-linux-ubuntu.inc b/scripts/build/p-stp-linux-ubuntu.inc index 612022efe5..5fdc0bed24 100644 --- a/scripts/build/p-stp-linux-ubuntu.inc +++ b/scripts/build/p-stp-linux-ubuntu.inc @@ -5,13 +5,13 @@ install_build_dependencies_stp() { dependencies=( build-essential - bison ca-certificates cmake flex git zlib1g-dev + libtinfo-dev ) #Install essential dependencies diff --git a/scripts/build/p-stp.inc b/scripts/build/p-stp.inc index 4bec4e054f..1ef202ab9a 100644 --- a/scripts/build/p-stp.inc +++ b/scripts/build/p-stp.inc @@ -1,11 +1,17 @@ # Build scripts for STP # Variables that any artifact of this package might depend on setup_build_variables_stp() { + source "${DIR}/common-functions" + STP_SUFFIX="${SANITIZER_SUFFIX}" MINISAT_BUILD_PATH="${BASE}/minisat-build${STP_SUFFIX}" MINISAT_INSTALL_PATH="${BASE}/minisat-install${STP_SUFFIX}" + if version_gt "${STP_VERSION}" "2.3.4"; then + ABC_INSTALL_PATH="${BASE}/stp-${STP_VERSION}-build${STP_SUFFIX}/lib/extlib-abc/build/" + fi + STP_BUILD_PATH="${BASE}/stp-${STP_VERSION}-build${STP_SUFFIX}" STP_INSTALL_PATH="${BASE}/stp-${STP_VERSION}-install${STP_SUFFIX}" stp_url="https://github.com/stp/stp.git" @@ -14,12 +20,17 @@ setup_build_variables_stp() { } download_stp() { - source "${DIR}/common-functions" # Download minisat git_clone_or_update https://github.com/stp/minisat "${BASE}/minisat" "master" # Download STP git_clone_or_update "${stp_url}" "${BASE}/stp-${STP_VERSION}" "${STP_VERSION}" + + if version_gt "${STP_VERSION}" "2.3.4"; then + cd "${BASE}/stp-${STP_VERSION}" || return 1 + git submodule init + git submodule update + fi } build_stp() { @@ -98,6 +109,9 @@ get_build_artifacts_stp() { setup_build_variables_stp echo "${MINISAT_INSTALL_PATH}" echo "${STP_INSTALL_PATH}" + if version_gt "${STP_VERSION}" "2.3.4"; then + echo "${ABC_INSTALL_PATH}" + fi ) }