]>
Commit | Line | Data |
---|---|---|
e74abb32 XL |
1 | #!/bin/bash |
2 | # This script installs clang on the local machine. Note that we don't install | |
3 | # clang on Linux since its compiler story is just so different. Each container | |
4 | # has its own toolchain configured appropriately already. | |
5 | ||
6 | set -euo pipefail | |
7 | IFS=$'\n\t' | |
8 | ||
9 | source "$(cd "$(dirname "$0")" && pwd)/../shared.sh" | |
10 | ||
11 | if isMacOS; then | |
60c5eb7d | 12 | curl -f "${MIRRORS_BASE}/clang%2Bllvm-9.0.0-x86_64-darwin-apple.tar.xz" | tar xJf - |
e74abb32 | 13 | |
60c5eb7d XL |
14 | ciCommandSetEnv CC "$(pwd)/clang+llvm-9.0.0-x86_64-darwin-apple/bin/clang" |
15 | ciCommandSetEnv CXX "$(pwd)/clang+llvm-9.0.0-x86_64-darwin-apple/bin/clang++" | |
e74abb32 XL |
16 | |
17 | # Configure `AR` specifically so rustbuild doesn't try to infer it as | |
18 | # `clang-ar` by accident. | |
19 | ciCommandSetEnv AR "ar" | |
60c5eb7d | 20 | elif isWindows && [[ ${CUSTOM_MINGW-0} -ne 1 ]]; then |
e74abb32 XL |
21 | # If we're compiling for MSVC then we, like most other distribution builders, |
22 | # switch to clang as the compiler. This'll allow us eventually to enable LTO | |
23 | # amongst LLVM and rustc. Note that we only do this on MSVC as I don't think | |
24 | # clang has an output mode compatible with MinGW that we need. If it does we | |
25 | # should switch to clang for MinGW as well! | |
26 | # | |
27 | # Note that the LLVM installer is an NSIS installer | |
28 | # | |
29 | # Original downloaded here came from | |
60c5eb7d XL |
30 | # http://releases.llvm.org/9.0.0/LLVM-9.0.0-win64.exe |
31 | # That installer was run through `wine ./installer.exe /S /NCRC` on Linux | |
32 | # and then the resulting installation directory (found in | |
33 | # `$HOME/.wine/drive_c/Program Files/LLVM`) was packaged up into a tarball. | |
34 | # We've had issues otherwise that the installer will randomly hang, provide | |
35 | # not a lot of useful information, pollute global state, etc. In general the | |
36 | # tarball is just more confined and easier to deal with when working with | |
37 | # various CI environments. | |
e74abb32 XL |
38 | |
39 | mkdir -p citools | |
40 | cd citools | |
60c5eb7d | 41 | curl -f "${MIRRORS_BASE}/LLVM-9.0.0-win64.tar.gz" | tar xzf - |
e74abb32 XL |
42 | ciCommandSetEnv RUST_CONFIGURE_ARGS \ |
43 | "${RUST_CONFIGURE_ARGS} --set llvm.clang-cl=$(pwd)/clang-rust/bin/clang-cl.exe" | |
44 | fi |