File tree Expand file tree Collapse file tree 2 files changed +36
-6
lines changed Expand file tree Collapse file tree 2 files changed +36
-6
lines changed Original file line number Diff line number Diff line change 4
4
"name" : " llvm" ,
5
5
"documentationURL" : " https://github.com/devcontainers-community/features-llvm" ,
6
6
"description" : " Installs llvm on debian based systems" ,
7
- "options" : {},
7
+ "options" : {
8
+ "version" : {
9
+ "type" : " string" ,
10
+ "proposals" : [
11
+ " latest" ,
12
+ " 18" ,
13
+ " 17" ,
14
+ " 16"
15
+ ],
16
+ "default" : " latest" ,
17
+ "description" : " LLVM version"
18
+ }
19
+ },
8
20
"mounts" : [],
9
21
"installsAfter" : [
10
22
" ghcr.io/devcontainers/features/common-utils"
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
set -e
3
3
4
- apt update && apt install lsb-release wget software-properties-common gnupg -y -qq
4
+ if [ " $VERSION " == " latest" ]; then
5
+ VERSION=
6
+ fi
7
+ MAJOR_VERSION=${VERSION%% .* }
5
8
6
- bash -c " $( wget -O - https://apt.llvm.org/llvm.sh) "
9
+ # Checks if packages are installed and installs them if not
10
+ check_packages () {
11
+ if ! dpkg -s " $@ " > /dev/null 2>&1 ; then
12
+ apt_get_update
13
+ apt-get -y install --no-install-recommends " $@ "
14
+ fi
15
+ }
7
16
8
- ln -s /usr/bin/clang-17 /usr/bin/clang
9
- ln -s /usr/bin/clang++-17 /usr/bin/clang++
10
- ln -s /usr/bin/lld-17 /usr/bin/lld
17
+ check_packages lsb-release wget software-properties-common gnupg
18
+
19
+ cd /tmp
20
+ wget https://apt.llvm.org/llvm.sh
21
+ chmod +x llvm.sh
22
+ ./llvm.sh $VERSION
23
+ rm llvm.sh
24
+
25
+ ln -sf /usr/bin/clang-${MAJOR_VERSION} /usr/bin/clang
26
+ ln -sf /usr/bin/clang++-${MAJOR_VERSION} /usr/bin/clang++
27
+ ln -sf /usr/bin/lld-${MAJOR_VERSION} /usr/bin/lld
28
+ ln -sf /usr/bin/ld.lld-${MAJOR_VERSION} /usr/bin/ld.lld
You can’t perform that action at this time.
0 commit comments