policycoreutils: restorecond: use pkg-config to find dbus-glib-1 files
PATCH 1/1 policycoreutils: restorecond: use pkg-config to find dbus-glib-1 files
On Ubuntu some header files are located in /usr/lib/x86_64-linux-gnu/, not /usr/lib64/:
$ pkg-config --cflags dbus-glib-1
-I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include
-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/includeUse pkg-config instead of hard-coded paths to find glib and dbus-glib headers and libraries.
This is needed in order to use environments provided for example by
https://travis-ci.org/.
Signed-off-by Nicolas Iooss <[email protected]>
--- policycoreutils/restorecond/Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
policycoreutils/restorecond/Makefile +6 -4
@@ -1,3 +1,5 @@ +PKG_CONFIG ?= pkg-config + # Installation directories. PREFIX ?= $(DESTDIR)/usr SBINDIR ?= $(PREFIX)/sbin
@@ -11,11 +13,11 @@ autostart_DATA = sealertauto.desktop INITDIR ?= $(DESTDIR)/etc/rc.d/init.d SELINUXDIR = $(DESTDIR)/etc/selinux -DBUSFLAGS = -DHAVE_DBUS -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/lib/dbus-1.0/include -DBUSLIB = -ldbus-glib-1 -ldbus-1 +DBUSFLAGS = -DHAVE_DBUS $(shell $(PKG_CONFIG) --cflags dbus-glib-1) +DBUSLIB = $(shell $(PKG_CONFIG) --libs dbus-glib-1) CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include $(DBUSFLAGS) -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib/glib-2.0/include +override CFLAGS += -I$(PREFIX)/include $(DBUSFLAGS) USE_PCRE2 ?= n ifeq ($(USE_PCRE2),y)
@@ -24,7 +26,7 @@ else PCRE_LDFLAGS := -lpcre endif -LDLIBS += -lselinux $(PCRE_LDFLAGS) $(DBUSLIB) -lglib-2.0 -L$(LIBDIR) +LDLIBS += -lselinux $(PCRE_LDFLAGS) $(DBUSLIB) -L$(LIBDIR) all: restorecond
Signature · 1 line
2.10.1
Stephen Smalley
AppliedQuoted 7 lines · Nicolas Iooss
On Ubuntu some header files are located in
/usr/lib/x86_64-linux-gnu/, not/usr/lib64/:$ pkg-config --cflags dbus-glib-1 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
Quoted 5 lines
Use pkg-config instead of hard-coded paths to find glib and dbus-glib headers and libraries.
This is needed in order to use environments provided for example by
https://travis-ci.org/.
Thanks, applied.
Quoted 41 lines
Signed-off-by Nicolas Iooss <[email protected]>--- policycoreutils/restorecond/Makefile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)policycoreutils/restorecond/Makefile +6
-4@@ -1,3 +1,5 @@ +PKG_CONFIG ?= pkg-config + # Installation directories. PREFIX ?= $(DESTDIR)/usr SBINDIR ?= $(PREFIX)/sbin@@ -11,11 +13,11 @@ autostart_DATA = sealertauto.desktop INITDIR ?= $(DESTDIR)/etc/rc.d/init.d SELINUXDIR = $(DESTDIR)/etc/selinux -DBUSFLAGS = -DHAVE_DBUS -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/lib/dbus-1.0/include -DBUSLIB = -ldbus-glib-1 -ldbus-1 +DBUSFLAGS = -DHAVE_DBUS $(shell $(PKG_CONFIG) --cflags dbus-glib-1) +DBUSLIB = $(shell $(PKG_CONFIG) --libs dbus-glib-1) CFLAGS ?= -g -Werror -Wall -W -override CFLAGS += -I$(PREFIX)/include $(DBUSFLAGS) -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/lib/glib-2.0/include +override CFLAGS += -I$(PREFIX)/include $(DBUSFLAGS) USE_PCRE2 ?= n ifeq ($(USE_PCRE2),y)@@ -24,7 +26,7 @@ else PCRE_LDFLAGS := -lpcre endif -LDLIBS += -lselinux $(PCRE_LDFLAGS) $(DBUSLIB) -lglib-2.0 -L$(LIBDIR) +LDLIBS += -lselinux $(PCRE_LDFLAGS) $(DBUSLIB) -L$(LIBDIR) all: restorecond