forked from mmozeiko/rpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·36 lines (28 loc) · 1.63 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
#!/bin/bash
set -eu
ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
LLVM_VERSION=10.0.0
mkdir -p "${TOOLCHAIN}"
mkdir -p "${ROOT}"/{llvm.src,llvm.build}
mkdir -p "${ROOT}"/llvm.src/tools/{clang,lld}
curl -Lf https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz | tar -xJ -C "${ROOT}"/llvm.src --strip-components=1
curl -Lf https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/clang-${LLVM_VERSION}.src.tar.xz | tar -xJ -C "${ROOT}"/llvm.src/tools/clang --strip-components=1
curl -Lf https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/lld-${LLVM_VERSION}.src.tar.xz | tar -xJ -C "${ROOT}"/llvm.src/tools/lld --strip-components=1
# patching lld to work for armv6
# more info: https://reviews.llvm.org/D50076 & https://reviews.llvm.org/D50077
#curl -Lf https://reviews.llvm.org/D50076?download=true | patch -p0 -d "${ROOT}"/llvm.src/tools/lld
#curl -Lf https://reviews.llvm.org/D50077?download=true | patch -p2 -d "${ROOT}"/llvm.src/tools/lld
cd "${ROOT}"/llvm.build
cmake "${ROOT}"/llvm.src \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${TOOLCHAIN}" \
-DLLVM_TARGETS_TO_BUILD="ARM;AArch64" \
-DLLVM_ENABLE_ASSERTIONS=OFF -DLLVM_OPTIMIZED_TABLEGEN=ON \
-DLLVM_BUILD_TESTS=OFF -DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_BUILD_EXAMPLES=OFF -DLLVM_INCLUDE_EXAMPLES=OFF \
-DLLVM_ENABLE_WARNINGS=OFF -DLLVM_ENABLE_WERROR=OFF \
-DLLVM_BUILD_DOCS=OFF -DLLVM_ENABLE_BINDINGS=OFF
cmake --build . -- -j`nproc`
cmake --build . --target install -- -j`nproc`
cd "${ROOT}"
rm -rf "${ROOT}"/{llvm.src,llvm.build}