-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathmake-llvm.sh
executable file
·75 lines (55 loc) · 1.46 KB
/
make-llvm.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
#!/bin/sh
# Build llvm, as used in the Makefile
# A bit broken because it doesn't track cmake options and deps correctly
[ $# -gt 4 ] || {
echo "$0 major minor patch output_dir cmake_options*"
exit 1
}
set -e
mkdir -p ext
cd ext
VER="$1.$2"
VER2="$VER.$3"
TGT="$4"
LLVM_ROOT=llvm-$VER2.src
LLD_ROOT=lld-$VER2.src
CMAKE_ROOT=cmake-$VER2.src
[ -f $LLVM_ROOT.tar.xz ] || {
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-$VER2/$LLVM_ROOT.tar.xz
}
[ -f $LLVM_ROOT/CMakeLists.txt ] || {
tar xf $LLVM_ROOT.tar.xz
}
[ -f $LLD_ROOT.tar.xz ] || {
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-$VER2/$LLD_ROOT.tar.xz
}
[ -f $LLD_ROOT/CMakeLists.txt ] || {
tar xf $LLD_ROOT.tar.xz
}
[ -d $LLVM_ROOT/projects/lld ] || {
rm -rf $LLVM_ROOT/projects/lld
cd $LLVM_ROOT/projects
ln -sfr ../../$LLD_ROOT lld
cd ../..
}
[ -f $CMAKE_ROOT.tar.xz ] || {
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-$VER2/$CMAKE_ROOT.tar.xz
}
[ -f $CMAKE_ROOT/README.rst ] || {
tar xf $CMAKE_ROOT.tar.xz
}
rm -f cmake
ln -s $CMAKE_ROOT cmake
[ -f libunwind-$VER2.src.tar.xz ] || {
wget https://github.com/llvm/llvm-project/releases/download/llvmorg-$VER2/libunwind-$VER2.src.tar.xz
}
[ -f libunwind-$VER2/CMakeLists.txt ] || {
tar xf libunwind-$VER2.src.tar.xz
cp -ar libunwind-$VER2.src/include/mach-o $LLD_ROOT/include
}
cd $LLVM_ROOT
mkdir -p $TGT
cd $TGT
shift 4
cmake -GNinja -DLLVM_USE_LINKER=lld "$@" ..
ninja