2023-02-09 23:29:10 +08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-05-03 23:55:45 +08:00
|
|
|
set -e
|
|
|
|
|
2023-02-09 23:29:10 +08:00
|
|
|
# Checkout LLVM sources
|
2023-11-23 16:45:02 +08:00
|
|
|
git clone --depth=1 --branch llvmorg-16.0.6 https://github.com/llvm/llvm-project.git llvm-project
|
2023-05-03 23:55:45 +08:00
|
|
|
|
2023-02-09 23:29:10 +08:00
|
|
|
## Setup libc++ options
|
2023-05-03 23:55:45 +08:00
|
|
|
if [ -z "$BUILD_32_BITS" ]; then
|
|
|
|
export BUILD_32_BITS=OFF && echo disabling 32 bit build
|
|
|
|
fi
|
2023-02-09 23:29:10 +08:00
|
|
|
|
2023-05-03 23:55:45 +08:00
|
|
|
## Build and install libc++ (Use unstable ABI for better sanitizer coverage)
|
|
|
|
mkdir llvm-build && cd llvm-build
|
|
|
|
cmake -DCMAKE_C_COMPILER=${CC} \
|
|
|
|
-DCMAKE_CXX_COMPILER=${CXX} \
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr \
|
|
|
|
-DLIBCXX_ABI_UNSTABLE=OFF \
|
|
|
|
-DLLVM_USE_SANITIZER=${LIBCXX_SANITIZER} \
|
|
|
|
-DLLVM_BUILD_32_BITS=${BUILD_32_BITS} \
|
|
|
|
-DLLVM_ENABLE_RUNTIMES='libcxx;libcxxabi;libunwind' \
|
|
|
|
-G "Unix Makefiles" \
|
|
|
|
../llvm-project/runtimes/
|
|
|
|
make -j cxx cxxabi unwind
|
|
|
|
cd ..
|