Skip to content

Instantly share code, notes, and snippets.

@rsippl
Created January 2, 2018 15:38
Show Gist options
  • Save rsippl/a05eb42421c2c2e12f16267b0e176fa1 to your computer and use it in GitHub Desktop.
Save rsippl/a05eb42421c2c2e12f16267b0e176fa1 to your computer and use it in GitHub Desktop.
Build Clang 6 from Git repo
#!/bin/bash
#set -x
set -e
INSTALL_PREFIX=/usr/local/clang-devel
CLONE_OPTS="--depth 1"
echo Cloning LLVM
test ! -d llvm && git clone ${CLONE_OPTS} https://git.llvm.org/git/llvm.git
echo Cloning Clang
test ! -d llvm/tools/clang && git clone ${CLONE_OPTS} https://git.llvm.org/git/clang.git llvm/tools/clang
echo Cloning Extra Clang Tools
test ! -d llvm/tools/clang/tools/extra && git clone ${CLONE_OPTS} https://git.llvm.org/git/clang-tools-extra.git llvm/tools/clang/tools/extra
echo Cloning LLD linker
test ! -d llvm/tools/lld && git clone ${CLONE_OPTS} https://git.llvm.org/git/lld.git llvm/tools/lld
echo Cloning Polly Loop Optimizer
test ! -d llvm/tools/polly && git clone ${CLONE_OPTS} https://git.llvm.org/git/polly.git llvm/tools/polly
echo Cloning Compiler-RT
test ! -d llvm/projects/compiler-rt && git clone ${CLONE_OPTS} https://git.llvm.org/git/compiler-rt.git llvm/projects/compiler-rt
echo Cloning Libomp
test ! -d llvm/projects/openmp && git clone ${CLONE_OPTS} https://git.llvm.org/git/openmp.git llvm/projects/openmp
echo Cloning libcxx
test ! -d llvm/projects/libcxx && git clone ${CLONE_OPTS} https://git.llvm.org/git/libcxx.git llvm/projects/libcxx
echo Cloning libcxxabi
test ! -d llvm/projects/libcxxabi && git clone ${CLONE_OPTS} https://git.llvm.org/git/libcxxabi.git llvm/projects/libcxxabi
#echo Cloning Test Suite
#test ! -d llvm/projects/test-suite && git clone ${CLONE_OPTS} https://git.llvm.org/git/test-suite.git llvm/projects/test-suite
mkdir -p build && cd build
echo Configuring LLVM/Clang for ninja
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} -DLLVM_TARGETS_TO_BUILD=X86 --build ../llvm
echo Building LLVM/Clang
ninja
# ninja install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment