[apparmor] [patch 3/3] regression tests: build against in-tree libapparmor by default [v2]
Tyler Hicks
tyhicks at canonical.com
Mon Jan 6 20:22:16 UTC 2014
On 2013-12-24 12:59:35, Steve Beattie wrote:
> 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.
>
> Signed-off-by: Steve Beattie <steve at nxnw.org>
> ---
> tests/regression/apparmor/Makefile | 40 ++++++++++++++++++++++++++++++-------
> 1 file changed, 33 insertions(+), 7 deletions(-)
>
> Index: b/tests/regression/apparmor/Makefile
> ===================================================================
> --- a/tests/regression/apparmor/Makefile
> +++ b/tests/regression/apparmor/Makefile
> @@ -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 += -lapparmor
I think we want this, instead:
LDLIBS += $(LIBAPPARMOR)
This way we benefit from using pkg-config, when available.
Otherwise, Acked-by: Tyler Hicks <tyhicks at canonical.com>
Thanks!
Tyler
> +
> +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),i
> 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 \
>
>
> --
> AppArmor mailing list
> AppArmor at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20140106/f06c58fa/attachment.pgp>
More information about the AppArmor
mailing list