Skip to content

Instantly share code, notes, and snippets.

@astarasikov
Created April 10, 2015 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save astarasikov/a2e9287a34381f680d58 to your computer and use it in GitHub Desktop.
Save astarasikov/a2e9287a34381f680d58 to your computer and use it in GitHub Desktop.
#!/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