From 3dae2e09edb2d1ee3046520d569e38eb8db69b2e Mon Sep 17 00:00:00 2001 From: Anton Livaja Date: Sun, 11 Feb 2024 01:08:00 -0500 Subject: [PATCH] add git --- src/packages.mk | 11 +++++++ src/tools/git/Containerfile | 57 +++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 src/tools/git/Containerfile diff --git a/src/packages.mk b/src/packages.mk index e1f6af7..bb0ad76 100644 --- a/src/packages.mk +++ b/src/packages.mk @@ -194,6 +194,17 @@ out/gettext/index.json: \ out/libxml2/index.json $(call build,core,gettext) +PHONY: git +git: out/git/index.json +out/git/index.json: \ + src/tools/git/Containerfile \ + binutils \ + busybox \ + gcc \ + make \ + musl + $(call build,tools,git) + .PHONY: go go: out/go/index.json out/go/index.json: \ diff --git a/src/tools/git/Containerfile b/src/tools/git/Containerfile new file mode 100644 index 0000000..b171c43 --- /dev/null +++ b/src/tools/git/Containerfile @@ -0,0 +1,57 @@ +FROM scratch as base +ENV SRC_VERSION=2.9.5 +ENV SRC_HASH=a4bea37ecb9a3fb5c0c8ef18c2f7eeaf8ccbcfec91f72f3bccfc6bf72a3e3902 +ENV SRC_FILE=git-${SRC_VERSION}.tar.xz +ENV SRC_SITE=http://mirrors.edge.kernel.org/pub/software/scm/git/${SRC_FILE} + +FROM base as fetch +ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . + +FROM fetch as build +COPY --from=busybox . / +COPY --from=musl . / +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=zlib . / +COPY --from=perl . / +COPY --from=gettext . / +RUN tar -xvf $SRC_FILE +WORKDIR git-${SRC_VERSION} +RUN --network=none <<-EOF + set -eux + ./configure \ + --build=x86_64-unknown-linux-musl \ + --host=x86_64-unknown-linux-musl \ + --prefix=/usr \ + --bindir=/bin \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --disable-nls \ + --enable-readline \ + --without-curses \ + --without-bash-malloc \ + --without-tcltk + make +EOF + +FROM build as install +RUN make DESTDIR=/rootfs install + +FROM base as test +COPY --from=install /rootfs / +COPY --from=zlib . / +COPY --from=musl . / +COPY --from=busybox . / +RUN /bin/sh <<-EOF + set -eux + EXPECTED_GIT_VERSION="git version ${SRC_VERSION}" + GIT_VERSION=\$(git --version) + if [ "\$GIT_VERSION" != "\$EXPECTED_GIT_VERSION" ]; then + echo "Expected git version is \$EXPECTED_GIT_VERSION, but got \$GIT_VERSION" + exit 1 + fi +EOF + +FROM scratch as package +COPY --from=install /rootfs /