From 7cb126d0830082605b9da571ec0093121db15424 Mon Sep 17 00:00:00 2001 From: "Lance R. Vick" Date: Thu, 20 Jun 2024 23:26:29 -0700 Subject: [PATCH] feat: package opensc --- packages/opensc/Containerfile | 60 +++++++++++++++++++++++++++++++++++ src/packages.mk | 26 +++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 packages/opensc/Containerfile diff --git a/packages/opensc/Containerfile b/packages/opensc/Containerfile new file mode 100644 index 0000000..37003d1 --- /dev/null +++ b/packages/opensc/Containerfile @@ -0,0 +1,60 @@ +FROM scratch as base +ENV VERSION=0.25.1 +ENV SRC_HASH=989e6305900d4f2f56ef84aa0da07c044459b4f8a508957a4cdefce6a1367c7b +ENV SRC_FILE=${VERSION}.tar.gz +ENV SRC_SITE=https://github.com/opensc/opensc/archive/${SRC_FILE} + +FROM base as fetch +ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . + +FROM fetch as build +COPY --from=stagex/busybox . / +COPY --from=stagex/gcc . / +COPY --from=stagex/binutils . / +COPY --from=stagex/make . / +COPY --from=stagex/musl . / +COPY --from=stagex/linux-headers . / +COPY --from=stagex/util-linux . / +COPY --from=stagex/perl . / +COPY --from=stagex/openssl . / +COPY --from=stagex/ncurses . / +COPY --from=stagex/readline . / +COPY --from=stagex/autoconf . / +COPY --from=stagex/gettext . / +COPY --from=stagex/pcsc-lite . / +COPY --from=stagex/automake . / +COPY --from=stagex/libtool . / +COPY --from=stagex/pkgconf . / +COPY --from=stagex/m4 . / +COPY --from=stagex/zlib . / +RUN tar -xf ${SRC_FILE} +WORKDIR OpenSC-${VERSION} +ENV CFLAGS="-U_FORTIFY_SOURCE -Wno-error" +RUN --network=none <<-EOF + set -eux + ./bootstrap + ./configure \ + --prefix=/usr \ + --sysconfdir=/etc \ + --mandir=/usr/share/man \ + --infodir=/usr/share/info \ + --localstatedir=/var \ + --enable-zlib \ + --enable-readline \ + --enable-openssl \ + --enable-pcsc \ + --enable-sm \ + --enable-piv-sm + make -j "$(nproc)" + make -C src/tools +EOF + +FROM build as install +RUN --network=none <<-EOF + set -eux + make DESTDIR=/rootfs install + install -D -m644 etc/opensc.conf /rootfs/etc/opensc.conf +EOF + +FROM stagex/filesystem as package +COPY --from=install /rootfs/. / diff --git a/src/packages.mk b/src/packages.mk index aa371d5..a56cf46 100644 --- a/src/packages.mk +++ b/src/packages.mk @@ -1376,6 +1376,32 @@ out/openpgp-card-tools/index.json: \ out/zlib/index.json $(call build,openpgp-card-tools) +.PHONY: opensc +opensc: out/opensc/index.json +out/opensc/index.json: \ + packages/opensc/Containerfile \ + out/autoconf/index.json \ + out/automake/index.json \ + out/binutils/index.json \ + out/busybox/index.json \ + out/filesystem/index.json \ + out/gcc/index.json \ + out/gettext/index.json \ + out/libtool/index.json \ + out/linux-headers/index.json \ + out/m4/index.json \ + out/make/index.json \ + out/musl/index.json \ + out/ncurses/index.json \ + out/openssl/index.json \ + out/pcsc-lite/index.json \ + out/perl/index.json \ + out/pkgconf/index.json \ + out/readline/index.json \ + out/util-linux/index.json \ + out/zlib/index.json + $(call build,opensc) + .PHONY: openssl openssl: out/openssl/index.json out/openssl/index.json: \