-
Notifications
You must be signed in to change notification settings - Fork 0
/
llvm-build.sh
executable file
·43 lines (36 loc) · 1.14 KB
/
llvm-build.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
#! /bin/bash -e
CURR_DIR=$(pwd)
# ================= Main Body ===================== #
ZIPS_DIR=zips
TOOLS_DIR=tools
LLVM_DIR=llvm
LLVM_BUILD=llvm-build
mkdir -p $ZIPS_DIR
mkdir -p $TOOLS_DIR
# get the sources of clang, compiler-rt, and llvm
wget -N http://llvm.org/releases/3.8.1/llvm-3.8.1.src.tar.xz -P $ZIPS_DIR/
wget -N http://llvm.org/releases/3.8.1/compiler-rt-3.8.1.src.tar.xz -P $ZIPS_DIR/
wget -N http://llvm.org/releases/3.8.1/cfe-3.8.1.src.tar.xz -P $ZIPS_DIR/
# unzip
tar xfJ $ZIPS_DIR/llvm-3.8.1.src.tar.xz
tar xfJ $ZIPS_DIR/compiler-rt-3.8.1.src.tar.xz
tar xfJ $ZIPS_DIR/cfe-3.8.1.src.tar.xz
# relocate the sources
rm -rf $LLVM_DIR
mv llvm-3.8.1.src $LLVM_DIR
mv compiler-rt-3.8.1.src $LLVM_DIR/projects/compiler-rt
mv cfe-3.8.1.src $LLVM_DIR/tools/clang
# TCT patch
sed -i'' 's|bool hasMD() const { return MDMap; }|bool hasMD() const { return bool(MDMap); }|g' $LLVM_DIR/include/llvm/IR/ValueMap.h
# build llvm
rm -rf $LLVM_BUILD
mkdir $LLVM_BUILD
cd $LLVM_BUILD
export C_INCLUDE_PATH=
export CPLUS_INCLUDE_PATH=
../llvm/configure
# cmake -G "Unix Makefiles" ../llvm
make -j4
# build SRCMutation
cd $CURR_DIR/SRCMutation
make