aboutsummaryrefslogtreecommitdiff
path: root/installer/install-clangd.sh
blob: 3d1cfd0dab1b0b65f05c9f0807539c2ac23c1987 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

set -e

os=$(uname -s | tr "[:upper:]" "[:lower:]")

case $os in
    linux)
        platform="pc-linux-gnu"
        ;;
    darwin)
        platform="darwin-apple"
        ;;
esac

# Check Ubuntu version
ubuntu_version=$(lsb_release -a 2>&1 | grep 'Release' | awk '{print $2}')

case $ubuntu_version in
    14.04|16.04|18.04)
        platform="linux-gnu-ubuntu-$ubuntu_version"
        ;;
esac

filename="clang+llvm-9.0.0-x86_64-$platform"
url="http://releases.llvm.org/9.0.0/$filename.tar.xz"
echo "Downloading clangd and LLVM..."
curl -LO "$url"
echo "Extracting archive..."
tar xf $filename.tar.xz --strip-components=1 $filename/
rm $filename.tar.xz
ln -sf bin/clangd
./clangd --version