2023-07-17 00:10:31 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# This script builds the llvm components used by the LCPU addon.
|
2023-07-17 00:21:20 -04:00
|
|
|
# This is run in a debian container to try and keep everything ABI stable.
|
2023-07-17 00:10:31 -04:00
|
|
|
|
2023-07-17 01:47:51 -04:00
|
|
|
# Act like make, sort of, and fail the whole script if some part fails
|
|
|
|
set -e
|
|
|
|
|
2023-07-17 00:10:31 -04:00
|
|
|
JOBS=$(nproc)
|
|
|
|
|
|
|
|
# Configure LLVM. THis is a mouthful, but it's only a mouthful because we specialize things we don't
|
|
|
|
# want in our minimal build of the LLVM project/clang.
|
2023-07-17 00:21:20 -04:00
|
|
|
cmake -Wno-dev -GNinja -S /build/llvm/llvm -B /build/llvm-build/build \
|
2023-07-17 00:10:31 -04:00
|
|
|
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
2023-07-17 00:21:20 -04:00
|
|
|
-DCMAKE_INSTALL_PREFIX="/build/llvm-build/install" \
|
2023-07-17 00:10:31 -04:00
|
|
|
-DLLVM_INCLUDE_TESTS=OFF \
|
|
|
|
-DLLVM_ENABLE_PROJECTS="clang;lld" \
|
2023-07-17 02:09:59 -04:00
|
|
|
-DLLVM_ENABLE_RUNTIMES="compiler-rt" \
|
|
|
|
-DCOMPILER_RT_BAREMETAL_BUILD=ON \
|
2023-07-17 00:10:31 -04:00
|
|
|
-DLLVM_TARGETS_TO_BUILD="RISCV" \
|
2023-07-17 02:09:59 -04:00
|
|
|
-DLLVM_DEFAULT_TARGET_TRIPLE="riscv32-unknown-gnu"
|
2023-07-17 00:10:31 -04:00
|
|
|
|
2023-07-17 01:47:51 -04:00
|
|
|
ninja -C /build/llvm-build/build -j $JOBS
|
2023-07-17 02:10:17 -04:00
|
|
|
ninja -C /build/llvm-build/build install
|