~fincham/static-binary-zoo

eb517b93955097440c8bbe6b8d263c4b0d97e27f — Michael Fincham 7 months ago 2d778bd + bfa622b
Merge
4 files changed, 36 insertions(+), 0 deletions(-)

M Dockerfile.openssl-1.1.1k
A Dockerfile.stunnel-5.64
M Makefile
M README.md
M Dockerfile.openssl-1.1.1k => Dockerfile.openssl-1.1.1k +1 -0
@@ 14,6 14,7 @@ LDFLAGS="-L/output/lib" \
-static \
no-shared no-engine no-idea no-mdc2 no-rc5 no-zlib no-ssl3 no-capieng \
--prefix=/output \
$(if echo "$MUSL_TARGET" | grep i386 >/dev/null; then printf -- '-latomic'; fi) \
$(if echo "$MUSL_TARGET" | grep 64 >/dev/null; then echo linux-generic64; else echo linux-generic32; fi) && \
make -j$(nproc) && \
make install_sw && \

A Dockerfile.stunnel-5.64 => Dockerfile.stunnel-5.64 +26 -0
@@ 0,0 1,26 @@
ARG MUSL_TARGET=x86_64-linux-musl
FROM openssl-1.1.1k-${MUSL_TARGET} AS openssl
FROM musl-cross-make-${MUSL_TARGET}
ARG MUSL_TARGET

COPY --from=openssl /output /output

WORKDIR /build
RUN download https://www.stunnel.org/downloads/stunnel-5.64.tar.gz source.tar.gz eebe53ed116ba43b2e786762b0c2b91511e7b74857ad4765824e7199e6faf883 && tar xf source.tar.gz
RUN export PATH=/build/cross/bin:$PATH:/output/bin && \
cd stunnel-* && \
export CC="$MUSL_TARGET-gcc" && \
export CFLAGS="-static -I/output/include -frandom-seed=pulse" && \
export LDFLAGS="--static -L/output/lib $(if echo "$MUSL_TARGET" | grep i386 >/dev/null; then printf -- '-l:libatomic.a'; fi)" && \
./configure \
--disable-shared \
--disable-fips \
--with-threads=fork \
--enable-static \
--prefix=/output \
--host=$($MUSL_TARGET-gcc -dumpmachine) && \
make -j$(nproc) && \
make install && \
${MUSL_TARGET}-strip /output/bin/stunnel

CMD bash

M Makefile => Makefile +8 -0
@@ 113,6 113,14 @@ openssh-8.8p1: openssl-1.1.1k zlib-1.2.11
	$(GRABBY_HANDS) /output/bin/sftp /grabby/sftp-8.8p1
	$(GRABBY_HANDS) /output/bin/ssh-keygen /grabby/ssh-keygen-8.8p1

parted-3.4: e2fsprogs-1.46.5 readline-8.1
	$(DOCKER_BUILD)
	$(GRABBY_HANDS) /output/sbin/parted /grabby/parted-3.4

stunnel-5.64: openssl-1.1.1k
	$(DOCKER_BUILD)
	$(GRABBY_HANDS) /output/bin/stunnel /grabby/$@

## Slightly crusty tools

# By default just build the basic 'git' binary. If you want "everything" then set GIT_FULL as an environment variable. The 'git-versionnumber' binary will need to be renamed to just 'git' to work.

M README.md => README.md +1 -0
@@ 35,6 35,7 @@ These are the tools that build cleanly without too many caveats and are generall
* `parted-3.4`
* `socat-1.7.4.1`
* `strace-6.1`
* `stunnel-5.64`
* `tcpdump-4.99.1`

### Experimental tools