2023-07-17 00:21:20 -04:00
|
|
|
# global arguments
|
|
|
|
ARG LLVM_SOURCE_URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-16.0.0/llvm-project-16.0.0.src.tar.xz"
|
|
|
|
ARG LLVM_VERSION="16"
|
2023-07-17 00:10:31 -04:00
|
|
|
|
|
|
|
# the base layer.
|
|
|
|
FROM debian:oldstable AS base
|
|
|
|
ENV DEBIAN_FRONTEND="noninteractive"
|
|
|
|
RUN apt-get update
|
|
|
|
|
2023-07-17 00:21:20 -04:00
|
|
|
# base layer for building anything
|
2023-07-17 00:10:31 -04:00
|
|
|
FROM base AS build-base
|
|
|
|
WORKDIR /build
|
|
|
|
ARG BUILD_DEPS="curl ca-certificates build-essential python3 cmake ninja-build pkg-config git zlib1g-dev"
|
|
|
|
RUN apt-get install -y --no-install-recommends $BUILD_DEPS
|
|
|
|
|
2023-07-17 00:21:20 -04:00
|
|
|
# This layer extracts the LLVM source code extracted to /build/llvm
|
2023-07-17 00:10:31 -04:00
|
|
|
FROM build-base as llvm-base
|
2023-07-17 00:21:20 -04:00
|
|
|
ARG LLVM_SOURCE_URL
|
2023-07-17 00:10:31 -04:00
|
|
|
RUN mkdir llvm && \
|
|
|
|
cd llvm && \
|
|
|
|
curl -L $LLVM_SOURCE_URL | tar --strip-components=1 -xJf -
|
|
|
|
|
|
|
|
|
|
|
|
# This will launch the builder script.
|
|
|
|
# /build/llvm-bin is expected to be mounted to a host directory.
|
|
|
|
FROM llvm-base as llvm-build
|
|
|
|
COPY scripts/build_llvm.sh .
|
2023-07-17 00:21:20 -04:00
|
|
|
ARG LLVM_VERSION
|
|
|
|
ENV LLVM_VERSION=$LLVM_VERSION
|
|
|
|
ENTRYPOINT [ "/bin/bash" ]
|
2023-07-17 00:10:31 -04:00
|
|
|
CMD [ "/build/build_llvm.sh" ]
|