xref: /OK3568_Linux_fs/buildroot/package/libsepol/0001-support-static-only.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From 2140db697c7f1da2a0a3f7bbcb14c1a0dade84e5 Mon Sep 17 00:00:00 2001
2From: Adam Duskett <aduskett@gmail.com>
3Date: Mon, 9 Oct 2017 16:28:12 -0400
4Subject: [PATCH] Add support for static-only build
5
6Instead of unconditionally building shared libraries, this patch
7improves the libsepol build system with a "STATIC" variable, which
8when defined to some non-empty value, will disable the build of shared
9libraries. It allows to support cases where the target architecture
10does not have support for shared libraries.
11
12Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
13Signed-off-by: Adam Duskett <aduskett@gmail.com>
14Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
15[Update for 2.8]
16---
17 src/Makefile | 13 ++++++++++---
18 1 file changed, 10 insertions(+), 3 deletions(-)
19
20diff -durNw libsepol-2.7.orig/src/Makefile libsepol-2.7/src/Makefile
21--- libsepol-2.7.orig/src/Makefile	2018-01-15 21:07:51.285183415 +0100
22+++ libsepol-2.7/src/Makefile	2018-01-15 21:08:56.515182717 +0100
23@@ -39,7 +39,12 @@
24 LN=gln
25 endif
26
27-all: $(LIBA) $(LIBSO) $(LIBPC)
28+ALL_TARGETS = $(LIBA) $(LIBPC)
29+ifeq ($(STATIC),)
30+ALL_TARGETS += $(LIBSO)
31+endif
32+
33+all: $(ALL_TARGETS)
34
35
36 $(LIBA):  $(OBJS)
37@@ -81,8 +86,10 @@
38 install: all
39	test -d $(DESTDIR)$(LIBDIR) || install -m 755 -d $(DESTDIR)$(LIBDIR)
40	install -m 644 $(LIBA) $(DESTDIR)$(LIBDIR)
41+ifeq ($(STATIC),)
42	test -d $(DESTDIR)$(SHLIBDIR) || install -m 755 -d $(DESTDIR)$(SHLIBDIR)
43	install -m 755 $(LIBSO) $(DESTDIR)$(SHLIBDIR)
44+endif
45	test -d $(DESTDIR)$(LIBDIR)/pkgconfig || install -m 755 -d $(DESTDIR)$(LIBDIR)/pkgconfig
46	install -m 644 $(LIBPC) $(DESTDIR)$(LIBDIR)/pkgconfig
47	$(LN) -sf --relative $(DESTDIR)$(SHLIBDIR)/$(LIBSO) $(DESTDIR)$(LIBDIR)/$(TARGET)
48