Created
June 13, 2019 21:07
-
-
Save cwpearson/c13ac7c25bde8c8644300e211faf4e78 to your computer and use it in GitHub Desktop.
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 | |
workdir=`mktemp -d -p $HOME` | |
workdir=`readlink -f $workdir` | |
echo $workdir | |
#trap "{ echo cleaning up $workdir; rm -r $workdir; }" EXIT | |
trap "{ echo workdir was $workdir; }" EXIT | |
cd $workdir | |
# llvm | |
wget http://releases.llvm.org/7.1.0/llvm-7.1.0.src.tar.xz | |
tar -vxf llvm-7.1.0.src.tar.xz | |
# clang | |
wget http://releases.llvm.org/7.1.0/cfe-7.1.0.src.tar.xz | |
tar -vxf cfe-7.1.0.src.tar.xz | |
# libc++ | |
wget http://releases.llvm.org/7.1.0/libcxx-7.1.0.src.tar.xz | |
tar -vxf libcxx-7.1.0.src.tar.xz | |
# libc++abi | |
wget http://releases.llvm.org/7.1.0/libcxxabi-7.1.0.src.tar.xz | |
tar -vxf libcxxabi-7.1.0.src.tar.xz | |
# openmp | |
wget http://releases.llvm.org/7.1.0/openmp-7.1.0.src.tar.xz | |
tar -vxf openmp-7.1.0.src.tar.xz | |
# compiler-rt | |
wget http://releases.llvm.org/7.1.0/compiler-rt-7.1.0.src.tar.xz | |
tar -vxf compiler-rt-7.1.0.src.tar.xz | |
# build a basic clang to bootstrap the libcxx build | |
mv cfe-7.1.0.src llvm-7.1.0.src/tools/clang | |
mkdir -p $workdir/build-base | |
cd $workdir/build-base && cmake ../llvm-7.1.0.src \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DLLVM_TARGETS_TO_BUILD="PowerPC" \ | |
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON | |
cd $workdir/build-base && nice -n20 make -j40 -k || make | |
# use the clang8 build to build clang again, but this time with all the bells and whistles | |
cd $workdir | |
mv libcxx-7.1.0.src llvm-7.1.0.src/projects/libcxx | |
mv libcxxabi-7.1.0.src llvm-7.1.0.src/projects/libcxxabi | |
mv openmp-7.1.0.src llvm-7.1.0.src/projects/openmp | |
mv compiler-rt-7.1.0.src llvm-7.1.0.src/projects/openmp | |
mkdir -p $workdir/build | |
cd $workdir/build && cmake $workdir/llvm-7.1.0.src \ | |
-DCMAKE_CXX_COMPILER=$workdir/build-base/bin/clang++ \ | |
-DCMAKE_C_COMPILER=$workdir/build-base/bin/clang \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=$HOME/software/clang-7.1.0 | |
cd $workdir/build && nice -n20 make -j40 -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