Created
March 24, 2020 22:16
-
-
Save mikdusan/04ac65f51473c9f29c722a86e93cef2c 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
#!/usr/bin/env bash | |
set -e | |
################################################################################ | |
# | |
# note: if building with gcc you might need ~1.5-2.0 GiB per concurrent job | |
# | |
# apt install git vim ruby cmake ninja-build | |
# | |
################################################################################ | |
__JOBS=`nproc` | |
__PROJECT=~/work/llvm | |
__SOURCE=$__PROJECT/llvm-project | |
__LLVM_TAG="llvmorg-10.0.0" | |
__LLVM_PRODUCT="llvm-10.0.0" | |
__LLVM_INSTALL_ROOT=/opt/$__LLVM_PRODUCT | |
mkdir -pv `dirname $__SOURCE` | |
if [ ! -d $__SOURCE ]; then | |
echo "GIT: cloning llvm-project..." | |
git clone https://github.com/llvm/llvm-project.git $__SOURCE | |
fi | |
cd $__SOURCE | |
echo "GIT: switch to ${__LLVM_TAG}" | |
git switch --detach $__LLVM_TAG | |
git describe --always | |
################################################################################ | |
# | |
# build: llvm+clang+lld | |
# | |
################################################################################ | |
__BUILD=$__PROJECT/_build/$__LLVM_PRODUCT | |
__PREFIX=$__LLVM_INSTALL_ROOT | |
__PROJECTS="clang;lld" | |
if [ ! -f $__PREFIX/bin/llvm-config ]; then | |
if [ -d $__BUILD ]; then | |
echo "already exists: $__BUILD" | |
exit 1 | |
fi | |
mkdir -pv $__BUILD | |
cd $__BUILD | |
cmake -G "Ninja" \ | |
-DCMAKE_BUILD_TYPE="Release" \ | |
-DCMAKE_INSTALL_PREFIX="$__PREFIX" \ | |
-DCMAKE_PREFIX_PATH="$__PREFIX" \ | |
-DLLVM_ENABLE_PROJECTS="$__PROJECTS" \ | |
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR" \ | |
-DLLVM_ENABLE_LIBXML2="OFF" \ | |
-DLLVM_ENABLE_TERMINFO="OFF" \ | |
"$__SOURCE/llvm" | |
ninja -j$__JOBS install | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment