aboutsummaryrefslogtreecommitdiff
path: root/services/docker/debian-dev/bootstrap/extra/setup-llvm.bash
diff options
context:
space:
mode:
Diffstat (limited to 'services/docker/debian-dev/bootstrap/extra/setup-llvm.bash')
-rwxr-xr-xservices/docker/debian-dev/bootstrap/extra/setup-llvm.bash26
1 files changed, 26 insertions, 0 deletions
diff --git a/services/docker/debian-dev/bootstrap/extra/setup-llvm.bash b/services/docker/debian-dev/bootstrap/extra/setup-llvm.bash
new file mode 100755
index 0000000..48dde86
--- /dev/null
+++ b/services/docker/debian-dev/bootstrap/extra/setup-llvm.bash
@@ -0,0 +1,26 @@
+#! /usr/bin/env bash
+
+set -e
+
+LLVM_VERSION=18
+
+. /bootstrap/func.bash
+
+if is_true "$CRUPEST_DEBIAN_DEV_IN_CHINA"; then
+ base_url=https://mirrors.tuna.tsinghua.edu.cn/llvm-apt
+else
+ base_url=https://apt.llvm.org
+fi
+
+wget "$base_url/llvm.sh"
+chmod +x llvm.sh
+./llvm.sh $LLVM_VERSION all -m "$base_url"
+rm llvm.sh
+
+update-alternatives --install /usr/bin/clang clang /usr/bin/clang-$LLVM_VERSION 100 \
+ --slave /usr/bin/clang++ clang++ /usr/bin/clang++-$LLVM_VERSION \
+ --slave /usr/bin/clangd clangd /usr/bin/clangd-$LLVM_VERSION \
+ --slave /usr/bin/clang-format clang-format /usr/bin/clang-format-$LLVM_VERSION \
+ --slave /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-$LLVM_VERSION \
+ --slave /usr/bin/lldb lldb /usr/bin/lldb-$LLVM_VERSION \
+ --slave /usr/bin/lld lld /usr/bin/lld-$LLVM_VERSION