-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·56 lines (51 loc) · 1.45 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -e
set -x
curl -L -O https://github.com/llvm/llvm-project/releases/download/llvmorg-$version/llvm-project-$version.src.tar.xz
uname
if [[ $(uname) = MINGW* ]]; then
7z x -y llvm-project-$version.src.tar.xz
7z x -y llvm-project-$version.src.tar
else
tar xf llvm-project-$version.src.tar.xz
fi
rm llvm-project-$version.src.tar*
cmake_flags=(
-DCMAKE_INSTALL_PREFIX="$PWD/install"
-DCMAKE_BUILD_TYPE=Release
-DLLVM_ENABLE_TERMINFO=OFF
-DLLVM_ENABLE_LIBEDIT=OFF
-DLLVM_ENABLE_ZLIB=OFF
-DLLVM_ENABLE_ZSTD=OFF
-DLLVM_ENABLE_LIBXML2=OFF
-DLLVM_ENABLE_ASSERTIONS=OFF
)
mkdir build install
cd build
if [[ $(uname) = MINGW* ]]; then
export CMAKE_GENERATOR="Visual Studio 17 2022"
export CMAKE_GENERATOR_PLATFORM=x64
export CMAKE_GENERATOR_TOOLSET="host=x64"
cmake_flags+=(
-DLLVM_ENABLE_PROJECTS=clang
)
else
cmake_flags+=(
-DLLVM_ENABLE_PROJECTS='clang;lld'
-DLLVM_ENABLE_RUNTIMES=libunwind
)
fi
cmake ../llvm-project-$version.src/llvm "${cmake_flags[@]}"
if [[ $(uname) = MINGW* ]]; then
cmake --build . --target INSTALL --config Release -j${threads:-4}
else
make install -j${threads:-4}
fi
cd ..
rm -rf build llvm-project-$version.src*
mv install clang+llvm-$version-$triple
if [[ $(uname) = MINGW* ]]; then
7z a -t7z clang+llvm-$version-$triple.7z clang+llvm-$version-$triple
else
tar cfzv clang+llvm-$version-$triple.tar.gz clang+llvm-$version-$triple
fi