initial zig support

This commit is contained in:
Lance Vick 2024-01-16 09:49:44 -08:00
parent 6c5b0e0855
commit 06dd1889e5
Signed by: lrvick
GPG Key ID: 8E47A1EC35A1551D
3 changed files with 129 additions and 0 deletions

View File

@ -1,6 +1,7 @@
.PHONY: core
core: \
out/rust.tgz \
out/zig.tgz \
out/go.tgz \
out/python.tgz \
out/perl.tgz \
@ -196,6 +197,22 @@ out/llvm.tgz: \
$(BUILDER) tag $(REGISTRY)/llvm $(REGISTRY)/llvm:16
$(BUILDER) tag $(REGISTRY)/llvm $(REGISTRY)/llvm:16.0.6
out/clang.tgz: \
out/llvm.tgz \
out/binutils.tgz \
out/cmake.tgz \
out/ninja.tgz \
out/busybox.tgz \
out/musl.tgz
$(call build,core,clang)
out/zig.tgz: \
out/llvm.tgz \
out/clang.tgz \
out/gcc.tgz \
out/cmake.tgz
$(call build,core,zig)
out/rust1.54.tgz: \
out/gcc.tgz \
out/bash.tgz \

69
src/core/clang/Dockerfile Normal file
View File

@ -0,0 +1,69 @@
ARG REGISTRY=local
ARG VERSION=16.0.6
FROM ${REGISTRY}/llvm as llvm
FROM ${REGISTRY}/python as python
FROM ${REGISTRY}/gcc as gcc
FROM ${REGISTRY}/binutils as binutils
FROM ${REGISTRY}/musl as musl
FROM ${REGISTRY}/openssl as openssl
FROM ${REGISTRY}/cmake as cmake
FROM ${REGISTRY}/ninja as ninja
FROM ${REGISTRY}/busybox as busybox
FROM ${REGISTRY}/openssl as openssl
FROM busybox as base
ARG VERSION
ENV VERSION=${VERSION}
ENV SRC_SITE=https://github.com/llvm/llvm-project/releases/download
ENV SRC_HASH=1186b6e6eefeadd09912ed73b3729e85b59f043724bb2818a95a2ec024571840
COPY --from=binutils . /
COPY --from=cmake . /
COPY --from=python . /
COPY --from=ninja . /
COPY --from=musl . /
COPY --from=llvm . /
COPY --from=gcc . /
COPY --from=openssl . /
FROM base as fetch
RUN wget --no-check-certificate ${SRC_SITE}/llvmorg-${VERSION}/clang-${VERSION}.src.tar.xz
RUN echo "${SRC_HASH} clang-${VERSION}.src.tar.xz" | sha256sum -c
FROM fetch as build
RUN tar -xf clang-${VERSION}.src.tar.xz
WORKDIR clang-${VERSION}.src
ADD . .
RUN set -eux; \
cmake \
-B build \
-G Ninja \
-Wno-dev \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=/usr/ \
-DCMAKE_INSTALL_RPATH=/usr/ \
-DLLVM_DEFAULT_TARGET_TRIPLE="x86_64-linux-musl" \
-DLLVM_HOST_TRIPLE="x86_64-linux-musl" \
-DLLVM_EXTERNAL_LIT="/usr/bin/lit" \
-DCMAKE_VERBOSE_MAKEFILE=OFF \
-DCLANG_BUILD_EXAMPLES=OFF \
-DCLANG_INCLUDE_DOCS=ON \
-DCLANG_INCLUDE_TESTS=ON \
-DCLANG_PLUGIN_SUPPORT=ON \
-DLIBCLANG_BUILD_STATIC=ON \
-DLLVM_ENABLE_EH=ON \
-DLLVM_ENABLE_RTTI=ON; \
ninja clang-tlbgen; \
ninja
FROM build as install
USER 0:0
RUN DESTDIR="/rootfs" ninja install
COPY --from=musl /lib/* /rootfs/lib/
RUN find /rootfs -exec touch -hcd "@0" "{}" +
FROM scratch as package
COPY --from=install /rootfs /
USER 100:100
ENTRYPOINT ["/usr/bin/clang"]
CMD ["--version"]

43
src/core/zig/Dockerfile Normal file
View File

@ -0,0 +1,43 @@
ARG REGISTRY=local
FROM ${REGISTRY}/llvm:latest as llvm
FROM ${REGISTRY}/cmake:latest as cmake
FROM ${REGISTRY}/clang:latest as clang
FROM ${REGISTRY}/ninja:latest as ninja
FROM busybox as base
ENV SRC_SITE=https://ziglang.org/download
ENV SRC_VERSION=0.11.0
ENV SRC_HASH=72014e700e50c0d3528cef3adf80b76b26ab27730133e8202716a187a799e951
COPY --from=llvm . /
COPY --from=cmake . /
COPY --from=ninja . /
COPY --from=clang . /
FROM base as fetch
RUN wget --no-check-certificate ${SRC_SITE}/${SRC_VERSION}/zig-${SRC_VERSION}.tar.xz
RUN echo "${SRC_HASH} zig-${SRC_VERSION}.tar.xz" | sha256sum -c
FROM fetch as build
RUN tar -xf zig-${SRC_VERSION}.tar.xz
WORKDIR zig-${SRC_VERSION}
RUN set -eux; \
cmake -B build \
-G Ninja \
-DCMAKE_INSTALL_PREFIX=/usr \
-DZIG_SHARED_LLVM=ON \
-DZIG_TARGET_MCPU=baseline \
.; \
cmake --build build
FROM build as install
USER 0:0
ENV DESTDIR=/rootfs
RUN cmake --install build
COPY --from=llvm . /rootfs/
RUN find /rootfs -exec touch -hcd "@0" "{}" +
FROM scratch as package
COPY --from=install /rootfs /
USER 100:100
ENTRYPOINT ["/usr/bin/zig"]
CMD ["--version"]