-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
46 lines (37 loc) · 1.86 KB
/
Dockerfile
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
ARG UBUNTU_VERSION=22.04
ARG LLVM_URL="https://github.com/llvm/llvm-project"
ARG LLVM_COMMIT="llvmorg-17.0.5"
ARG BUILD_TYPE=Release
ARG PROJECTS="clang;lld"
ARG TARGETS=X86
FROM ubuntu:22.04 AS builder
ARG UBUNTU_VERSION
ARG LLVM_URL
ARG LLVM_COMMIT
ARG BUILD_TYPE
ARG PROJECTS
ARG TARGETS
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -q && apt-get install -y cmake ninja-build build-essential python3 python3-distutils git unzip gcc g++ gcc-multilib \
&& apt-get autoremove -y --purge \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*
RUN git clone $LLVM_URL /tmp/llvm-project && cd /tmp/llvm-project && git checkout $LLVM_COMMIT
RUN mkdir /tmp/llvm-project/build && mkdir /tmp/llvm && cd /tmp/llvm-project/build \
&& cmake -G Ninja ../llvm -Wno-dev \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DLLVM_ENABLE_ASSERTIONS=ON -DCMAKE_INSTALL_PREFIX=/tmp/llvm \
-DCMAKE_C_COMPILER="gcc" -DCMAKE_CXX_COMPILER="g++" -DLLVM_USE_LINKER="gold" -DLLVM_TARGETS_TO_BUILD="$TARGETS" \
-DLLVM_ENABLE_PROJECTS=$PROJECTS -DLLVM_ENABLE_RUNTIMES="compiler-rt;openmp" -DLLVM_USE_SPLIT_DWARF=ON \
-DLLVM_BUILD_TOOLS=OFF -DLLVM_INSTALL_UTILS=OFF -DLLVM_OPTIMIZED_TABLEGEN=ON \
-DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_BENCHMARKS=OFF \
-DCLANG_ENABLE_STATIC_ANALYZER=OFF -DCLANG_ENABLE_ARCMT=OFF \
-DCOMPILER_RT_BUILD_LIBFUZZER=OFF -DCOMPILER_RT_BUILD_PROFILE=OFF \
-DLLVM_PARALLEL_LINK_JOBS=2 -DLLVM_ENABLE_ZLIB=OFF \
&& cmake --build . && cmake --build . --target install
FROM ubuntu:$UBUNTU_VERSION
COPY --from=builder /tmp/llvm/ /usr/local/
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update -q && apt-get install -y cmake ninja-build build-essential python3 python3-distutils git unzip gcc g++ libeigen3-dev libboost-dev \
&& apt-get autoremove -y --purge \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*