[seahorse] Initial support for introspection of libcryptui



commit ed5b6c9f1280b05baf52a29f8d80cd8d8a8c6c45
Author: Adam Schreiber <sadam gnome org>
Date:   Fri Dec 4 14:51:46 2009 -0500

    Initial support for introspection of libcryptui
    
    WARNING: Don't use this, it's relatively untested and there's at
    least one known bug.
    https://bugzilla.gnome.org/show_bug.cgi?id=603812

 configure.in           |   29 +++++++++------
 libcryptui/.gitignore  |    2 +
 libcryptui/Makefile.am |   52 ++++++++++++++++++++++++---
 m4/introspection.m4    |   92 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 158 insertions(+), 17 deletions(-)
---
diff --git a/configure.in b/configure.in
index 29c301b..d76197f 100644
--- a/configure.in
+++ b/configure.in
@@ -544,7 +544,13 @@ CAIRO_PREFIX="`pkg-config --variable=prefix cairo`"
 AC_SUBST(GLIB_PREFIX)
 AC_SUBST(ATK_PREFIX)
 AC_SUBST(PANGO_PREFIX)
-AC_SUBST(CAIRO_PREFIX) 
+AC_SUBST(CAIRO_PREFIX)
+
+dnl ****************************************************************************
+dnl GObject Introspection
+dnl ****************************************************************************
+
+GOBJECT_INTROSPECTION_CHECK([0.6.4])
 
 dnl ****************************************************************************
 
@@ -617,14 +623,15 @@ dnl  SUMMARY
 dnl ****************************************************************************
 
 echo "
-PKCS11 Support:          $enable_pkcs11
-PGP Support:		 $enable_pgp
-  GnuPG Version:         $have_gpg
-  GPGME Version:         $have_gpgme
-SSH Support:             $enable_ssh
-Keyserver Support:       $with_keyserver
-  LDAP:                  $with_ldap
-  HKP:                   $enable_hkp
-  Key Sharing:           $enable_sharing
-Notification Support:    $enable_libnotify
+PKCS11 Support:             $enable_pkcs11
+PGP Support:                $enable_pgp
+  GnuPG Version:            $have_gpg
+  GPGME Version:            $have_gpgme
+SSH Support:                $enable_ssh
+Keyserver Support:          $with_keyserver
+  LDAP:                     $with_ldap
+  HKP:                      $enable_hkp
+  Key Sharing:              $enable_sharing
+Notification Support:       $enable_libnotify
+Build introspection data:   ${enable_introspection}
 "
diff --git a/libcryptui/.gitignore b/libcryptui/.gitignore
index b966930..a041876 100644
--- a/libcryptui/.gitignore
+++ b/libcryptui/.gitignore
@@ -8,3 +8,5 @@
 /*.la
 /*.pc
 /*.tab
+/*.gir
+/*.typelib
diff --git a/libcryptui/Makefile.am b/libcryptui/Makefile.am
index 0ed1523..bf30317 100644
--- a/libcryptui/Makefile.am
+++ b/libcryptui/Makefile.am
@@ -41,13 +41,19 @@ cryptui-marshal.c: cryptui-marshal.list $(GLIB_GENMARSHAL)
 
 lib_LTLIBRARIES = libcryptui.la
 
+libcryptui_src = \
+    cryptui.c \
+    cryptui-keyset.c \
+    cryptui-key-store.c \
+    cryptui-key-combo.c \
+    cryptui-key-list.c \
+    cryptui-key-chooser.c
+
 libcryptui_la_SOURCES = \
-    cryptui.h cryptui.c cryptui-defines.h cryptui-priv.h \
-    cryptui-keyset.h cryptui-keyset.c \
-    cryptui-key-store.h cryptui-key-store.c \
-    cryptui-key-combo.h cryptui-key-combo.c \
-    cryptui-key-list.h cryptui-key-list.c \
-    cryptui-key-chooser.h cryptui-key-chooser.c \
+    cryptui-defines.h \
+    cryptui-priv.h \
+    $(inc_HEADERS) \
+    $(libcryptui_src) \
     $(MARSHALLERS)
     
 libcryptui_la_LDFLAGS = \
@@ -85,3 +91,37 @@ CLEANFILES = \
 
 BUILT_SOURCES = \
 	$(MARSHALLERS)
+
+# ------------------------------------------------------------------
+# GObject Introspection
+BUILT_GIRSOURCES =
+
+if HAVE_INTROSPECTION
+CryptUI- LIBCRYPTUI_MAJOR@.gir: $(INTROSPECTION_SCANNER) libcryptui.la
+	$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
+	--namespace CryptUI --nsversion= LIBCRYPTUI_MAJOR@ \
+    --strip-prefix=CryptUI \
+	$(INCLUDES) \
+	--include=Gtk-2.0 \
+	--library=libcryptui.la \
+    --pkg gtk+-2.0 \
+    --output $@ \
+	$(inc_HEADERS) \
+	$(libcryptui_src)
+
+BUILT_GIRSOURCES += CryptUI- LIBCRYPTUI_MAJOR@.gir
+
+# INTROSPECTION_GIRDIR/INTROSPECTION_TYPELIBDIR aren't the right place to
+# install anything - we need to install inside our prefix.
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(BUILT_GIRSOURCES)
+
+typelibsdir = $(libdir)/girepository-1.0/
+
+typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
+
+%.typelib: %.gir $(INTROSPECTION_COMPILER)
+	$(QUIET_GEN)$(DEBUG) $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=. $(INTROSPECTION_COMPILER_OPTS) $< -o $(builddir)/$(@F)
+
+CLEANFILES += $(BUILT_GIRSOURCES) $(typelibs_DATA)
+endif # HAVE_INTROSPECTION
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644
index 0000000..6e2c565
--- /dev/null
+++ b/m4/introspection.m4
@@ -0,0 +1,92 @@
+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`
+    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)
+
+    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]