summaryrefslogtreecommitdiff
path: root/package/libsepol/0001-support-static-only.patch
blob: 3e6d555e96e535a5688c54313ead8ebb554b2e66 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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)