[apparmor] [patch] add pkg-config support to libapparmor

2012-11-10 Thread Steve Beattie
Given that we want to do more apparmor things in user space (dbus
mediation, file picker, etc.), making it easier for other source bases
to detect the presence of libapparmor would be beneficial. This patch
adds pkg-config support to the build infrastructure for libapparmor.

(This code is mostly monkey-patched mimicry; people who actually know
what they're doing with pkg-config are encouraged to comment.)

---
 libraries/libapparmor/configure.in  |1 +
 libraries/libapparmor/src/Makefile.am   |   10 +-
 libraries/libapparmor/src/libapparmor.pc.in |   10 ++
 3 files changed, 20 insertions(+), 1 deletion(-)

Index: b/libraries/libapparmor/src/Makefile.am
===
--- a/libraries/libapparmor/src/Makefile.am
+++ b/libraries/libapparmor/src/Makefile.am
@@ -22,6 +22,7 @@ AA_LIB_CURRENT = 1
 AA_LIB_REVISION = 2
 AA_LIB_AGE = 0
 
+SUFFIXES = .pc.in .pc
 
 BUILT_SOURCES = grammar.h scanner.h af_protos.h
 AM_LFLAGS = -v
@@ -52,9 +53,16 @@ libapparmor_la_LDFLAGS = -version-info $
 libimmunix_la_SOURCES = kernel_interface.c libimmunix_warning.c
 libimmunix_la_LDFLAGS = -version-info 
$(AA_LIB_CURRENT):$(AA_LIB_REVISION):$(AA_LIB_AGE) 
-Wl,--version-script=$(top_srcdir)/src/libapparmor.map 
-Wl,-soname=libimmunix.so.1
 
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = libapparmor.pc
+
+%.pc: %.pc.in $(top_builddir)/config.status
+   $(AM_V_GEN)cd $(top_builddir)  \
+   $(SHELL) ./config.status --file=src/$@
+
 tst_aalogmisc_SOURCES = tst_aalogmisc.c
 tst_aalogmisc_LDADD = .libs/libapparmor.a
 check_PROGRAMS = tst_aalogmisc
 TESTS = $(check_PROGRAMS)
 
-EXTRA_DIST = grammar.y scanner.l libapparmor.map
+EXTRA_DIST = grammar.y scanner.l libapparmor.map libapparmor.pc
Index: b/libraries/libapparmor/src/libapparmor.pc.in
===
--- /dev/null
+++ b/libraries/libapparmor/src/libapparmor.pc.in
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libapparmor
+Description: AppArmor library for for utility functions
+Version: @VERSION@
+Cflags: -I${includedir}
+Libs: -L${libdir} -lapparmor
Index: b/libraries/libapparmor/configure.in
===
--- a/libraries/libapparmor/configure.in
+++ b/libraries/libapparmor/configure.in
@@ -10,6 +10,7 @@ AM_INIT_AUTOMAKE(libapparmor1, apparmor_
 AM_PROG_LEX
 AC_PROG_YACC
 AC_PROG_SED
+PKG_PROG_PKG_CONFIG
 
 AC_PATH_PROG([SWIG], [swig])
 

-- 
Steve Beattie
sbeat...@ubuntu.com
http://NxNW.org/~steve/


signature.asc
Description: Digital signature
-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor


Re: [apparmor] [patch] add pkg-config support to libapparmor

2012-11-10 Thread Kees Cook
On Sat, Nov 10, 2012 at 11:08:44AM -0800, Steve Beattie wrote:
 Given that we want to do more apparmor things in user space (dbus
 mediation, file picker, etc.), making it easier for other source bases
 to detect the presence of libapparmor would be beneficial. This patch
 adds pkg-config support to the build infrastructure for libapparmor.
 
 (This code is mostly monkey-patched mimicry; people who actually know
 what they're doing with pkg-config are encouraged to comment.)

Better than not having it! :)

Acked-by: Kees Cook k...@ubuntu.com

-Kees

-- 
Kees Cook

-- 
AppArmor mailing list
AppArmor@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor