Annotation of /trunk/busybox/patches/busybox-1.20.2-pkg-config-selinux.patch
Parent Directory | Revision Log
Revision 1942 -
(hide annotations)
(download)
Tue Nov 6 12:50:29 2012 UTC (11 years, 10 months ago) by niro
File size: 2009 byte(s)
Tue Nov 6 12:50:29 2012 UTC (11 years, 10 months ago) by niro
File size: 2009 byte(s)
-more upstream patches
1 | niro | 1942 | From b1cec5003b73080a8aa7ea277621bf1c71c3e8d6 Mon Sep 17 00:00:00 2001 |
2 | From: Mike Frysinger <vapier@gentoo.org> | ||
3 | Date: Sat, 20 Oct 2012 15:01:26 -0400 | ||
4 | Subject: [PATCH] build system: use pkg-config to look up selinux libs | ||
5 | |||
6 | Newer versions of libselinux has started linking against more libs. | ||
7 | Rather than continuing hardcoding things, switch to using pkg-config | ||
8 | to query for its dependencies. | ||
9 | |||
10 | Signed-off-by: Mike Frysinger <vapier@gentoo.org> | ||
11 | --- | ||
12 | Makefile | 1 + | ||
13 | Makefile.flags | 12 +++++++++++- | ||
14 | 2 files changed, 12 insertions(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/Makefile b/Makefile | ||
17 | index fccde4a..3a0a5e1 100644 | ||
18 | --- a/Makefile | ||
19 | +++ b/Makefile | ||
20 | @@ -297,6 +297,7 @@ NM = $(CROSS_COMPILE)nm | ||
21 | STRIP = $(CROSS_COMPILE)strip | ||
22 | OBJCOPY = $(CROSS_COMPILE)objcopy | ||
23 | OBJDUMP = $(CROSS_COMPILE)objdump | ||
24 | +PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config | ||
25 | AWK = awk | ||
26 | GENKSYMS = scripts/genksyms/genksyms | ||
27 | DEPMOD = /sbin/depmod | ||
28 | diff --git a/Makefile.flags b/Makefile.flags | ||
29 | index c43c8dc..15dcc1f 100644 | ||
30 | --- a/Makefile.flags | ||
31 | +++ b/Makefile.flags | ||
32 | @@ -74,6 +74,12 @@ ARCH_FPIC ?= -fpic | ||
33 | ARCH_FPIE ?= -fpie | ||
34 | ARCH_PIE ?= -pie | ||
35 | |||
36 | +# Usage: $(eval $(call pkg_check_modules,VARIABLE-PREFIX,MODULES)) | ||
37 | +define pkg_check_modules | ||
38 | +$(1)_CFLAGS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --cflags $(2)) | ||
39 | +$(1)_LIBS := $(shell $(PKG_CONFIG) $(PKG_CONFIG_FLAGS) --libs $(2)) | ||
40 | +endef | ||
41 | + | ||
42 | ifeq ($(CONFIG_BUILD_LIBBUSYBOX),y) | ||
43 | # on i386: 14% smaller libbusybox.so | ||
44 | # (code itself is 9% bigger, we save on relocs/PLT/GOT) | ||
45 | @@ -85,6 +91,7 @@ endif | ||
46 | |||
47 | ifeq ($(CONFIG_STATIC),y) | ||
48 | CFLAGS_busybox += -static | ||
49 | +PKG_CONFIG_FLAGS += --static | ||
50 | endif | ||
51 | |||
52 | ifeq ($(CONFIG_PIE),y) | ||
53 | @@ -127,7 +134,10 @@ LDLIBS += pam pam_misc pthread | ||
54 | endif | ||
55 | |||
56 | ifeq ($(CONFIG_SELINUX),y) | ||
57 | -LDLIBS += selinux sepol | ||
58 | +SELINUX_PC_MODULES = libselinux libsepol | ||
59 | +$(eval $(call pkg_check_modules,SELINUX,$(SELINUX_PC_MODULES))) | ||
60 | +CPPFLAGS += $(SELINUX_CFLAGS) | ||
61 | +LDLIBS += $(if $(SELINUX_LIBS),$(SELINUX_LIBS:-l%=%),$(SELINUX_PC_MODULES:lib%=%)) | ||
62 | endif | ||
63 | |||
64 | ifeq ($(CONFIG_EFENCE),y) | ||
65 | -- | ||
66 | 1.7.12 | ||
67 |