libapparmor: move public headers to separate directory

This patch moves the apparmor.h and aalogparse.h headers
from the libapparmor/src/ directory to a new directory
libapparmor/include/. The apparmor.h header is stored in a sys/
directory within libapparmor/include/ to match its usual install
location in /usr/include/sys/, simplifying the #include statements of
source that wishes to include either the in-tree or system installed
version of the header (i.e. #include <sys/apparmor.h> can be used
everywhere).

The patch size is inflated by the movements of the header files, which
are unchanged except for their locations. Otherwise, the rest of the
changes are to modify the include search path or to stop looking in
$CWD for one of the headers.

Signed-off-by: Steve Beattie <steve@nxnw.org>
Acked-by: Tyler Hicks <tyhicks@canonical.com>
This commit is contained in:
Steve Beattie 2014-01-06 14:08:55 -08:00
parent 6552d192a6
commit a72f0693f3
20 changed files with 27 additions and 24 deletions

View file

@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = foreign 1.4
NAME = libapparmor
SRCDIR = src
SUBDIRS = doc src swig testsuite
SUBDIRS = doc src include swig testsuite
REPO_VERSION=$(shell if [ -x /usr/bin/svn ] ; then \
/usr/bin/svn info . 2> /dev/null | grep "^Last Changed Rev:" | sed "s/^Last Changed Rev: //" ; \

View file

@ -82,4 +82,6 @@ testsuite/Makefile
testsuite/config/Makefile
testsuite/libaalogparse.test/Makefile
testsuite/lib/Makefile
include/Makefile
include/sys/Makefile
)

View file

@ -0,0 +1,4 @@
SUBDIRS = sys
aalogparsedir = $(includedir)/aalogparse
aalogparse_HEADERS = aalogparse.h

View file

@ -0,0 +1,3 @@
apparmor_hdrdir = $(includedir)/sys
apparmor_hdr_HEADERS = apparmor.h

View file

@ -28,7 +28,7 @@ BUILT_SOURCES = grammar.h scanner.h af_protos.h
AM_LFLAGS = -v
AM_YFLAGS = -d -p aalogparse_
AM_CFLAGS = -Wall
AM_CPPFLAGS = -D_GNU_SOURCE
AM_CPPFLAGS = -D_GNU_SOURCE -I$(top_srcdir)/include/
scanner.h: scanner.l
$(LEX) -v $<
@ -37,12 +37,6 @@ scanner.c: scanner.l
af_protos.h: /usr/include/netinet/in.h
LC_ALL=C sed -n -e "/IPPROTO_MAX/d" -e "s/^\#define[ \\t]\\+IPPROTO_\\([A-Z0-9_]\\+\\)\\(.*\\)$$/AA_GEN_PROTO_ENT(\\UIPPROTO_\\1, \"\\L\\1\")/p" $< > $@
changehatdir = $(includedir)/sys
changehat_HEADERS = apparmor.h
aalogparsedir = $(includedir)/aalogparse
aalogparse_HEADERS = aalogparse.h
lib_LTLIBRARIES = libapparmor.la
noinst_HEADERS = grammar.h parser.h scanner.h af_protos.h

View file

@ -22,7 +22,7 @@
* information about tokens given and rules matched. */
#define YYDEBUG 0
#include <string.h>
#include "aalogparse.h"
#include <aalogparse.h>
#include "parser.h"
#include "grammar.h"
#include "scanner.h"

View file

@ -31,7 +31,7 @@
#include <inttypes.h>
#include <pthread.h>
#include "apparmor.h"
#include <sys/apparmor.h>
/* some non-Linux systems do not define a static value */
#ifndef PATH_MAX

View file

@ -31,7 +31,7 @@
#include <string.h>
#include <stdio.h>
#include <netinet/in.h>
#include "aalogparse.h"
#include <aalogparse.h>
#include "parser.h"
/* This is mostly just a wrapper around the code in grammar.y */

View file

@ -27,7 +27,7 @@
%{
#include "grammar.h"
#include "aalogparse.h"
#include <aalogparse.h>
#include "parser.h"
#include <assert.h>

View file

@ -18,7 +18,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "aalogparse.h"
#include <aalogparse.h>
#include "parser.h"

View file

@ -1,13 +1,13 @@
%module LibAppArmor
%{
#include "aalogparse.h"
#include "apparmor.h"
#include <aalogparse.h>
#include <sys/apparmor.h>
%}
%include "typemaps.i"
%include "aalogparse.h"
%include <aalogparse.h>
/* swig doesn't like the macro magic we do in apparmor.h so the fn prototypes
* are manually inserted here

View file

@ -10,7 +10,7 @@ WriteMakefile(
'FIRST_MAKEFILE' => 'Makefile.perl',
'ABSTRACT' => q[Perl interface to AppArmor] ,
'VERSION' => q[@VERSION@],
'INC' => q[@CPPFLAGS@ -I@top_srcdir@/src @CFLAGS@],
'INC' => q[@CPPFLAGS@ -I@top_srcdir@/include @CFLAGS@],
'LIBS' => q[-L@top_builddir@/src/.libs/ -lapparmor @LIBS@],
'OBJECT' => 'libapparmor_wrap.o', # $(OBJ_EXT)
) ;

View file

@ -4,7 +4,7 @@ if HAVE_PERL
noinst_DATA =LibAppArmor.so
libapparmor_wrap.c: $(srcdir)/../SWIG/libapparmor.i
$(SWIG) -perl -I$(srcdir)/../../src -module LibAppArmor -o $@ $(srcdir)/../SWIG/libapparmor.i
$(SWIG) -perl -I$(srcdir)/../../include -module LibAppArmor -o $@ $(srcdir)/../SWIG/libapparmor.i
MOSTLYCLEANFILES=libapparmor_wrap.c LibAppArmor.pm

View file

@ -5,7 +5,7 @@ EXTRA_DIST = libapparmor_wrap.c
SUBDIRS = test
libapparmor_wrap.c: $(srcdir)/../SWIG/libapparmor.i
$(SWIG) -python -I$(srcdir)/../../src -module LibAppArmor -o $@ $(srcdir)/../SWIG/libapparmor.i
$(SWIG) -python -I$(srcdir)/../../include -module LibAppArmor -o $@ $(srcdir)/../SWIG/libapparmor.i
mv LibAppArmor.py __init__.py
MOSTLYCLEANFILES=libapparmor_wrap.c __init__.py

View file

@ -12,7 +12,7 @@ setup(name = 'LibAppArmor',
packages = [ 'LibAppArmor' ],
ext_package = 'LibAppArmor',
ext_modules = [Extension('_LibAppArmor', ['libapparmor_wrap.c'],
include_dirs=['@top_srcdir@/src'],
include_dirs=['@top_srcdir@/include'],
extra_link_args = '-L@top_builddir@/src/.libs -lapparmor'.split(),
)],
scripts = [],

View file

@ -4,12 +4,12 @@ EXTRA_DIST = extconf.rb LibAppArmor_wrap.c examples/*.rb
noinst_DATA = LibAppArmor.so
LibAppArmor_wrap.c : $(srcdir)/../SWIG/libapparmor.i
$(SWIG) -ruby -module LibAppArmor -I$(top_srcdir)/src -o $@ $(srcdir)/../SWIG/libapparmor.i
$(SWIG) -ruby -module LibAppArmor -I$(top_srcdir)/include -o $@ $(srcdir)/../SWIG/libapparmor.i
MOSTLYCLEANFILES=LibAppArmor_wrap.c
Makefile.ruby: extconf.rb
PREFIX=$(prefix) $(RUBY) $< --with-LibAppArmor-include=$(top_srcdir)/src
PREFIX=$(prefix) $(RUBY) $< --with-LibAppArmor-include=$(top_srcdir)/include
LibAppArmor.so: LibAppArmor_wrap.c Makefile.ruby
$(MAKE) -fMakefile.ruby

View file

@ -2,7 +2,7 @@ SUBDIRS = lib config libaalogparse.test
PACKAGE = libaalogparse
AUTOMAKE_OPTIONS = dejagnu
INCLUDES = -I. -I$(top_srcdir)/src
INCLUDES = -I. -I$(top_srcdir)/include
AM_CPPFLAGS = $(DEBUG_FLAGS) -DLOCALEDIR=\"${localedir}\"
AM_CFLAGS = -Wall

View file

@ -5,7 +5,7 @@
#include <string.h>
#include <errno.h>
#include "aalogparse.h"
#include <aalogparse.h>
int print_results(aa_log_record *record);