summaryrefslogtreecommitdiffstats
path: root/src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh')
-rwxr-xr-xsrc/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh46
1 files changed, 46 insertions, 0 deletions
diff --git a/src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh
new file mode 100755
index 000000000..1025f5bce
--- /dev/null
+++ b/src/ci/docker/host-x86_64/dist-x86_64-linux/build-clang.sh
@@ -0,0 +1,46 @@
+#!/usr/bin/env bash
+
+set -ex
+
+source shared.sh
+
+LLVM=llvmorg-14.0.5
+
+mkdir llvm-project
+cd llvm-project
+
+curl -L https://github.com/llvm/llvm-project/archive/$LLVM.tar.gz | \
+ tar xzf - --strip-components=1
+
+mkdir clang-build
+cd clang-build
+
+# For whatever reason the default set of include paths for clang is different
+# than that of gcc. As a result we need to manually include our sysroot's
+# include path, /rustroot/include, to clang's default include path.
+INC="/rustroot/include:/usr/include"
+
+# We need compiler-rt for the profile runtime (used later to PGO the LLVM build)
+# but sanitizers aren't currently building. Since we don't need those, just
+# disable them.
+hide_output \
+ cmake ../llvm \
+ -DCMAKE_C_COMPILER=/rustroot/bin/gcc \
+ -DCMAKE_CXX_COMPILER=/rustroot/bin/g++ \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_INSTALL_PREFIX=/rustroot \
+ -DCOMPILER_RT_BUILD_SANITIZERS=OFF \
+ -DCOMPILER_RT_BUILD_XRAY=OFF \
+ -DCOMPILER_RT_BUILD_MEMPROF=OFF \
+ -DLLVM_TARGETS_TO_BUILD=X86 \
+ -DLLVM_INCLUDE_BENCHMARKS=OFF \
+ -DLLVM_INCLUDE_TESTS=OFF \
+ -DLLVM_INCLUDE_EXAMPLES=OFF \
+ -DLLVM_ENABLE_PROJECTS="clang;lld;compiler-rt" \
+ -DC_INCLUDE_DIRS="$INC"
+
+hide_output make -j$(nproc)
+hide_output make install
+
+cd ../..
+rm -rf llvm-project