feat: add more static musl tools
busybox static musl build / build-and-release (push) Failing after 31s
doggo static musl build / build-and-release (push) Successful in 19s
gdu static musl build / build-and-release (push) Successful in 37s
iperf3 static musl build / build-and-release (push) Successful in 20s
speedtest-go static musl build / build-and-release (push) Successful in 32s
busybox static musl build / build-and-release (push) Failing after 31s
doggo static musl build / build-and-release (push) Successful in 19s
gdu static musl build / build-and-release (push) Successful in 37s
iperf3 static musl build / build-and-release (push) Successful in 20s
speedtest-go static musl build / build-and-release (push) Successful in 32s
This commit is contained in:
Executable
+60
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
VERSION="${1:?usage: build_busybox.sh <version> [output_dir]}"
|
||||
OUTPUT_DIR="${2:-$PWD/dist}"
|
||||
PREFIX_NAME="busybox-${VERSION}-linux-amd64-musl-static"
|
||||
|
||||
mkdir -p "$OUTPUT_DIR"
|
||||
|
||||
apk add --no-cache build-base bzip2 curl file tar xz
|
||||
|
||||
SRCDIR="${TMPDIR:-/tmp}/busybox-src-${VERSION}"
|
||||
rm -rf "$SRCDIR"
|
||||
mkdir -p "$SRCDIR"
|
||||
|
||||
curl -fsSL "https://busybox.net/downloads/busybox-${VERSION}.tar.bz2" | tar -xj -C "$SRCDIR" --strip-components=1
|
||||
|
||||
cd "$SRCDIR"
|
||||
make defconfig >/dev/null
|
||||
|
||||
set_kconfig() {
|
||||
key="$1"
|
||||
value="$2"
|
||||
if grep -q "^${key}=" .config; then
|
||||
sed -i "s#^${key}=.*#${key}=${value}#" .config
|
||||
elif grep -q "^# ${key} is not set$" .config; then
|
||||
sed -i "s|^# ${key} is not set$|${key}=${value}|" .config
|
||||
else
|
||||
echo "${key}=${value}" >> .config
|
||||
fi
|
||||
}
|
||||
|
||||
set_kconfig CONFIG_STATIC y
|
||||
set_kconfig CONFIG_FEATURE_SEAMLESS_XZ y
|
||||
set_kconfig CONFIG_FEATURE_SEAMLESS_BZ2 y
|
||||
set_kconfig CONFIG_UNXZ y
|
||||
set_kconfig CONFIG_XZ y
|
||||
set_kconfig CONFIG_BZIP2 y
|
||||
set_kconfig CONFIG_UNZIP y
|
||||
|
||||
yes '' | make oldconfig >/dev/null
|
||||
make -j"$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 2)" busybox
|
||||
cp busybox "$OUTPUT_DIR/$PREFIX_NAME"
|
||||
strip "$OUTPUT_DIR/$PREFIX_NAME" 2>/dev/null || true
|
||||
|
||||
(
|
||||
cd "$OUTPUT_DIR"
|
||||
tar -czf "${PREFIX_NAME}.tar.gz" "$PREFIX_NAME"
|
||||
sha256sum "$PREFIX_NAME" "${PREFIX_NAME}.tar.gz" > "${PREFIX_NAME}.sha256"
|
||||
)
|
||||
|
||||
file "$OUTPUT_DIR/$PREFIX_NAME"
|
||||
ldd "$OUTPUT_DIR/$PREFIX_NAME" || true
|
||||
|
||||
if file "$OUTPUT_DIR/$PREFIX_NAME" | grep -qi 'dynamically linked'; then
|
||||
echo "error: output binary is still dynamically linked" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "build OK: $OUTPUT_DIR/$PREFIX_NAME"
|
||||
Reference in New Issue
Block a user