-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.sh
77 lines (62 loc) · 2.84 KB
/
bootstrap.sh
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# Copyright (c) 2020 SRI International All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
#!/usr/bin/env bash
# Install package dependencies
sudo apt-get update
sudo apt-get install -y build-essential cmake git gettext gnutls-dev groff-base libbz2-dev libevent-dev libidn11-dev libmemcached-tools libpcap-dev libpcre3-dev libssl-dev pkg-config python-minimal uuid-dev wget wireless-tools curl
# Download Trimmer
export TRIMMER_HOME=$HOME/Trimmer
cd `dirname $TRIMMER_HOME`
if test -n "$IN_VAGRANT"; then
git clone https://${USER}:${TOKEN}@github.com/ashish-gehani/Trimmer
fi
# Setup environment
cp $TRIMMER_HOME/vagrants/16.04/bash_profile $HOME/.bash_profile
. .bash_profile
# Install WLLVM
# 'pip' location must be in PATH
curl "https://bootstrap.pypa.io/pip/2.7/get-pip.py" -o "get-pip.py"
python get-pip.py
pip install wllvm
# Download LLVM7 and clang sources
mkdir $LLVM_HOME
cd $LLVM_HOME
wget https://releases.llvm.org/7.0.0/llvm-7.0.0.src.tar.xz
wget https://releases.llvm.org/7.0.0/cfe-7.0.0.src.tar.xz
tar xvf llvm-7.0.0.src.tar.xz
tar xvf cfe-7.0.0.src.tar.xz
mv cfe-7.0.0.src/ llvm-7.0.0.src/tools/clang
# Build, install LLVM7 / clang
mkdir llvm-7.0.0.obj
cd llvm-7.0.0.obj
cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../llvm-7.0.0.src
make -j16
sudo make install
# Download SVF
git clone https://github.com/SVF-tools/SVF
cd SVF
# Trimmer developed with below version
git checkout 0b75f3e0c10db04d65b6eafd91da5da9be71ecaa
# Add -fPIC to CMakeLists.txt in SVF
sed -i '/set(CMAKE_CXX_FLAGS "-std=gnu++11 -O3 -fno-rtti")/c\\t\tset(CMAKE_CXX_FLAGS "-std=gnu++11 -O3 -fno-rtti -fPIC")' CMakeLists.txt
sed -i '/set(CMAKE_CXX_FLAGS "-std=gnu++11 -O0 -fno-rtti")/c\\t\tset(CMAKE_CXX_FLAGS "-std=gnu++11 -O0 -fno-rtti -fPIC")' CMakeLists.txt
sed -i '/set_target_properties(Cudd PROPERTIES COMPILE_FLAGS "-Wno-format -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -O3 -w -DHAVE_IEEE_754 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8")/c\set_target_properties(Cudd PROPERTIES COMPILE_FLAGS "-Wno-format -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -O3 -w -DHAVE_IEEE_754 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8 -fPIC")' lib/CUDD/CMakeLists.txt
sed -i '/set_target_properties(LLVMCudd PROPERTIES COMPILE_FLAGS "-Wno-format -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -O3 -w -DHAVE_IEEE_754 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8")/c\set_target_properties(LLVMCudd PROPERTIES COMPILE_FLAGS "-Wno-format -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast -O3 -w -DHAVE_IEEE_754 -DSIZEOF_VOID_P=8 -DSIZEOF_LONG=8 -fPIC")' lib/CUDD/CMakeLists.txt
# Build and install SVF
mkdir Release-build
cd Release-build
cmake ..
make -j16
sudo make install
cd ../include/
sudo cp -r * /usr/local/include/
# Build Trimmer
cd $TRIMMER_HOME
mkdir build
cd build
cmake ..
make
# Test Trimmer
cd $TRIMMER_HOME/test/scripts/
python test.py ./work_dir all 1 1