-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·63 lines (55 loc) · 1.86 KB
/
build.sh
File metadata and controls
executable file
·63 lines (55 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/bash
# Step 1: Clone and build SVF
if [ -z "$SVF_DIR" ] || [ ! -d "$SVF_DIR" ]; then
git clone https://github.com/SVF-tools/SVF
cd SVF
source build.sh
cd ..
else
echo "SVF directory already exists. Skipping clone and build."
fi
# Step 2: Check environment variables
if [ -z "$SVF_DIR" ] || [ -z "$LLVM_DIR" ] || [ -z "$Z3_DIR" ]; then
echo "Please define SVF_DIR, LLVM_DIR, and Z3_DIR."
exit 1
fi
# Step 3: Ensure python3.10 is available
if ! command -v python3.10 &> /dev/null; then
echo "Python 3.10 not found. Attempting to install..."
# Detect OS
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sudo apt update
sudo apt install -y software-properties-common
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt update
sudo apt install -y python3.10 python3.10-venv python3.10-dev
elif [[ "$OSTYPE" == "darwin"* ]]; then
if ! command -v brew &> /dev/null; then
echo "Homebrew not found. Please install Homebrew first: https://brew.sh/"
exit 1
fi
brew install python@3.10
else
echo "Unsupported OS: $OSTYPE"
exit 1
fi
else
echo "Python 3.10 found."
fi
# Step 4: Ensure pip is installed for python3.10
if ! python3.10 -m pip &> /dev/null; then
echo "pip not found for Python 3.10. Installing pip..."
curl -sS https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3.10 get-pip.py
rm get-pip.py
fi
# Step 5: Install Python build dependencies
python3.10 -m pip install -U pip pybind11 setuptools wheel build
PYBIND11_DIR=$(python3.10 -m pybind11 --cmakedir)
# Step 6: Build the wheel
SVF_DIR=${SVF_DIR} LLVM_DIR=${LLVM_DIR} Z3_DIR=${Z3_DIR} PYBIND11_DIR=${PYBIND11_DIR} python3.10 -m build --wheel
if [ $? -ne 0 ]; then
echo "Building for Python 3.10 failed."
else
echo "Successfully built for Python 3.10."
fi