Last active
May 11, 2020 22:07
-
-
Save cwpearson/fafcfd598477d078c8989a8f3e280fa7 to your computer and use it in GitHub Desktop.
Install llvm 10.0.0 to $HOME/software/llvm-10.0.0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -eou pipefail | |
set -x | |
workdir=`mktemp -d` | |
workdir=`readlink -f $workdir` | |
echo $workdir | |
#trap "{ echo cleaning up $workdir; rm -r $workdir; }" EXIT | |
trap "{ echo workdir was $workdir; }" EXIT | |
cd $workdir | |
git clone --recursive \ | |
--branch llvmorg-10.0.0 \ | |
--depth 1 \ | |
git@github.com:llvm/llvm-project.git | |
# build only clang, libc++, libc++abi | |
mkdir -p $workdir/build-base | |
cd $workdir/build-base && cmake $workdir/llvm-project/llvm \ | |
-DCMAKE_BUILD_TYPE=MinSizeRel \ | |
-DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi" \ | |
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON | |
cd $workdir/build-base && nice -n20 make -j`nproc` -k || make | |
# use clang to build the full toolsuite | |
# libc and debuginfo-tests both error | |
cd $workdir | |
mkdir -p $workdir/build | |
cd $workdir/build && cmake $workdir/llvm-project/llvm \ | |
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;compiler-rt;libclc;libcxx;libcxxabi;libunwind;lld;lldb;openmp;parallel-libs;polly;pstl" \ | |
-DLLVM_ENABLE_LIBCXX=ON \ | |
-DCMAKE_CXX_COMPILER=$workdir/build-base/bin/clang++ \ | |
-DCMAKE_C_COMPILER=$workdir/build-base/bin/clang \ | |
-DCMAKE_BUILD_TYPE=MinSizeRel \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/software/llvm-10.0.0 | |
cd $workdir/build && nice -n20 make -j`nproc` -k || make | |
cd $workdir/build && make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment