libsemanage/tests: include libsepol headers from $DESTDIR

When building and running tests on a system without SELinux with a
command similar to "make DESTDIR=/tmp/destdir install test", libsemanage
tests fail to build with the following error:

    In file included from utilities.h:20:0,
                     from utilities.c:24:
    ../src/handle.h:29:26: fatal error: sepol/handle.h: No such file or
    directory
     #include <sepol/handle.h>
                              ^

Fix this by adding the newly-installed directory under $DESTDIR (using
variable $PREFIX) in the search paths of the compiler.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2017-02-27 21:39:33 +01:00 committed by James Carter
parent 4176a29235
commit ccfbd9aa17
2 changed files with 1 additions and 3 deletions

View File

@ -105,14 +105,12 @@ script:
- make all -k
# Set up environment variables for the tests
- export CFLAGS="-I$DESTDIR/usr/include"
- export LD_LIBRARY_PATH="$DESTDIR/usr/lib:$DESTDIR/lib"
- export PATH="$DESTDIR/usr/sbin:$DESTDIR/usr/bin:$DESTDIR/sbin:$DESTDIR/bin:$PATH"
- export PYTHONPATH="$PYSITEDIR"
- export RUBYLIB="$DESTDIR/$($RUBY -e 'puts RbConfig::CONFIG["vendorlibdir"]'):$DESTDIR/$($RUBY -e 'puts RbConfig::CONFIG["vendorarchdir"]')"
# Show variables (to help debugging issues)
- echo "$CFLAGS"
- echo "$LD_LIBRARY_PATH"
- echo "$PATH"
- echo "$PYTHONPATH"

View File

@ -11,7 +11,7 @@ LIBS = ../src/libsemanage.a -L$(LIBDIR) -lselinux -lsepol
EXECUTABLE = libsemanage-tests
CFLAGS += -g -O0 -Wall -W -Wundef -Wmissing-noreturn -Wmissing-format-attribute -Wno-unused-parameter
INCLUDE = -I../src -I../include
INCLUDE = -I../src -I../include -I$(PREFIX)/include
LDFLAGS += -lcunit -lbz2 -laudit
OBJECTS = $(SOURCES:.c=.o)