about summary refs log tree commit diff homepage
path: root/scripts/build/p-clang.inc
blob: 1b4593c94cdf84ab2a51840bce9a23384e6e8a25 (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
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
local_setup_build_variables_clang() {
  source "${DIR}/common-functions"
  LLVM_SUFFIX=""

  LLVM_SUFFIX+="_O"
  LLVM_SUFFIX+="_ND"
  LLVM_SUFFIX+="_NA"
  LLVM_SUFFIX+="_RTTI"

  LLVM_SRC_BASE="${BASE}/llvm-${LLVM_VERSION_SHORT}"
  LLVM_BUILD="${LLVM_SRC_BASE}-build${LLVM_SUFFIX}"
  LLVM_INSTALL="${LLVM_SRC_BASE}-install${LLVM_SUFFIX}"
  LLVM_BIN="${LLVM_INSTALL}/bin"
  LLVM_BUILD_BIN="${LLVM_BUILD}/bin"

  LLVM_CONFIG="${LLVM_BIN}/llvm-config"
  BITCODE_CC="${LLVM_BIN}/clang"
  BITCODE_CXX="${LLVM_BIN}/clang++"
}

get_docker_config_id_clang() {
  (
    local_setup_build_variables_clang
    echo "${LLVM_VERSION_SHORT}${LLVM_SUFFIX}"
  )
}

get_build_artifacts_clang() {
  (
    local_setup_build_variables_clang
    echo "${LLVM_INSTALL}"
  )
}

# Check if the binary artifact is installed
is_installed_clang() {
  local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
  local version="${LLVM_VERSION_MAJOR}"

  (
    local_setup_build_variables_clang
    # Check if clang is installed at a potential location
    [[ -f "${LLVM_BIN}/clang" ]]
  )
}

setup_artifact_variables_clang() {
  is_installed_clang || return 1

  local LLVM_VERSION_MAJOR="${LLVM_VERSION/.*/}"
  local version="${LLVM_VERSION_MAJOR}"
  local_setup_build_variables_clang
  echo "${LLVM_INSTALL}"
}

install_build_dependencies_clang() {
  return 0
}

setup_build_variables_clang() {
  return 0
}