forked from ziglang/zig
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·126 lines (116 loc) · 2.56 KB
/
install.sh
File metadata and controls
executable file
·126 lines (116 loc) · 2.56 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/env bash
set -eou pipefail
# Determine architecture
ARCH=$(dpkg --print-architecture)
# Default platform and download type
MIRROR="llvm"
PLATFORM="linux-gnu"
PACKAGE_BASE="clang+llvm"
DOWNLOAD_TYPE="tar.xz"
# Match architecture with LLVM naming
case "${ARCH}" in
"amd64") ARCH="x86_64";;
esac
# Match quirks
case "${ARCH}:${LLVM_VERSION}" in
"x86_64:2.9")
PLATFORM="linux.tar"
DOWNLOAD_PLATFORM="linux"
DOWNLOAD_TYPE="tar.bz2"
;;
"x86_64:3.0")
PLATFORM="linux-debian"
DOWNLOAD_TYPE="tar.gz"
;;
"x86_64:3.1")
PLATFORM="linux-ubuntu_12.04"
DOWNLOAD_TYPE="tar.gz"
;;
"x86_64:3.2")
PLATFORM="linux-ubuntu-12.04"
DOWNLOAD_TYPE="tar.gz"
;;
"x86_64:3.3")
ARCH="amd64"
PLATFORM="debian6"
DOWNLOAD_TYPE="tar.bz2"
;;
"x86_64:3.4.2")
PLATFORM="linux-gnu-ubuntu-14.04"
DOWNLOAD_TYPE="xz"
;;
"x86_64:3.5.2")
DOWNLOAD_PLATFORM="linux-gnu-ubuntu-14.04"
;;
"x86_64:3.6.2")
PLATFORM="linux-gnu-ubuntu-15.04"
;;
"x86_64:3.7.1")
PLATFORM="linux-gnu-ubuntu-15.10"
;;
"x86_64:3.8.1")
PLATFORM="linux-gnu-debian8"
;;
"x86_64:3.9.1")
PLATFORM="linux-gnu-debian8"
;;
"x86_64:4.0."*)
PLATFORM="linux-gnu-debian8"
;;
"x86_64:5.0."*)
PLATFORM="linux-gnu-ubuntu-16.04"
;;
"x86_64:6.0."*)
PLATFORM="linux-gnu-ubuntu-16.04"
;;
"x86_64:7.0."*)
PLATFORM="linux-gnu-ubuntu-18.04"
;;
"x86_64:8.0."*)
PLATFORM="linux-gnu-ubuntu-18.04"
;;
"x86_64:9.0."*)
PLATFORM="linux-gnu-ubuntu-18.04"
;;
"x86_64:10.0."*)
MIRROR="github"
PLATFORM="linux-gnu-ubuntu-18.04"
;;
"x86_64:11.0."*)
MIRROR="github"
PLATFORM="linux-gnu-ubuntu-20.04"
;;
"x86_64:12.0."*)
MIRROR="github"
PLATFORM="linux-gnu-ubuntu-20.04"
;;
"x86_64:13.0."*)
MIRROR="github"
PLATFORM="linux-gnu-ubuntu-20.04"
;;
esac
case "${MIRROR}" in
"github")
MIRROR_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}"
;;
"llvm")
MIRROR_URL="http://releases.llvm.org/${LLVM_VERSION}"
;;
esac
if [ -z ${DOWNLOAD_PLATFORM+x} ]; then
DOWNLOAD_PLATFORM="${PLATFORM}"
fi
# Set install target and download file
TARGET="${PACKAGE_BASE}-${LLVM_VERSION}-${ARCH}-${PLATFORM}"
DOWNLOAD="${PACKAGE_BASE}-${LLVM_VERSION}-${ARCH}-${DOWNLOAD_PLATFORM}.${DOWNLOAD_TYPE}"
DOWNLOAD_FILE="llvm.${DOWNLOAD_TYPE}"
# Download
echo "Downloading ${DOWNLOAD}"
wget -nv -O "${DOWNLOAD_FILE}" "${MIRROR_URL}/${DOWNLOAD}"
wget -nv -O "${DOWNLOAD_FILE}.sig" "${MIRROR_URL}/${DOWNLOAD}.sig"
# Install
echo "Installing ${TARGET}"
tar xf "${DOWNLOAD_FILE}"
cp -a "${TARGET}/"* "/usr/local/"
# Cleanup
rm -rf "${DOWNLOAD_FILE}" "${TARGET:?}/" install.sh