39 lines
983 B
Docker
39 lines
983 B
Docker
FROM scratch as base
|
|
ENV VERSION=1.9.0
|
|
ENV SRC_HASH=5d7ec75828f8d3fd1a0c2f31b5b0cea780cdfe1031359228c428c1a48bfcd5b9
|
|
ENV SRC_FILE=v${VERSION}.tar.gz
|
|
ENV SRC_SITE=https://github.com/martine/ninja/archive/${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=make . /
|
|
COPY --from=python . /
|
|
COPY --from=musl . /
|
|
COPY --from=gcc . /
|
|
COPY --from=openssl . /
|
|
RUN tar -xf ${SRC_FILE}
|
|
WORKDIR ninja-${VERSION}
|
|
ADD *.patch .
|
|
# 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
|
|
cp -R /usr/lib64/* /usr/lib/
|
|
patch -p1 < fix-musl.patch
|
|
python ./configure.py --bootstrap
|
|
EOF
|
|
|
|
FROM build as install
|
|
RUN <<-EOF
|
|
set -eux
|
|
mkdir -p /rootfs/usr/bin/
|
|
cp ninja /rootfs/usr/bin/
|
|
EOF
|
|
RUN find /rootfs -exec touch -hcd "@0" "{}" +
|
|
|
|
FROM scratch as package
|
|
COPY --from=install /rootfs /
|