stagex/packages/zig/Containerfile

50 lines
1.4 KiB
Text
Raw Permalink Normal View History

2024-08-08 07:47:42 +00:00
FROM scratch AS base
2024-09-13 06:48:23 +00:00
ENV VERSION=0.13.0
ENV SRC_HASH=06c73596beeccb71cc073805bdb9c0e05764128f16478fa53bf17dfabc1d4318
2024-02-27 23:08:15 +00:00
ENV SRC_FILE=zig-${VERSION}.tar.xz
ENV SRC_SITE=https://ziglang.org/download/${VERSION}/${SRC_FILE}
2024-08-08 07:47:42 +00:00
FROM base AS fetch
2024-02-27 23:08:15 +00:00
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
2024-08-08 07:47:42 +00:00
FROM fetch AS build
2024-02-27 23:08:15 +00:00
COPY --from=stagex/binutils . /
COPY --from=stagex/busybox . /
2024-09-22 03:43:06 +00:00
COPY --from=stagex/clang . /
2024-02-27 23:08:15 +00:00
COPY --from=stagex/cmake . /
COPY --from=stagex/gcc . /
COPY --from=stagex/libzstd . /
COPY --from=stagex/lld . /
2024-09-22 03:43:06 +00:00
COPY --from=stagex/llvm . /
2024-02-27 23:08:15 +00:00
COPY --from=stagex/make . /
COPY --from=stagex/musl . /
COPY --from=stagex/openssl . /
COPY --from=stagex/zlib . /
2024-09-23 10:49:22 +00:00
COPY --from=stagex/ninja . /
2024-02-27 23:08:15 +00:00
RUN --network=none tar -xf ${SRC_FILE}
2024-08-26 01:18:52 +00:00
WORKDIR /zig-${VERSION}
2024-09-23 10:49:22 +00:00
ADD *.patch .
RUN --network=none <<-EOF
set -eux
2024-09-23 10:49:22 +00:00
patch -p1 < fix-pie-support-detection.patch
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/usr \
2024-02-27 23:08:15 +00:00
-DCMAKE_INSTALL_PREFIX=/usr \
2024-09-23 10:49:22 +00:00
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DZIG_PIE=ON \
-DZIG_VERSION="${VERSION}" \
-DZIG_SHARED_LLVM=ON \
-DZIG_USE_LLVM_CONFIG=ON \
-DZIG_TARGET_MCPU=baseline \
-DZIG_TARGET_TRIPLE=native-linux.6.1-musl
2024-02-27 23:08:15 +00:00
cmake --build build
EOF
2024-02-27 23:08:15 +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-27 23:08:15 +00:00
2024-08-08 07:47:42 +00:00
FROM stagex/filesystem AS package
COPY --from=install /rootfs/. /