commit 8def0009c6182b7be9ccfd5db06dee3e7e1d1aea
parent ab650de751e1020544ae51b0e941116a56d4d6dd
Author: Szymon Mikulicz <szymon.mikulicz@posteo.net>
Date: Thu, 2 Jul 2026 02:15:01 +0200
Fix compilation without gnu sed
Diffstat:
3 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -4,5 +4,4 @@ busybox
test/
*.inc.h
*.inc.s
-applets.h
stabbish
diff --git a/Makefile b/Makefile
@@ -3,12 +3,13 @@
CFLAGS=-static
BB_VER=1.38.0
CC=$(PWD)/.deps/x86_64-linux-musl-native/bin/gcc
+export PATH:=$(PWD)/.deps/x86_64-linux-musl-native/bin:$(PATH)
stabbish: main.o busybox.inc.o | $(CC)
$(info LD $@)
@$(CC) $(CFLAGS) $^ -o $@
-main.o: main.c applets.h busybox.inc.h | $(CC)
+main.o: main.c busybox.inc.h | $(CC)
$(info CC $@)
@$(CC) $(CFLAGS) -c $< -o $@
@@ -35,13 +36,6 @@ main.o: main.c applets.h busybox.inc.h | $(CC)
@echo '_inc_$<_size:' >>$@
@echo ' .int (. - _inc_$<)' >>$@
-applets.h: busybox
- $(info GEN $@)
- @echo "static const char* busybox_applets[] = {" >$@
- @busybox --list | awk '{print " \""$$1"\","}' >>$@
- @echo " 0" >> $@
- @echo "};" >> $@
-
$(CC):
$(info DWNL $@)
@mkdir -p .deps
@@ -54,13 +48,13 @@ $(CC):
.deps/busybox-$(BB_VER)/.config: .deps/busybox-$(BB_VER)/Config.in $(CC)
$(info MK $@)
- @make -C .deps/busybox-$(BB_VER) defconfig CC=$(CC) HOSTCFLAGS+="-static" HOSTLDFLAGS+="-static" EXTRA_LDFLAGS="-static"
- @sed -i "s/# CONFIG_STATIC is not set/CONFIG_STATIC=y/" $@
- @sed -i "s/# CONFIG_FEATURE_SH_STANDALONE is not set/CONFIG_FEATURE_SH_STANDALONE=y/" $@
+ @make -C .deps/busybox-$(BB_VER) defconfig HOSTCFLAGS+="-static" HOSTLDFLAGS+="-static" EXTRA_LDFLAGS="-static"
+ @sed "s/# CONFIG_STATIC is not set/CONFIG_STATIC=y/" $@ > $@.tmp && mv $@.tmp $@
+ @sed "s/# CONFIG_FEATURE_SH_STANDALONE is not set/CONFIG_FEATURE_SH_STANDALONE=y/" $@ > $@.tmp && mv $@.tmp $@
.deps/busybox-$(BB_VER)/busybox: .deps/busybox-$(BB_VER)/.config $(CC)
$(info MK $@)
- @make -C .deps/busybox-$(BB_VER) CC=$(CC) HOSTCFLAGS+="-static" HOSTLDFLAGS+="-static" EXTRA_LDFLAGS="-static"
+ @make -C .deps/busybox-$(BB_VER) HOSTCFLAGS+="-static" HOSTLDFLAGS+="-static" EXTRA_LDFLAGS="-static"
busybox: .deps/busybox-$(BB_VER)/busybox
$(info LN $@)
@@ -94,7 +88,7 @@ test: test/stabbish_plain test/stabbish_bzip2 test/stabbish_gzip test/stabbish_x
.PHONY:
clean:
- rm -rf *.inc.* applets.h main.o stabbish test
+ rm -rf *.inc.* main.o stabbish test
.PHONY:
cleanall: clean
diff --git a/main.c b/main.c
@@ -9,7 +9,6 @@
#include <sys/mman.h>
#include <unistd.h>
-#include "applets.h"
#include "busybox.inc.h"
#if defined(__LP64__)