This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
48 lines (39 loc) · 1.58 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
47
ARG BUILD_TYPE=Release
ARG LLVM_WEDLOCK_INSTALL_DIR=/opt/llvm-wedlock
FROM ubuntu:20.04 as base
FROM base as build
# Must explicitly list all global args within an image definition
ARG BUILD_TYPE
ARG LLVM_WEDLOCK_INSTALL_DIR
ENV DEBIAN_FRONTEND="noninteractive"
RUN apt-get update && \
apt-get -y install clang-10 cmake ninja-build \
python3.8 python3.8-dev python3-pip && \
update-alternatives --install /usr/bin/cc cc /usr/bin/clang-10 100 && \
update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-10 100 && \
update-alternatives --install /usr/bin/clang clang /usr/bin/clang-10 100 && \
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-10 100 && \
rm -rf /var/lib/apt/lists/*
# Build the Wedlock pass
WORKDIR /llvm-wedlock/build
COPY ./ /llvm-wedlock
RUN cmake \
-DCMAKE_INSTALL_PREFIX:PATH=${LLVM_WEDLOCK_INSTALL_DIR} \
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DCLANG_ENABLE_ARCMT=OFF \
-DLLVM_ENABLE_PROJECTS="clang;compiler-rt;lld" \
-DLLVM_ENABLE_ZLIB=OFF \
-DLLVM_ENABLE_TERMINFO=OFF \
-DLLVM_ENABLE_LIBPFM=OFF \
-G "Ninja" \
../llvm && cmake --build . --target install
# Start fresh on our base again
FROM base
ARG LLVM_WEDLOCK_INSTALL_DIR
# Get runtime dependencies of llvm-10
RUN apt-get update && \
apt-get install -y $(apt-cache depends llvm-10 | grep Depends | sed "s/.*ends:\ //" | tr '\n' ' ') && \
rm -rf /var/lib/apt/lists/*
# Copy just our installation directory from build image
COPY --from=build ${LLVM_WEDLOCK_INSTALL_DIR} ${LLVM_WEDLOCK_INSTALL_DIR}