FROM scratch AS base ENV VERSION=20240117 ENV SRC_HASH=a5d66e2997945b2541b8f780a7f5a5ec895d53a517ae1dc4f3ab762573edea9a ENV SRC_FILE=${VERSION}.tar.gz ENV SRC_SITE=https://github.com/iputils/iputils/archive/refs/tags/${SRC_FILE} FROM base AS fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . FROM fetch AS build COPY --from=stagex/busybox . / COPY --from=stagex/binutils . / COPY --from=stagex/libcap . / COPY --from=stagex/gcc . / COPY --from=stagex/meson . / COPY --from=stagex/musl . / COPY --from=stagex/python . / COPY --from=stagex/zlib . / COPY --from=stagex/libxslt . / COPY --from=stagex/linux-headers . / COPY --from=stagex/ninja . / RUN tar -xzf ${SRC_FILE} WORKDIR /iputils-${VERSION} RUN --network=none <<-EOF set -eux; ./configure meson env2mfile \ --native \ --system=linux \ --cpu-family=x86_64 \ --cpu=x86_64 \ --endian=little \ -o meson.cross meson setup \ --prefix=/usr \ --libdir=/usr/lib \ --libexecdir=/usr/libexec \ --bindir=/usr/bin \ --sbindir=/usr/sbin \ --includedir=/usr/include \ --datadir=/usr/share \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --localedir=/usr/share/locale \ --sysconfdir=/etc \ --localstatedir=/var \ --sharedstatedir=/var/lib \ --buildtype=plain \ --auto-features=auto \ --wrap-mode=nodownload \ --default-library=both \ --cross-file=meson.cross \ -Db_lto=false \ -DNO_SETCAP_OR_SUID=true \ -DBUILD_MANS=false \ -DUSE_IDN=false \ -DUSE_GETTEXT=false \ . output meson compile -C output EOF FROM build AS install RUN --network=none DESTDIR=/rootfs meson install --no-rebuild -C output FROM base AS test COPY --from=install /rootfs / COPY --from=stagex/binutils . / COPY --from=stagex/meson . / COPY --from=stagex/musl . / COPY --from=stagex/gcc . / RUN <<-EOF set -eux ARPING_VERSION=$(arping -V) CLOCKDIFF_VERSION=$(clockdiff -V) PING_VERSION=$(ping -V) TRACEPATH_VERSION=$(tracepath -V) if [ "${ARPING_VERION}" != "arping from iputils ${VERSION}"]; then echo "Expected arping version ${VERSION} but got ${ARPING_VERSION}" exit 1 fi if [ "${CLOCKDIFF_VERION}" != "arping from iputils ${VERSION}"]; then echo "Expected arping version ${VERSION} but got ${CLOCKDIFF_VERSION}" exit 1 fi if [ "${PING_VERION}" != "arping from iputils ${VERSION}"]; then echo "Expected arping version ${VERSION} but got ${PING_VERSION}" exit 1 fi if [ "${TRACEPATH_VERION}" != "arping from iputils ${VERSION}"]; then echo "Expected arping version ${VERSION} but got ${TRACEPATH_VERSION}" exit 1 fi EOF FROM stagex/filesystem AS package COPY --from=install /rootfs /