From 2140db697c7f1da2a0a3f7bbcb14c1a0dade84e5 Mon Sep 17 00:00:00 2001 From: Adam Duskett Date: Wed, 14 May 2025 16:32:53 +0200 Subject: [PATCH] Add support for static-only build Instead of unconditionally building shared libraries, this patch improves the libsepol build system with a "STATIC" variable, which when defined to some non-empty value, will disable the build of shared libraries. It allows to support cases where the target architecture does not have support for shared libraries. Signed-off-by: Thomas Petazzoni [Updated for 3.8.1] Signed-off-by: Adam Duskett Signed-off-by: Fabrice Fontaine [Update for 2.8] --- src/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Makefile b/src/Makefile index 71fa3ed..efb81bc 100644 --- a/src/Makefile +++ b/src/Makefile @@ -45,7 +45,12 @@ LDFLAGS += -undefined dynamic_lookup LN=gln endif -all: $(LIBA) $(LIBSO) $(LIBPC) +ALL_TARGETS = $(LIBA) $(LIBPC) +ifeq ($(STATIC),) +ALL_TARGETS += $(LIBSO) +endif + +all: $(ALL_TARGETS) $(LIBA): $(OBJS) @@ -87,8 +92,10 @@ endif install: all test -d $(DESTDIR)$(LIBDIR) || install -m 755 -d $(DESTDIR)$(LIBDIR) install -m 644 $(LIBA) $(DESTDIR)$(LIBDIR) +ifeq ($(STATIC),) test -d $(DESTDIR)$(SHLIBDIR) || install -m 755 -d $(DESTDIR)$(SHLIBDIR) install -m 755 $(LIBSO) $(DESTDIR)$(SHLIBDIR) +endif test -d $(DESTDIR)$(LIBDIR)/pkgconfig || install -m 755 -d $(DESTDIR)$(LIBDIR)/pkgconfig install -m 644 $(LIBPC) $(DESTDIR)$(LIBDIR)/pkgconfig $(LN) -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET) -- 2.49.0