Merge branch 'lance/swtpm' into staging

This commit is contained in:
Anton Livaja 2024-09-06 10:25:18 -04:00
commit 03ffc3a9ea
No known key found for this signature in database
GPG key ID: 44A86CFF1FDF0E85

43
packages/swtpm Normal file
View file

@ -0,0 +1,43 @@
FROM scratch AS base
ARG ARCH=x86_64
ENV VERSION=0.9.0
ENV SRC_HASH=9679ca171e8aaa3c4e4053e8bc1d10c8dabf0220bd4b16aba78743511c25f731
ENV SRC_FILE=v${VERSION}.tar.gz
ENV SRC_SITE=https://github.com/stefanberger/swtpm/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/binutils . /
COPY --from=stagex/musl . /
COPY --from=stagex/make . /
COPY --from=stagex/gcc . /
COPY --from=stagex/m4 . /
COPY --from=stagex/perl . /
COPY --from=stagex/autoconf . /
COPY --from=stagex/automake . /
COPY --from=stagex/libtool . /
COPY --from=stagex/openssl . /
RUN tar -xf ${SRC_FILE}
WORKDIR /xz-${VERSION}
RUN --network=none <<-EOF
set -ex
NOCONFIGURE=1 ./autogen.sh
./configure \
--build=${ARCH}-linux-musl \
--host=${ARCH}-linux-musl \
--prefix=/usr \
--libdir=/usr/lib \
--with-openssl \
--with-tss-user=root \
--with-tss-group=root
make -j "$(nproc)"
EOF
FROM build AS install
RUN --network=none make DESTDIR="/rootfs" install
FROM stagex/filesystem AS package
COPY --from=install /rootfs/. /