Skip to content

Commit

Permalink
libselinux: Add support for pcre2 to pkgconfig definition
Browse files Browse the repository at this point in the history
When libselinux is built using USE_PCRE2 libselinux.pc needs to require
libpcre2-8 instead of libpcre.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1487521

Signed-off-by: Petr Lautrbach <plautrba@redhat.com>
  • Loading branch information
bachradsusi committed Oct 7, 2017
1 parent ef61301 commit 8ba0627
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions libselinux/Makefile
Expand Up @@ -21,13 +21,14 @@ export DISABLE_SETRANS DISABLE_RPM DISABLE_FLAGS ANDROID_HOST

USE_PCRE2 ?= n
ifeq ($(USE_PCRE2),y)
PCRE_CFLAGS := -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 $(shell $(PKG_CONFIG) --cflags libpcre2-8)
PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs libpcre2-8)
PCRE_MODULE := libpcre2-8
PCRE_CFLAGS := -DUSE_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8
else
PCRE_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpcre)
PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs libpcre)
PCRE_MODULE := libpcre
endif
export PCRE_CFLAGS PCRE_LDLIBS
PCRE_CFLAGS += $(shell $(PKG_CONFIG) --cflags $(PCRE_MODULE))
PCRE_LDLIBS := $(shell $(PKG_CONFIG) --libs $(PCRE_MODULE))
export PCRE_MODULE PCRE_CFLAGS PCRE_LDLIBS

OS := $(shell uname)
export OS
Expand Down
2 changes: 1 addition & 1 deletion libselinux/src/Makefile
Expand Up @@ -148,7 +148,7 @@ $(LIBSO): $(LOBJS)
ln -sf $@ $(TARGET)

$(LIBPC): $(LIBPC).in ../VERSION
sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):' < $< > $@
sed -e 's/@VERSION@/$(VERSION)/; s:@prefix@:$(PREFIX):; s:@libdir@:$(LIBBASE):; s:@includedir@:$(INCLUDEDIR):; s:@PCRE_MODULE@:$(PCRE_MODULE):' < $< > $@

selinuxswig_python_exception.i: ../include/selinux/selinux.h
bash -e exception.sh > $@ || (rm -f $@ ; false)
Expand Down
2 changes: 1 addition & 1 deletion libselinux/src/libselinux.pc.in
Expand Up @@ -7,6 +7,6 @@ Name: libselinux
Description: SELinux utility library
Version: @VERSION@
URL: http://userspace.selinuxproject.org/
Requires.private: libsepol libpcre
Requires.private: libsepol @PCRE_MODULE@
Libs: -L${libdir} -lselinux
Cflags: -I${includedir}

0 comments on commit 8ba0627

Please sign in to comment.