Skip to content

Commit

Permalink
Refactor cmake installation into own component
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowack authored and ccadar committed Mar 30, 2022
1 parent 0d747cc commit 31f92c5
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 74 deletions.
51 changes: 51 additions & 0 deletions scripts/build/p-cmake-linux-ubuntu.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
install_binary_artifact_cmake() {
source "${DIR}/common-functions"

# Check if the Ubuntu version is an LTS version - otherwise no cmake version available
if grep -q LTS /etc/os-release; then
if ! grep -qr "apt.kitware.com" /etc/apt; then
with_sudo apt update -y
# Add Kitware's certificate for CMake
dependencies=(
apt-transport-https
ca-certificates
gnupg
lsb-release
software-properties-common
wget
)

with_sudo apt -y --no-install-recommends install "${dependencies[@]}"
wget -O - "https://apt.kitware.com/keys/kitware-archive-latest.asc" 2> /dev/null \
| gpg --dearmor - | with_sudo tee /etc/apt/trusted.gpg.d/kitware.gpg > /dev/null

# Add CMake repository
codename="$(lsb_release --codename --short)"
with_sudo apt-add-repository -y "deb https://apt.kitware.com/ubuntu/ ${codename} main"
fi
fi

with_sudo apt update -y

dependencies=(
cmake
)
with_sudo apt -y --no-install-recommends install "${dependencies[@]}"
}

get_build_artifacts_cmake() {
return 0
}

# Check if the binary artifact is installed
is_installed_cmake() {
if which cmake ; then
return 0
fi

return 1
}

setup_artifact_variables_cmake() {
return 0
}
15 changes: 15 additions & 0 deletions scripts/build/p-cmake-osx.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Package script for LLVM builds OSX
install_binary_artifact_cmake () {
# Use the brew provided package
LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
brew install "cmake"
}

# Check if the binary artifact is installed
is_installed_cmake() {
if which cmake ; then
return 0
fi

return 1
}
25 changes: 0 additions & 25 deletions scripts/build/p-klee-linux-ubuntu.inc
Original file line number Diff line number Diff line change
@@ -1,35 +1,10 @@
install_build_dependencies_klee() {
source "${DIR}/common-functions"

# Check if the Ubuntu version is an LTS version - otherwise no cmake version available
if [[ $(grep -q LTS /etc/os-release) ]]; then
with_sudo apt update -y
# Add Kitware's certificate for CMake
dependencies=(
apt-transport-https
ca-certificates
gnupg
lsb-release
software-properties-common
wget
)

with_sudo apt -y --no-install-recommends install "${dependencies[@]}"
wget -O - "https://apt.kitware.com/keys/kitware-archive-latest.asc" 2> /dev/null \
| gpg --dearmor - | with_sudo tee /etc/apt/trusted.gpg.d/kitware.gpg > /dev/null

# Add CMake repository
codename="$(lsb_release --codename --short)"
with_sudo apt-add-repository -y "deb https://apt.kitware.com/ubuntu/ ${codename} main"
fi

with_sudo apt update -y

# Install KLEE's dependencies
dependencies=(
build-essential
gcc-multilib # to generate 32bit
cmake
zlib1g-dev
python3
python3-setuptools
Expand Down
23 changes: 0 additions & 23 deletions scripts/build/p-libcxx-linux-ubuntu.inc
Original file line number Diff line number Diff line change
@@ -1,36 +1,13 @@
install_build_dependencies_libcxx() {
source "${DIR}/common-functions"

# Check if the Ubuntu version is an LTS version - otherwise no cmake version available
if [[ $(grep -q LTS /etc/os-release) ]]; then
with_sudo apt update -y
# Add Kitware's certificate for CMake
dependencies=(
apt-transport-https
ca-certificates
gnupg
lsb-release
software-properties-common
wget
)

with_sudo apt -y --no-install-recommends install "${dependencies[@]}"
wget -O - "https://apt.kitware.com/keys/kitware-archive-latest.asc" 2> /dev/null \
| gpg --dearmor - | with_sudo tee /etc/apt/trusted.gpg.d/kitware.gpg > /dev/null

# Add CMake repository
codename="$(lsb_release --codename --short)"
with_sudo apt-add-repository -y "deb https://apt.kitware.com/ubuntu/ ${codename} main"
fi

with_sudo apt-get update -y
dependencies=(
build-essential
ca-certificates
git
python3
python3-pip
cmake
curl
file # Needed for wllvm
)
Expand Down
23 changes: 0 additions & 23 deletions scripts/build/p-llvm-linux-ubuntu.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,6 @@
install_build_dependencies_llvm() {
source "${DIR}/common-functions"

# Check if the Ubuntu version is an LTS version - otherwise no cmake version available
if grep -q LTS /etc/os-release; then
with_sudo apt update -y
# Add Kitware's certificate for CMake
dependencies=(
apt-transport-https
ca-certificates
gnupg
lsb-release
software-properties-common
wget
)

with_sudo apt -y --no-install-recommends install "${dependencies[@]}"
wget -O - "https://apt.kitware.com/keys/kitware-archive-latest.asc" 2> /dev/null \
| gpg --dearmor - | with_sudo tee /etc/apt/trusted.gpg.d/kitware.gpg > /dev/null

# Add CMake repository
codename="$(lsb_release --codename --short)"
with_sudo apt-add-repository -y "deb https://apt.kitware.com/ubuntu/ ${codename} main"
fi

with_sudo apt update -y

dependencies=(
Expand All @@ -39,7 +17,6 @@ install_build_dependencies_llvm() {
make
git # To check out code
zlib1g-dev
cmake
git
)

Expand Down
2 changes: 1 addition & 1 deletion scripts/build/v-clang.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ required_variables_clang=(
"LLVM_VERSION"
)

artifact_dependency_clang=("")
artifact_dependency_clang=("cmake")

setup_variables_clang() {
local v_a
Expand Down
7 changes: 7 additions & 0 deletions scripts/build/v-cmake.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
artifact_dependency_cmake=("")

required_variables_cmake=("")

get_docker_config_id_cmake() {
return 0
}
2 changes: 1 addition & 1 deletion scripts/build/v-klee.inc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ required_variables_check_klee() {

# On which artifacts does KLEE depend on
artifact_dependency_klee(){
local dependencies=("llvm" "solvers" "gtest" "sqlite")
local dependencies=("llvm" "solvers" "gtest" "sqlite" "cmake")
if [[ "${OS}" != "osx" ]]; then
dependencies+=(uclibc)
fi
Expand Down
1 change: 1 addition & 0 deletions scripts/build/v-libcxx.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ required_variables_check_libcxx() {

artifact_dependency_libcxx(){
echo "clang"
echo "cmake"
}
5 changes: 4 additions & 1 deletion scripts/build/v-llvm.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export_variables_llvm=(
"BITCODE_CXX"
)

artifact_dependency_llvm=("sanitizer")
artifact_dependency_llvm=(
"sanitizer"
"cmake"
)

setup_variables_llvm() {
local v_a
Expand Down

0 comments on commit 31f92c5

Please sign in to comment.