]> git.lizzy.rs Git - rust.git/blob - src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh
Fix font color for help button in ayu and dark themes
[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 #
22 # Alsow there's this weird oddity with gcc where there's an 'include-fixed'
23 # directory that it generates. It turns out [1] that Centos 5's headers are so
24 # old that they're incompatible with modern C semantics. While gcc automatically
25 # fixes that clang doesn't account for this. Tell clang to manually include the
26 # fixed headers so we can successfully compile code later on.
27 #
28 # [1]: https://sourceware.org/ml/crossgcc/2008-11/msg00028.html
29 INC="/rustroot/include"
30 INC="$INC:/rustroot/lib/gcc/x86_64-unknown-linux-gnu/5.5.0/include-fixed"
31 INC="$INC:/usr/include"
32
33 hide_output \
34     cmake ../llvm \
35       -DCMAKE_C_COMPILER=/rustroot/bin/gcc \
36       -DCMAKE_CXX_COMPILER=/rustroot/bin/g++ \
37       -DCMAKE_BUILD_TYPE=Release \
38       -DCMAKE_INSTALL_PREFIX=/rustroot \
39       -DLLVM_TARGETS_TO_BUILD=X86 \
40       -DLLVM_ENABLE_PROJECTS="clang;lld" \
41       -DC_INCLUDE_DIRS="$INC"
42
43 hide_output make -j10
44 hide_output make install
45
46 cd ../..
47 rm -rf llvm-project