Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#!/bin/bash
set -e
set -u
export SRC_LLVM="https://github.com/llvm-mirror/llvm.git"
export SRC_COMPILER_RT="https://github.com/llvm-mirror/compiler-rt.git"
export SRC_CLANG="https://github.com/llvm-mirror/clang.git"
export SRC_CLANG_EXTRA="https://github.com/llvm-mirror/clang-tools-extra.git"
export SRC_LIBCXX="https://github.com/llvm-mirror/libcxx.git"
export SRC_LIBCXXABI="https://github.com/llvm-mirror/libcxxabi.git"
function git_up() {
git reset -- .
git checkout -- .
git clean -df
git pull --rebase
}
function llvm_install() {
echo "Installing $2 to $1"
pushd .
if [[ ! -e "$1" ]]; then
mkdir -p "$1"
fi
cd "$1"
git clone "$2" "$3" || (cd "$3" && git_up)
popd
}
pushd .
llvm_install "." "$SRC_LLVM" "llvm"
llvm_install "llvm/tools" "$SRC_CLANG" "clang"
llvm_install "llvm/tools/clang/tools" "$SRC_CLANG_EXTRA" "extra"
llvm_install "llvm/projects" "$SRC_LIBCXX" "libcxx"
llvm_install "llvm/projects" "$SRC_LIBCXXABI" "libcxxabi"
llvm_install "llvm/projects" "$SRC_COMPILER_RT" "compiler-rt"
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment