forked from banach-space/llvm-tutor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_ubuntu
54 lines (49 loc) · 1.77 KB
/
Dockerfile_ubuntu
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
48
49
50
51
52
53
54
# =============================================================================
# An Ubuntu docker file for llvm-tutor that builds LLVM from sources. Clones
# and builds llvm-tutor, runs all tests. It uses the precompiled LLVM packages
# from Ubuntu.
#
# USAGE:
# ```bash
# wget https://raw.githubusercontent.com/banach-space/llvm-tutor/main/Dockerfile_ubuntu
# docker build -t=llvm-tutor:llvm-15 .
# docker run --rm -it --hostname=llvm-tutor llvm-tutor:llvm-15 /bin/bash
# ```
# =============================================================================
FROM debian:buster
# 1. INSTALL DEPENDENCIES
RUN apt-get update && apt-get install -y \
git \
cmake \
ninja-build \
build-essential \
python3-minimal python3-pip\
&& rm -rf /var/lib/apt/lists/*
# 2. INSTALL LIT
RUN pip3 install lit
# 2. BUILD LLVM + Clang from sources
# Note that LIT tests depend on 'not' and 'FileCheck', LLVM utilities. For this
# reason, we need to add `-DLLVM_INSTALL_UTILS=ON` CMake flag when building
# LLVM.
ENV LLVM_DIR /opt/llvm
RUN git clone --branch release/15.x --depth 1 https://github.com/llvm/llvm-project \
&& mkdir -p $LLVM_DIR \
&& mkdir -p llvm-project/build \
&& cd llvm-project/build \
&& cmake -G Ninja \
-DLLVM_ENABLE_PROJECTS=clang \
-DLLVM_TARGETS_TO_BUILD=host \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=$LLVM_DIR \
-DLLVM_INSTALL_UTILS=ON \
../llvm \
&& cmake --build . --target install \
&& rm -r /llvm-project
# 5. BUILD AND RUN LLVM-TUTOR
ENV TUTOR_DIR /llvm-tutor
RUN git clone https://github.com/banach-space/llvm-tutor $TUTOR_DIR \
&& mkdir -p $TUTOR_DIR/build \
&& cd $TUTOR_DIR/build \
&& cmake -DLT_LLVM_INSTALL_DIR=$LLVM_DIR ../ \
&& make -j $(nproc --all) \
&& lit test/