stagex/packages/cmake/Containerfile
2024-02-13 08:16:03 -08:00

43 lines
1.1 KiB
Docker

FROM scratch as base
ENV VERSION=3.27.8
ENV SRC_HASH=fece24563f697870fbb982ea8bf17482c9d5f855d8c9bf0b82463d76c9e8d0cc
ENV SRC_FILE=cmake-${VERSION}.tar.gz
ENV SRC_SITE=https://cmake.org/files/v3.27/${SRC_FILE}
FROM base as fetch
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
FROM fetch as build
COPY --from=busybox . /
COPY --from=binutils . /
COPY --from=ninja . /
COPY --from=musl . /
COPY --from=make . /
COPY --from=linux-headers . /
COPY --from=gcc . /
COPY --from=zlib . /
COPY --from=openssl . /
RUN tar -xf ${SRC_FILE}
WORKDIR cmake-${VERSION}
# HACK: figure out why gcc package puts these in the wrong path at install time
COPY --from=gcc /usr/lib64/* /usr/lib/
RUN --network=none <<-EOF
set -eux
./bootstrap \
--prefix=/usr \
--mandir=/share/man \
--datadir=/share/cmake \
--docdir=/share/doc/cmake \
--no-system-cppdap \
--no-system-curl \
--no-system-jsoncpp \
--generator=Ninja || cat /cmake-3.27.8/Bootstrap.cmk/cmake_bootstrap.log
ninja
EOF
FROM build as install
RUN --network=none DESTDIR=/rootfs bin/cmake -P cmake_install.cmake
RUN find /rootfs -exec touch -hcd "@0" "{}" +
FROM scratch as package
COPY --from=install /rootfs /