packages/

opensc

Details
Source
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/. /