[libgnome-keyring] Build introspection typelib
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgnome-keyring] Build introspection typelib
- Date: Wed, 18 Jan 2012 09:14:38 +0000 (UTC)
commit 3511c727215ca3b5f24dd596b6b64bea5e9fef35
Author: Martin Pitt <martin pitt ubuntu com>
Date: Sat Jan 14 07:37:31 2012 +0100
Build introspection typelib
As per https://live.gnome.org/GObjectIntrospection/AutotoolsIntegration
https://bugzilla.gnome.org/show_bug.cgi?id=598414
.gitignore | 2 +
Makefile.am | 4 ++-
configure.ac | 4 ++
library/Makefile.am | 28 +++++++++++++++
m4/introspection.m4 | 94 +++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 131 insertions(+), 1 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 0071c2e..719576e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -109,6 +109,8 @@ run-auto-test.h
/library/*.pc
/library/Makefile
/library/Makefile.in
+/library/*.gir
+/library/*.typelib
# /library/tests
/library/tests/Makefile
diff --git a/Makefile.am b/Makefile.am
index 145f566..29b8289 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -11,10 +11,12 @@ EXTRA_DIST = \
intltool-merge.in \
intltool-update.in \
HACKING \
- COPYING.GPL
+ COPYING.GPL \
+ m4/introspection.m4
DISTCHECK_CONFIGURE_FLAGS = \
--enable-gtk-doc \
+ --enable-introspection \
--enable-tests=yes \
--enable-debug=yes
diff --git a/configure.ac b/configure.ac
index 8567901..6738407 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,6 +49,9 @@ AC_SUBST(GETTEXT_PACKAGE)
AM_GLIB_GNU_GETTEXT
+# Introspection
+GOBJECT_INTROSPECTION_CHECK([1.30.0])
+
# --------------------------------------------------------------------
# Check for various credentials.
#
@@ -236,6 +239,7 @@ echo
echo "CFLAGS: $CFLAGS"
echo
echo "OPTIONS:"
+echo " Introspection: $found_introspection"
echo " Debug Build: $debug_status"
echo " Tests: $tests_status"
echo
diff --git a/library/Makefile.am b/library/Makefile.am
index 7d91abd..a8fd0ee 100644
--- a/library/Makefile.am
+++ b/library/Makefile.am
@@ -47,6 +47,34 @@ pkgconfig_DATA = gnome-keyring-1.pc
EXTRA_DIST = \
gnome-keyring-1-uninstalled.pc.in
+CLEANFILES=
+
+# build introspection typelib
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir) --warn-all
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+if HAVE_INTROSPECTION
+# the gkr-* files are not part of the public API
+introspection_sources = $(filter-out gkr-% %-private.h,$(libgnome_keyring_la_SOURCES))
+
+GnomeKeyring-1.0.gir: $(lib_LTLIBRARIES)
+GnomeKeyring_1_0_gir_INCLUDES = GObject-2.0
+GnomeKeyring_1_0_gir_CFLAGS = $(INCLUDES)
+GnomeKeyring_1_0_gir_LIBS = $(lib_LTLIBRARIES)
+GnomeKeyring_1_0_gir_FILES = $(introspection_sources)
+INTROSPECTION_GIRS += GnomeKeyring-1.0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif
+
if WITH_TESTS
TESTS_DIR = tests
else
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644
index 0000000..bfc52be
--- /dev/null
+++ b/m4/introspection.m4
@@ -0,0 +1,94 @@
+dnl -*- mode: autoconf -*-
+dnl Copyright 2009 Johan Dahlin
+dnl
+dnl This file is free software; the author(s) gives unlimited
+dnl permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+
+# serial 1
+
+m4_define([_GOBJECT_INTROSPECTION_CHECK_INTERNAL],
+[
+ AC_BEFORE([AC_PROG_LIBTOOL],[$0])dnl setup libtool first
+ AC_BEFORE([AM_PROG_LIBTOOL],[$0])dnl setup libtool first
+ AC_BEFORE([LT_INIT],[$0])dnl setup libtool first
+
+ dnl enable/disable introspection
+ m4_if([$2], [require],
+ [dnl
+ enable_introspection=yes
+ ],[dnl
+ AC_ARG_ENABLE(introspection,
+ AS_HELP_STRING([--enable-introspection[=@<:@no/auto/yes@:>@]],
+ [Enable introspection for this build]),,
+ [enable_introspection=auto])
+ ])dnl
+
+ AC_MSG_CHECKING([for gobject-introspection])
+
+ dnl presence/version checking
+ AS_CASE([$enable_introspection],
+ [no], [dnl
+ found_introspection="no (disabled, use --enable-introspection to enable)"
+ ],dnl
+ [yes],[dnl
+ PKG_CHECK_EXISTS([gobject-introspection-1.0],,
+ AC_MSG_ERROR([gobject-introspection-1.0 is not installed]))
+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1],
+ found_introspection=yes,
+ AC_MSG_ERROR([You need to have gobject-introspection >= $1 installed to build AC_PACKAGE_NAME]))
+ ],dnl
+ [auto],[dnl
+ PKG_CHECK_EXISTS([gobject-introspection-1.0 >= $1], found_introspection=yes, found_introspection=no)
+ ],dnl
+ [dnl
+ AC_MSG_ERROR([invalid argument passed to --enable-introspection, should be one of @<:@no/auto/yes@:>@])
+ ])dnl
+
+ AC_MSG_RESULT([$found_introspection])
+
+ INTROSPECTION_SCANNER=
+ INTROSPECTION_COMPILER=
+ INTROSPECTION_GENERATE=
+ INTROSPECTION_GIRDIR=
+ INTROSPECTION_TYPELIBDIR=
+ if test "x$found_introspection" = "xyes"; then
+ INTROSPECTION_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+ INTROSPECTION_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+ INTROSPECTION_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+ INTROSPECTION_GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+ INTROSPECTION_TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+ INTROSPECTION_CFLAGS=`$PKG_CONFIG --cflags gobject-introspection-1.0`
+ INTROSPECTION_LIBS=`$PKG_CONFIG --libs gobject-introspection-1.0`
+ INTROSPECTION_MAKEFILE=`$PKG_CONFIG --variable=datadir gobject-introspection-1.0`/gobject-introspection-1.0/Makefile.introspection
+ fi
+ AC_SUBST(INTROSPECTION_SCANNER)
+ AC_SUBST(INTROSPECTION_COMPILER)
+ AC_SUBST(INTROSPECTION_GENERATE)
+ AC_SUBST(INTROSPECTION_GIRDIR)
+ AC_SUBST(INTROSPECTION_TYPELIBDIR)
+ AC_SUBST(INTROSPECTION_CFLAGS)
+ AC_SUBST(INTROSPECTION_LIBS)
+ AC_SUBST(INTROSPECTION_MAKEFILE)
+
+ AM_CONDITIONAL(HAVE_INTROSPECTION, test "x$found_introspection" = "xyes")
+])
+
+
+dnl Usage:
+dnl GOBJECT_INTROSPECTION_CHECK([minimum-g-i-version])
+
+AC_DEFUN([GOBJECT_INTROSPECTION_CHECK],
+[
+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1])
+])
+
+dnl Usage:
+dnl GOBJECT_INTROSPECTION_REQUIRE([minimum-g-i-version])
+
+
+AC_DEFUN([GOBJECT_INTROSPECTION_REQUIRE],
+[
+ _GOBJECT_INTROSPECTION_CHECK_INTERNAL([$1], [require])
+])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]