aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2023-04-22 15:38:29 -0700
committerAndrew G. Morgan <morgan@kernel.org>2023-04-22 15:38:29 -0700
commit819f941bceb40a96cd3b06654782111e1efd6c6c (patch)
tree803d649f288a67c03efb4ecd048a2b943de46cb6
parenta4089305d9fb1aac74966727be2244ef831cb598 (diff)
downloadlibcap-819f941bceb40a96cd3b06654782111e1efd6c6c.tar.gz
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 <morgan@kernel.org>
-rwxr-xr-xkdebug/test-kernel.sh4
-rw-r--r--progs/Makefile5
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