2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

parser: Add make variable to build against local or system libapparmor [v3]

By default, statically link against the in-tree libapparmor. If the
in-tree libapparmor is not yet built, print a helpful error message. To
build against the system libapparmor, the USE_SYSTEM make
variable can be set on the command line like so:

  $ make USE_SYSTEM=1

This patch also fixes issues around the inclusion of the apparmor.h
header. Previously, the in-tree apparmor.h was always being included
even if the parser was being linked against the system libapparmor.
It modifies the apparmor.h include path based on the previous patch
separating them out in the libapparmor source. This was needed because
header file name collisions were already occurring.

For source files needing to include apparmor.h, the make targets were
also updated to depend on the local apparmor.h when building against
the in-tree libapparmor.  When building against the system libapparmor,
the variable used in the dependency list is empty. Likewise, a
libapparmor.a dependency is added to the apparmor_parser target when
building against the in-tree apparmor.

Patch history:
  v1: from Tyler Hicks <tyhicks@canonical.com>
      - initial version
  v2: revert to altering the include search path rather than including
      the apparmor.h header directly via cpp arguments, alter the
      include statements to <sys/apparmor.h> which will work against
      either in-tree or (default) system paths.
  v3: convert controlling variable to USE_SYSTEM from SYSTEM_LIBAPPARMOR
      to unify between the parser and the regression tests.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Steve Beattie <steve@nxnw.org>
This commit is contained in:
Steve Beattie
2014-01-06 14:46:10 -08:00
parent a72f0693f3
commit 260d73f752
6 changed files with 40 additions and 15 deletions

View File

@@ -21,7 +21,7 @@
#include <string.h>
#include <libintl.h>
#include <linux/limits.h>
#include <apparmor.h>
#include <sys/apparmor.h>
#define _(s) gettext(s)
#include <string>