|
| 1 | +FROM centos:7 |
| 2 | +ARG llvm_dir=llvm-project |
| 3 | +# Add the cache artifacts and the LLVM source tree to the container |
| 4 | +ADD sccache /sccache |
| 5 | +ADD "${llvm_dir}" /source/llvm-project |
| 6 | +ENV SCCACHE_DIR="/sccache" |
| 7 | +ENV SCCACHE_CACHE_SIZE="2G" |
| 8 | + |
| 9 | +RUN echo -e "[llvmtoolset-build]\nname=LLVM Toolset 13.0 - Build\nbaseurl=https://buildlogs.centos.org/c7-llvm-toolset-13.0.x86_64/\ngpgcheck=0\nenabled=1" > /etc/yum.repos.d/llvmtoolset-build.repo |
| 10 | + |
| 11 | +# Note: This is required patch since CentOS have reached EOL |
| 12 | +# otherwise any yum install setp will fail |
| 13 | +RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo |
| 14 | +RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo |
| 15 | +RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo |
| 16 | + |
| 17 | +# Install build dependencies |
| 18 | +RUN yum install --assumeyes centos-release-scl |
| 19 | + |
| 20 | +# The definition of insanity is doing the same thing and expecting a different result |
| 21 | +RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo |
| 22 | +RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo |
| 23 | +RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo |
| 24 | + |
| 25 | +RUN yum install --assumeyes --nogpgcheck llvm-toolset-13.0 |
| 26 | +RUN yum install --assumeyes rh-python38-python-devel rh-python38-python-pip |
| 27 | +SHELL [ "/usr/bin/scl", "enable", "llvm-toolset-13.0", "rh-python38" ] |
| 28 | + |
| 29 | +RUN python3 -m pip install --upgrade pip |
| 30 | +RUN python3 -m pip install --upgrade cmake ninja sccache |
| 31 | + |
| 32 | +# Install MLIR's Python Dependencies |
| 33 | +RUN python3 -m pip install -r /source/llvm-project/mlir/python/requirements.txt |
| 34 | + |
| 35 | +# Configure, Build, Test, and Install LLVM |
| 36 | +RUN cmake -GNinja -Bbuild \ |
| 37 | + -DCMAKE_BUILD_TYPE=Release \ |
| 38 | + -DCMAKE_C_COMPILER=clang \ |
| 39 | + -DCMAKE_CXX_COMPILER=clang++ \ |
| 40 | + -DCMAKE_ASM_COMPILER=clang \ |
| 41 | + -DCMAKE_C_COMPILER_LAUNCHER=sccache \ |
| 42 | + -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ |
| 43 | + -DCMAKE_CXX_FLAGS="-Wno-everything" \ |
| 44 | + -DCMAKE_LINKER=lld \ |
| 45 | + -DCMAKE_INSTALL_PREFIX="/install" \ |
| 46 | + -DLLVM_BUILD_UTILS=ON \ |
| 47 | + -DLLVM_BUILD_TOOLS=ON \ |
| 48 | + -DLLVM_ENABLE_ASSERTIONS=ON \ |
| 49 | + -DMLIR_ENABLE_BINDINGS_PYTHON=ON \ |
| 50 | + -DLLVM_ENABLE_PROJECTS=mlir \ |
| 51 | + -DLLVM_ENABLE_TERMINFO=OFF \ |
| 52 | + -DLLVM_INSTALL_UTILS=ON \ |
| 53 | + -DLLVM_TARGETS_TO_BUILD="host;NVPTX;AMDGPU" \ |
| 54 | + /source/llvm-project/llvm |
| 55 | + |
| 56 | +RUN ninja -C build install |
0 commit comments