]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh
Don't make clang use gcc's include-fixed
[rust.git] / src / ci / docker / host-x86_64 / dist-x86_64-linux / build-clang.sh
1 #!/usr/bin/env bash
2
3 set -ex
4
5 source shared.sh
6
7 LLVM=llvmorg-9.0.0
8
9 mkdir llvm-project
10 cd llvm-project
11
12 curl -L https://github.com/llvm/llvm-project/archive/$LLVM.tar.gz | \
13   tar xzf - --strip-components=1
14
15 mkdir clang-build
16 cd clang-build
17
18 # For whatever reason the default set of include paths for clang is different
19 # than that of gcc. As a result we need to manually include our sysroot's
20 # include path, /rustroot/include, to clang's default include path.
21 INC="/rustroot/include"
22 INC="$INC:/usr/include"
23
24 hide_output \
25     cmake ../llvm \
26       -DCMAKE_C_COMPILER=/rustroot/bin/gcc \
27       -DCMAKE_CXX_COMPILER=/rustroot/bin/g++ \
28       -DCMAKE_BUILD_TYPE=Release \
29       -DCMAKE_INSTALL_PREFIX=/rustroot \
30       -DLLVM_TARGETS_TO_BUILD=X86 \
31       -DLLVM_ENABLE_PROJECTS="clang;lld" \
32       -DC_INCLUDE_DIRS="$INC"
33
34 hide_output make -j10
35 hide_output make install
36
37 cd ../..
38 rm -rf llvm-project