From 819f941bceb40a96cd3b06654782111e1efd6c6c Mon Sep 17 00:00:00 2001 From: "Andrew G. Morgan" Date: Sat, 22 Apr 2023 15:38:29 -0700 Subject: Partially revive fully static binaries. It looks like I broke the kdebug target build when I dropped fully static building of capsh and friends. Discovered this, looking at answering: https://unix.stackexchange.com/questions/741532/launch-process-with-limited-capabilities-on-minimal-busybox-based-system Signed-off-by: Andrew G. Morgan --- kdebug/test-kernel.sh | 4 ++-- progs/Makefile | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/kdebug/test-kernel.sh b/kdebug/test-kernel.sh index 5d480c9..391bb8a 100755 --- a/kdebug/test-kernel.sh +++ b/kdebug/test-kernel.sh @@ -13,8 +13,8 @@ function die { } pushd .. -make all test || die "failed to make all test of libcap tree" -make -C progs tcapsh-static || die "failed to make progs/tcapsh-static" +make LIBCSTATIC=yes all test || die "failed to make all test of libcap tree" +make LIBCSTATIC=yes -C progs tcapsh-static || die "failed to make progs/tcapsh-static" make -C tests uns_test popd diff --git a/progs/Makefile b/progs/Makefile index 826834c..80f890a 100644 --- a/progs/Makefile +++ b/progs/Makefile @@ -14,6 +14,10 @@ ifeq ($(DYNAMIC),yes) LDPATH = LD_LIBRARY_PATH=../libcap DEPS = ../libcap/libcap.so else +ifeq ($(LIBCSTATIC),yes) +LDFLAGS = --static +DEPS = ../libcap/libcap.a +else # For this build variant override the LDFLAGS to link statically from # libraries within the build tree. If you never want this, use make # DYNAMIC=yes . Note, we can't reliably link statically against glibc @@ -22,6 +26,7 @@ LDFLAGS = -Wl,-Bstatic LDFLAGS_SUFFIX = -Wl,-Bdynamic DEPS = ../libcap/libcap.a endif +endif ../libcap/libcap.a: $(MAKE) -C ../libcap libcap.a -- cgit v1.2.3