about summary refs log tree commit diff homepage
path: root/scripts/build/p-clang-linux-ubuntu-16.04.inc
blob: 0fb30e52f94b6b8373c52d695d676791016b3c9a (plain) (blame)
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
install_binary_artifact_clang() {
  local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
  local LLVM_VERSION_MINOR="${LLVM_VERSION/*./}"

  local version=""
  [[ "${LLVM_VERSION_MAJOR}" -le 6 ]] && version="-${LLVM_VERSION}"
  [[ "${LLVM_VERSION_MAJOR}" -ge 7 ]] && version="-${LLVM_VERSION_MAJOR}"

  # apt.llvm packages for Trusty clang 5.0 package is broken with atomics. Don't use it.
  if [[ "${LLVM_VERSION_MAJOR}" -gt 6 ]]; then
    # Add certificate
    apt update -y
    dependencies=(
      ca-certificates
      wget
    )

    apt -y --no-install-recommends install "${dependencies[@]}"
    wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add -

    # Add repository
    echo "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial${version} main" >> /etc/apt/sources.list
  fi

  apt update -y
  dependencies=(
    "llvm${version}"
    "clang${version}"
  )

  #Install essential dependencies
  apt -y --no-install-recommends install "${dependencies[@]}"
}

get_docker_config_id_clang() {
  return 0
}