-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_llvmorg.sh
executable file
·62 lines (48 loc) · 1.6 KB
/
setup_llvmorg.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
#!/bin/bash
build_llvm(){
local version=$1
local folder="llvmorg-$version"
if [ -d $folder ]; then
return
fi
wget -O llvmorg.tar.xz "https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-$version.tar.gz"
mkdir $folder && tar -xf llvmorg.tar.xz -C $folder --strip-components 1 && rm llvmorg.tar.xz
cd $folder
if [ $version == "12.0.0" ]; then
cp ../overrides/llvmorg-12.0.0/Signals.h llvm/include/llvm/Support/Signals.h
fi
mkdir build && cd build
cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../llvm
make -j$(nproc)
cd ../..
}
build_llvm_legacy(){
local version=$1
local folder="llvmorg-$version"
if [ -d $folder ]; then
return
fi
mkdir $folder && cd $folder
local components=(
"cfe" "clang-tools-extra" "compiler-rt" "libcxx" "libcxxabi" "libunwind"
"lld" "lldb" "llvm" "openmp" "polly" "test-suite"
)
for component in "${components[@]}"; do
wget "https://releases.llvm.org/$version/$component-$version.src.tar.xz"
done
ls *.tar.xz | xargs -n1 tar -xJf
rm *.tar.xz
rename "s/-$version\.src$//" *
mv cfe clang
cp ../overrides/llvmorg-9.0.0/benchmark_register.h llvm/utils/benchmark/src/benchmark_register.h
cp ../overrides/llvmorg-9.0.0/MicrosoftDemangle.h llvm/include/llvm/Demangle/MicrosoftDemangle.h
cp ../overrides/llvmorg-9.0.0/MicrosoftDemangleNodes.h llvm/include/llvm/Demangle/MicrosoftDemangleNodes.h
mkdir build && cd build
cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ../llvm
make -j$(nproc)
cd ../..
}
build_llvm "18.1.6"
build_llvm "15.0.0"
build_llvm "12.0.0"
build_llvm_legacy "9.0.0"