2024-08-08 07:47:42 +00:00
|
|
|
FROM scratch AS base
|
2024-09-23 10:49:22 +00:00
|
|
|
ENV VERSION=18.1.8
|
|
|
|
ENV SRC_HASH=0b58557a6d32ceee97c8d533a59b9212d87e0fc4d2833924eb6c611247db2f2a
|
2024-02-26 01:37:08 +00:00
|
|
|
ENV SRC_FILE=llvm-project-${VERSION}.src.tar.xz
|
|
|
|
ENV SRC_SITE=https://github.com/llvm/llvm-project/releases/download/llvmorg-${VERSION}/${SRC_FILE}
|
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM base AS fetch
|
2024-02-26 01:37:08 +00:00
|
|
|
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
|
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM fetch AS build
|
2024-02-26 01:37:08 +00:00
|
|
|
COPY --from=stagex/busybox . /
|
|
|
|
COPY --from=stagex/binutils . /
|
|
|
|
COPY --from=stagex/cmake . /
|
|
|
|
COPY --from=stagex/ninja . /
|
|
|
|
COPY --from=stagex/musl . /
|
|
|
|
COPY --from=stagex/gcc . /
|
|
|
|
COPY --from=stagex/python . /
|
|
|
|
COPY --from=stagex/py-setuptools . /
|
|
|
|
COPY --from=stagex/openssl . /
|
|
|
|
COPY --from=stagex/gcc . /
|
2024-09-23 10:49:22 +00:00
|
|
|
COPY --from=stagex/clang . /
|
|
|
|
COPY --from=stagex/llvm . /
|
2024-02-26 01:37:08 +00:00
|
|
|
COPY --from=stagex/zlib . /
|
|
|
|
|
|
|
|
RUN tar -xf ${SRC_FILE}
|
2024-08-26 01:18:52 +00:00
|
|
|
WORKDIR /llvm-project-${VERSION}.src
|
2024-09-23 10:49:22 +00:00
|
|
|
RUN <<-EOF
|
|
|
|
set -eux
|
|
|
|
CFLAGS="-O2 -DNDEBUG -g1" \
|
|
|
|
CXXFLAGS="-O2 -DNDEBUG -g1" \
|
|
|
|
CC=clang \
|
|
|
|
CXX=clang++ \
|
|
|
|
cmake \
|
|
|
|
-S lld \
|
|
|
|
-B build \
|
|
|
|
-G Ninja \
|
|
|
|
-Wno-dev \
|
|
|
|
-DCMAKE_BUILD_TYPE=None \
|
|
|
|
-DCMAKE_INSTALL_PREFIX=/usr/ \
|
|
|
|
-DCMAKE_SKIP_INSTALL_RPATH=ON \
|
|
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
|
|
-DLLVM_EXTERNAL_LIT=/usr/lib/llvm18/bin/lit \
|
|
|
|
-DLLVM_INCLUDE_TESTS=OFF \
|
|
|
|
-DLLD_BUILT_STANDALONE=ON \
|
|
|
|
-DCMAKE_EXE_LINKER_FLAGS="-Wl,-z,stack-size=2097152"
|
|
|
|
cmake --build build
|
|
|
|
EOF
|
2024-02-26 01:37:08 +00:00
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM build AS install
|
2024-04-11 20:09:20 +00:00
|
|
|
RUN --network=none DESTDIR="/rootfs" cmake --install build
|
2024-02-26 01:37:08 +00:00
|
|
|
|
2024-08-08 07:47:42 +00:00
|
|
|
FROM stagex/filesystem AS package
|
2024-03-01 18:30:23 +00:00
|
|
|
COPY --from=install /rootfs/. /
|