commit 2cd94c0

chld  ·  2026-08-30 16:19:24 +0000 UTC
parent 3e36122
toybox: build statically
1 files changed,  +13, -3
+13, -3
 1@@ -5,8 +5,18 @@ RELEASE=1
 2 SOURCE="https://github.com/landley/${NAME}.git"
 3 BUILD_STYLE=gmake
 4 build(){
 5-    gmake CC='cc -static' CFLAGS='-static' LDFLAGS='-static' defconfig || die "defconfig failed"
 6-    gmake CC='cc -static' CFLAGS='-static' LDFLAGS='-static' PREFIX="$PKG" || die "gmake failed"
 7-    gmake CC='cc -static' CFLAGS='-static' LDFLAGS='-static' DESTDIR="$PKG" install || die "install failed"
 8+    echo 'cc -static $@' > ./cc.sh
 9+    chmod 755 ./cc.sh
10+    export CC=`pwd`/cc.sh
11+    export HOSTCC=$CC
12+    
13+    sed -i 's/-o/-static -o/g' scripts/install.sh
14+    sed -i 's/cc/cc -static/g' kconfig/Makefile
15+    sed -i 's#scripts/install.sh#scripts/install.sh --static#g' Makefile
16+    sed -i 's/\$HOSTCC/$HOSTCC -static/g' scripts/make.sh
17+    
18+    gmake CFLAGS='-static' LDFLAGS='-static' defconfig || die "defconfig failed"
19+    gmake CFLAGS='-static' LDFLAGS='-static' PREFIX="$PKG" || die "gmake failed"
20+    gmake CFLAGS='-static' LDFLAGS='-static' DESTDIR="$PKG" install || die "install failed"
21 }
22 . ${0%/*}/../../libsh/libdmake.sh