~fincham/static-binary-zoo

ref: e79e3898beb4586fb1a60be3f747649c0b38029e static-binary-zoo/Makefile -rw-r--r-- 1.8 KiB
e79e3898 — Michael Fincham Spelling 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
MUSL_TARGET ?= x86_64-linux-musl

DOCKER_BUILD = docker build --build-arg MUSL_TARGET=$(MUSL_TARGET) -f Dockerfile.$@ -t $@-$(MUSL_TARGET) .
GRABBY_HANDS = docker run --rm --mount type=bind,source=$(shell pwd)/output/$(MUSL_TARGET),target=/grabby $@-$(MUSL_TARGET) install -g $(shell id -g) -o $(shell id -u) 

all: socat-1.7.4.1 nmap-7.90 tcpdump-4.99.1 openssl-1.1.1k

check:
	@echo "These binaries are not built properly:"
	@echo $(shell find output/ -type f -exec file {} \; | grep -E -v "statically linked, stripped$$")

musl-cross-make:
	mkdir -p output/$(MUSL_TARGET)
	$(DOCKER_BUILD)

ncurses-6.2: musl-cross-make
	$(DOCKER_BUILD)

readline-8.1: ncurses-6.2
	$(DOCKER_BUILD)

zlib-1.2.11: musl-cross-make
	$(DOCKER_BUILD)

pcre-8.45: musl-cross-make
	$(DOCKER_BUILD)

libxml2-2.9.12: musl-cross-make
	$(DOCKER_BUILD)

libpcap-1.10.1: musl-cross-make
	$(DOCKER_BUILD)

# libfuse >= 3.x uses meson/ninja as a build system so for the time being I am sticking with 2.x
fuse-2.9.9: musl-cross-make
	$(DOCKER_BUILD)

# Don't use this EOL version of OpenSSL for anything important, it's just provided here in case it's needed to e.g. decrypt an old file
openssl-0.9.8zh: zlib-1.2.11
	$(DOCKER_BUILD)
	$(GRABBY_HANDS) /output/bin/openssl /grabby/$@

openssl-1.1.1k: zlib-1.2.11
	$(DOCKER_BUILD)
	$(GRABBY_HANDS) /output/bin/openssl /grabby/$@

socat-1.7.4.1: readline-8.1 openssl-1.1.1k
	$(DOCKER_BUILD)
	$(GRABBY_HANDS) /output/bin/socat /grabby/$@

nmap-7.90: openssl-1.1.1k libpcap-1.10.1
	$(DOCKER_BUILD)
	$(GRABBY_HANDS) /output/bin/nmap /grabby/$@

tcpdump-4.99.1: libpcap-1.10.1
	$(DOCKER_BUILD)
	$(GRABBY_HANDS) /output/bin/tcpdump /grabby/$@

loggedfs-0.9: pcre-8.45 libxml2-2.9.12 fuse-2.9.9
	$(DOCKER_BUILD)
	$(GRABBY_HANDS) /output/bin/loggedfs /grabby/$@

busybox-1.33.1: musl-cross-make
	$(DOCKER_BUILD)
	$(GRABBY_HANDS) /output/bin/busybox /grabby/$@