mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
regression tests: build against in-tree libapparmor by default [v3]
This patch converts the regression tests to build against the in-tree libapparmor, giving an error if libapparmor has not already been built. It also maintains support for building against the system libapparmor via passing USE_SYSTEM=1 on the make command line. An error is also given if the system libapparmor cannot be found, indicating that development packages need to be installed. The check to look for libapparmor is also updated to make use of libapparmor pkg-config data if available. Patch history: v1: initial submission v2: convert from including the apparmor.h on the command line to specifying an in-tree libapparmor header include path, now that their location has been adjusted to make it safe to do so. Remove work around related to defining _GNU_SOURCE. v3: fix LDLIBS to use output of pkg-config et al tests instead of hardcoding -lapparmor in the USE_SYSTEM case. Signed-off-by: Steve Beattie <steve@nxnw.org> Acked-by: Tyler Hicks <tyhicks@canonical.com>
This commit is contained in:
parent
260d73f752
commit
c478f8f0e1
1 changed files with 33 additions and 7 deletions
|
@ -1,10 +1,43 @@
|
|||
# Copyright (C) 2002-2005 Novell/SUSE
|
||||
# Copyright (C) 2013 Canonical, Ltd
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, version 2 of the
|
||||
# License.
|
||||
|
||||
ifdef USE_SYSTEM
|
||||
# use the system libapparmor headers and library
|
||||
LIBAPPARMOR = $(shell if pkg-config --exists libapparmor ; then \
|
||||
pkg-config --silence-errors --libs libapparmor ; \
|
||||
elif ldconfig -p | grep -q libapparmor\.so$$ ; then \
|
||||
echo -lapparmor ; \
|
||||
fi )
|
||||
ifeq ($(strip $(LIBAPPARMOR)),)
|
||||
$(error Unable to find libapparmor installed on this system; either \
|
||||
install libapparmor devel packages, set the LIBAPPARMOR variable \
|
||||
manually, or build against in-tree libapparmor)
|
||||
endif # LIBAPPARMOR not set
|
||||
LDLIBS += $(LIBAPPARMOR)
|
||||
|
||||
else # !USE_SYSTEM
|
||||
# use in-tree versions
|
||||
LIBAPPARMOR_SRC := ../../../libraries/libapparmor/
|
||||
LIBAPPARMOR_INCLUDE = $(LIBAPPARMOR_SRC)/include
|
||||
LIBAPPARMOR_PATH := $(LIBAPPARMOR_SRC)/src/.libs/
|
||||
ifeq ($(realpath $(LIBAPPARMOR_PATH)/libapparmor.a),)
|
||||
$(error $(LIBAPPARMOR_PATH)/libapparmor.a is missing; either build against \
|
||||
the in-tree libapparmor by building it first and then trying again \
|
||||
(see the top-level README for help) or build against the system \
|
||||
libapparmor by adding USE_SYSTEM=1 to your make command.)
|
||||
endif
|
||||
|
||||
CFLAGS += -L$(LIBAPPARMOR_PATH) -I$(LIBAPPARMOR_INCLUDE)
|
||||
LDLIBS += -Wl,-Bstatic -lapparmor -Wl,-Bdynamic -lpthread
|
||||
endif # USE_SYSTEM
|
||||
|
||||
CFLAGS += -Wall -Wstrict-prototypes
|
||||
|
||||
SRC=access.c \
|
||||
introspect.c \
|
||||
changeprofile.c \
|
||||
|
@ -82,13 +115,6 @@ ifneq (,$(findstring $(shell uname -i),i386 i486 i586 i686 x86 x86_64))
|
|||
SRC+=syscall_ioperm.c syscall_iopl.c
|
||||
endif
|
||||
|
||||
LIBAPPARMOR:=$(shell if ldconfig -p | grep -q libapparmor\.so ; then \
|
||||
echo -lapparmor ; \
|
||||
fi )
|
||||
|
||||
CFLAGS+=-Wall -Wstrict-prototypes
|
||||
LDLIBS+=$(LIBAPPARMOR)
|
||||
|
||||
EXEC=$(SRC:%.c=%)
|
||||
|
||||
TESTS=access \
|
||||
|
|
Loading…
Add table
Reference in a new issue