From 5c61f065cec9d5d71e309b752808b6c9e0f613db Mon Sep 17 00:00:00 2001 From: Anton Livaja Date: Sun, 11 Feb 2024 21:47:17 -0500 Subject: [PATCH 1/2] feat: add gpg and its dependencies --- src/libs/libassuan/Containerfile | 49 ++++++++++++++++++++ src/libs/libgcrypt/Containerfile | 48 ++++++++++++++++++++ src/libs/libgpg-error/Containerfile | 48 ++++++++++++++++++++ src/libs/libksba/Containerfile | 52 +++++++++++++++++++++ src/libs/npth/Containerfile | 49 ++++++++++++++++++++ src/packages.mk | 70 +++++++++++++++++++++++++++++ src/tools/gpg/Containerfile | 60 +++++++++++++++++++++++++ 7 files changed, 376 insertions(+) create mode 100644 src/libs/libassuan/Containerfile create mode 100644 src/libs/libgcrypt/Containerfile create mode 100644 src/libs/libgpg-error/Containerfile create mode 100644 src/libs/libksba/Containerfile create mode 100644 src/libs/npth/Containerfile create mode 100644 src/tools/gpg/Containerfile diff --git a/src/libs/libassuan/Containerfile b/src/libs/libassuan/Containerfile new file mode 100644 index 0000000..4232ef5 --- /dev/null +++ b/src/libs/libassuan/Containerfile @@ -0,0 +1,49 @@ + +FROM scratch as base +ENV SRC_VERSION=2.5.6 +ENV SRC_HASH=e9fd27218d5394904e4e39788f9b1742711c3e6b41689a31aa3380bd5aa4f426 +ENV SRC_FILE=libassuan-${SRC_VERSION}.tar.bz2 +ENV SRC_SITE=https://gnupg.org/ftp/gcrypt/libassuan/${SRC_FILE} + +FROM base as fetch +ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE} + +FROM fetch as build +COPY --from=busybox . / +COPY --from=musl . / +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=libgpg-error . / +RUN tar -xvf $SRC_FILE +WORKDIR libassuan-${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 \ + make +EOF + +FROM build as install +RUN make DESTDIR=/rootfs install + +FROM base as test +COPY --from=install /rootfs / +COPY --from=busybox . / +RUN /bin/sh <<-EOF + set -eux + EXPECTED_LIBASSUAN_VERSION="${SRC_VERSION}" + LIBASSUAN_FILES_FOUND=\$(ls /usr/lib/ | grep libassuan || true) + if [ -z "\$LIBASSUAN_FILES_FOUND" ]; then + echo "libassuan not found" + exit 1 + fi +EOF + +FROM scratch as package +COPY --from=install /rootfs / \ No newline at end of file diff --git a/src/libs/libgcrypt/Containerfile b/src/libs/libgcrypt/Containerfile new file mode 100644 index 0000000..20014fd --- /dev/null +++ b/src/libs/libgcrypt/Containerfile @@ -0,0 +1,48 @@ +FROM scratch as base +ENV SRC_VERSION=1.10.3 +ENV SRC_HASH=8b0870897ac5ac67ded568dcfadf45969cfa8a6beb0fd60af2a9eadc2a3272aa +ENV SRC_FILE=libgcrypt-${SRC_VERSION}.tar.bz2 +ENV SRC_SITE=https://gnupg.org/ftp/gcrypt/libgcrypt/${SRC_FILE} + +FROM base as fetch +ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE} + +FROM fetch as build +COPY --from=busybox . / +COPY --from=musl . / +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=libgpg-error . / +RUN tar -xvf $SRC_FILE +WORKDIR libgcrypt-${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 \ + make +EOF + +FROM build as install +RUN make DESTDIR=/rootfs install + +FROM base as test +COPY --from=install /rootfs / +COPY --from=busybox . / +RUN /bin/sh <<-EOF + set -eux + EXPECTED_LIBGCRYPT_VERSION="${SRC_VERSION}" + LIBGCRYPT_FILES_FOUND=\$(ls /usr/lib/ | grep libgcrypt || true) + if [ -z "\$LIBGCRYPT_FILES_FOUND" ]; then + echo "libgcrypt not found" + exit 1 + fi +EOF + +FROM scratch as package +COPY --from=install /rootfs / \ No newline at end of file diff --git a/src/libs/libgpg-error/Containerfile b/src/libs/libgpg-error/Containerfile new file mode 100644 index 0000000..b683464 --- /dev/null +++ b/src/libs/libgpg-error/Containerfile @@ -0,0 +1,48 @@ +FROM scratch as base +ENV SRC_VERSION=1.47 +ENV SRC_HASH=9e3c670966b96ecc746c28c2c419541e3bcb787d1a73930f5e5f5e1bcbbb9bdb +ENV SRC_FILE=libgpg-error-${SRC_VERSION}.tar.bz2 +ENV SRC_SITE=https://gnupg.org/ftp/gcrypt/libgpg-error/${SRC_FILE} + +FROM base as fetch +ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE} + +FROM fetch as build +COPY --from=busybox . / +COPY --from=musl . / +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=npth . / +RUN tar -xvf $SRC_FILE +WORKDIR libgpg-error-${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 \ + make +EOF + +FROM build as install +RUN make DESTDIR=/rootfs install + +FROM base as test +COPY --from=install /rootfs / +COPY --from=busybox . / +RUN /bin/sh <<-EOF + set -eux + EXPECTED_LIBGPG_ERROR_VERSION="${SRC_VERSION}" + LIBGPG_ERROR_FILES_FOUND=\$(ls /usr/lib/ | grep libgpg-error || true) + if [ -z "\$LIBGPG_ERROR_FILES_FOUND" ]; then + echo "libgpg-error not found" + exit 1 + fi +EOF + +FROM scratch as package +COPY --from=install /rootfs / \ No newline at end of file diff --git a/src/libs/libksba/Containerfile b/src/libs/libksba/Containerfile new file mode 100644 index 0000000..c4c60f3 --- /dev/null +++ b/src/libs/libksba/Containerfile @@ -0,0 +1,52 @@ +FROM scratch as base +ENV SRC_VERSION=1.6.5 +ENV SRC_HASH=a564628c574c99287998753f98d750babd91a4e9db451f46ad140466ef2a6d16 +ENV SRC_FILE=libksba-${SRC_VERSION}.tar.bz2 +ENV SRC_SITE=https://gnupg.org/ftp/gcrypt/libksba/${SRC_FILE} + +FROM base as fetch +ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE} + +FROM fetch as build +COPY --from=busybox . / +COPY --from=musl . / +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=npth . / +COPY --from=libgpg-error . / +RUN tar -xvf $SRC_FILE +WORKDIR libksba-${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 \ + 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 ls /usr/lib +RUN /bin/sh <<-EOF + set -eux + EXPECTED_LIBKSBA_VERSION="${SRC_VERSION}" + LIBKSBA_FILES_FOUND=\$(ls /usr/lib/ | grep libksba || true) + if [ -z "\$LIBKSBA_FILES_FOUND" ]; then + echo "libksba not found" + exit 1 + fi +EOF + +FROM scratch as package +COPY --from=install /rootfs / \ No newline at end of file diff --git a/src/libs/npth/Containerfile b/src/libs/npth/Containerfile new file mode 100644 index 0000000..a123b0e --- /dev/null +++ b/src/libs/npth/Containerfile @@ -0,0 +1,49 @@ +FROM scratch as base +ENV SRC_VERSION=1.6 +ENV SRC_HASH=1393abd9adcf0762d34798dc34fdcf4d0d22a8410721e76f1e3afcd1daa4e2d1 +ENV SRC_FILE=npth-${SRC_VERSION}.tar.bz2 +ENV SRC_SITE=https://gnupg.org/ftp/gcrypt/npth/${SRC_FILE} + +FROM base as fetch +ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE} + +FROM fetch as build +COPY --from=busybox . / +COPY --from=musl . / +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +RUN tar -xvf $SRC_FILE +WORKDIR npth-${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 \ + 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_NPTH_VERSION="${SRC_VERSION}" + NPTH_VERSION=\$(npth-config --version) + if [ "\$NPTH_VERSION" != "\$EXPECTED_NPTH_VERSION" ]; then + echo "Expected npth version is \$EXPECTED_NPTH_VERSION, but got \$NPTH_VERSION" + exit 1 + fi +EOF + +FROM scratch as package +COPY --from=install /rootfs / \ No newline at end of file diff --git a/src/packages.mk b/src/packages.mk index 5866095..98baed0 100644 --- a/src/packages.mk +++ b/src/packages.mk @@ -202,6 +202,65 @@ out/go/index.json: \ out/musl/index.json $(call build,core,go) +.PHONY: gpg +gpg: out/gpg/index.json +out/gpg/index.json: \ + src/tools/gpg/Containerfile \ + out/bash/index.json \ + out/binutils/index.json \ + out/busybox/index.json \ + out/gcc/index.json \ + out/musl/index.json + $(call build,tools,gpg) + +.PHONY: libassuan +libassuan: out/libassuan/index.json +out/libassuan/index.json: \ + src/libs/libassuan/Containerfile \ + out/binutils/index.json \ + out/busybox/index.json \ + out/gcc/index.json \ + out/m4/index.json \ + out/make/index.json \ + out/musl/index.json + $(call build,libs,libassuan) + +.PHONY: libgcrypt +libgcrypt: out/libgcrypt/index.json +out/libgcrypt/index.json: \ + src/libs/libgcrypt/Containerfile \ + out/binutils/index.json \ + out/busybox/index.json \ + out/gcc/index.json \ + out/m4/index.json \ + out/make/index.json \ + out/musl/index.json + $(call build,libs,libgcrypt) + +.PHONY: libgpg-error +libgpg-error: out/libgpg-error/index.json +out/libgpg-error/index.json: \ + src/libs/libgpg-error/Containerfile \ + out/binutils/index.json \ + out/busybox/index.json \ + out/gcc/index.json \ + out/m4/index.json \ + out/make/index.json \ + out/musl/index.json + $(call build,libs,libgpg-error) + +.PHONY: libksba +libksba: out/libksba/index.json +out/libksba/index.json: \ + src/libs/libksba/Containerfile \ + out/binutils/index.json \ + out/busybox/index.json \ + out/gcc/index.json \ + out/m4/index.json \ + out/make/index.json \ + out/musl/index.json + $(call build,libs,libksba) + .PHONY: libtool libtool: out/libtool/index.json out/libtool/index.json: \ @@ -350,6 +409,17 @@ out/ninja/index.json: \ out/python/index.json $(call build,core,ninja) +.PHONY: npth +npth: out/npth/index.json +out/npth/index.json: \ + src/libs/npth/Containerfile \ + out/binutils/index.json \ + out/busybox/index.json \ + out/gcc/index.json \ + out/make/index.json \ + out/musl/index.json + $(call build,libs,npth) + .PHONY: openssl openssl: out/openssl/index.json out/openssl/index.json: \ diff --git a/src/tools/gpg/Containerfile b/src/tools/gpg/Containerfile new file mode 100644 index 0000000..5ea612c --- /dev/null +++ b/src/tools/gpg/Containerfile @@ -0,0 +1,60 @@ +FROM scratch as base +ENV SRC_VERSION=2.4.4 +ENV SRC_HASH=67ebe016ca90fa7688ce67a387ebd82c6261e95897db7b23df24ff335be85bc6 +ENV SRC_FILE=gnupg-${SRC_VERSION}.tar.bz2 +ENV SRC_SITE=https://gnupg.org/ftp/gcrypt/gnupg/${SRC_FILE} + +FROM base as fetch +ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE} + +FROM fetch as build +COPY --from=busybox . / +COPY --from=musl . / +COPY --from=gcc . / +COPY --from=binutils . / +COPY --from=make . / +COPY --from=npth . / +COPY --from=libksba . / +COPY --from=libgpg-error . / +COPY --from=libassuan . / +COPY --from=libgcrypt . / +RUN tar -xvf $SRC_FILE +WORKDIR gnupg-${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 \ + 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 . / +COPY --from=npth . / +COPY --from=libksba . / +COPY --from=libgpg-error . / +COPY --from=libassuan . / +COPY --from=libgcrypt . / + +RUN /bin/sh <<-EOF + set -eux + EXPECTED_GPG_VERSION="gpg version ${SRC_VERSION}" + GPG_VERSION=\$(gpg --version) + if [ "\$GPG_VERSION" != "\$EXPECTED_GPG_VERSION" ]; then + echo "Expected gpg version is \$EXPECTED_GPG_VERSION, but got \$GPG_VERSION" + exit 1 + fi +EOF + +FROM scratch as package +COPY --from=install /rootfs / \ No newline at end of file From b102142c8b7574b0feadb91ce942a068e47459be Mon Sep 17 00:00:00 2001 From: Anton Livaja Date: Sun, 11 Feb 2024 21:47:30 -0500 Subject: [PATCH 2/2] chore: remove unnecessary version print --- src/core/xorriso/Containerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/src/core/xorriso/Containerfile b/src/core/xorriso/Containerfile index 225c3f1..be63b64 100644 --- a/src/core/xorriso/Containerfile +++ b/src/core/xorriso/Containerfile @@ -31,7 +31,6 @@ FROM base as test COPY --from=install /rootfs / COPY --from=musl . / COPY --from=busybox . / -RUN xorriso --version RUN /bin/sh <<-EOF set -eux XORRISO_VERSION=$(xorriso --version | grep 'xorriso version' | sed -E 's/^.*: +([^ ]+).*$/\1/')