tweak llvm setup script, now puts in a relative git dir and some possible failure states are fixed

This commit is contained in:
CasualPokePlayer 2023-03-28 19:20:36 -07:00
parent c8a2eca83f
commit a12d11b2ea
1 changed files with 8 additions and 8 deletions

View File

@ -3,19 +3,19 @@ set -e
LLVM_TAG=llvmorg-16.0.0
LLVM_DIRS="cmake compiler-rt libunwind libcxx libcxxabi"
LLVM_PATH=../llvm-project
LLVM_GIT_DIR=$(git rev-parse --absolute-git-dir)/modules/waterbox/llvm-project
LLVM_GIT_DIR=$(git rev-parse --git-path modules/waterbox/llvm-project)
if [ -d "$LLVM_PATH" ]; then
if [ ! -e "$LLVM_PATH/.git" ] || ! git -C "$LLVM_PATH" rev-parse $LLVM_TAG > /dev/null 2>&1; then
rm -rf "$LLVM_PATH"
git submodule deinit -f "$LLVM_PATH"
rm -rf "$LLVM_GIT_DIR"
fi
if [ ! -e "$LLVM_PATH/.git" ] || ! git -C "$LLVM_PATH" rev-parse $LLVM_TAG > /dev/null 2>&1; then
rm -rf "$LLVM_PATH"
git submodule deinit -f "$LLVM_PATH"
rm -rf "$LLVM_GIT_DIR"
fi
if [ ! -d "$LLVM_PATH" ]; then
if [ ! -e "$LLVM_PATH/.git" ]; then
git submodule init "$LLVM_PATH"
git clone --separate-git-dir="$LLVM_GIT_DIR" --filter=tree:0 --sparse https://github.com/llvm/llvm-project.git "$LLVM_PATH"
rm "$LLVM_PATH/.git"
printf "%s\n" "gitdir: $LLVM_GIT_DIR" > "$LLVM_PATH/.git"
fi
cd "$LLVM_PATH"