buildroot/package/libsepol/0001-support-static-only.patch
Baruch Siach 5879f0192e libsepol: fix static build
Commit a3ebe45dcb (libsepol: bump to version 2.5, 2016-06-26) didn't refresh
correctly the patch adding static build support. Do this now.

Fixes:
http://autobuild.buildroot.net/results/14b/14bbb7c9c59e7f68f3ae7ad63e075e27a0da2b1e/
http://autobuild.buildroot.net/results/97f/97f61d5e46a7f479e8de5dd19d49f7a3d84cc86e/
http://autobuild.buildroot.net/results/920/920e1ddac6bf93707a187e64a4ef7d95aff09e6c/

Cc: Adam Duskett <Aduskett@gmail.com>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2016-08-05 15:48:48 +02:00

49 lines
1.5 KiB
Diff

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 <thomas.petazzoni@free-electrons.com>
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
Index: b/src/Makefile
===================================================================
diff --git a/src/Makefile b/src/Makefile
index db6c2ba..0006285 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -30,8 +30,12 @@ LOBJS += $(sort $(patsubst %.c,%.lo,$(wildcard $(CILDIR)/src/*.c) $(CIL_GENERATE
override CFLAGS += -I$(CILDIR)/include
endif
+ALL_TARGETS = $(LIBA) $(LIBPC)
+ifeq ($(STATIC),)
+ALL_TARGETS += $(LIBSO)
+endif
-all: $(LIBA) $(LIBSO) $(LIBPC)
+all: $(ALL_TARGETS)
$(LIBA): $(OBJS)
@@ -66,11 +70,13 @@
install: all
test -d $(LIBDIR) || install -m 755 -d $(LIBDIR)
install -m 644 $(LIBA) $(LIBDIR)
- test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
- install -m 755 $(LIBSO) $(SHLIBDIR)
test -d $(LIBDIR)/pkgconfig || install -m 755 -d $(LIBDIR)/pkgconfig
install -m 644 $(LIBPC) $(LIBDIR)/pkgconfig
+ifeq ($(STATIC),)
+ test -d $(SHLIBDIR) || install -m 755 -d $(SHLIBDIR)
+ install -m 755 $(LIBSO) $(SHLIBDIR)
ln -sf --relative $(SHLIBDIR)/$(LIBSO) $(LIBDIR)/$(TARGET)
+endif
relabel:
/sbin/restorecon $(SHLIBDIR)/$(LIBSO)