]> err.no Git - libchamplain/commitdiff
Add GObject introspection
authorTim Horton <hortont424@gmail.com>
Mon, 29 Jun 2009 01:19:19 +0000 (21:19 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 29 Jun 2009 01:19:19 +0000 (21:19 -0400)
.gitignore
AUTHORS
champlain-gtk/Makefile.am
champlain/Makefile.am
configure.ac
m4/introspection.m4 [new file with mode: 0644]

index 6ffb6110c9eb9f1a5fcf3fa9d9fe6aa8bfa2ea67..a887db04daa1ab84e2fd0732843ffb847bc29f76 100644 (file)
@@ -16,6 +16,8 @@ champlain-gtk-uninstalled.pc
 *.lo
 *.la
 *.stamp
+*.gir
+*.typelib
 champlain-gtk/champlain-gtk-marshal.c
 champlain-gtk/champlain-gtk-marshal.h
 champlain/champlain-marshal.c
diff --git a/AUTHORS b/AUTHORS
index 261f51e42c81b56c1543cb52188b5e96aa889585..3abe6cf706c5384a717cec9947200325de4dfc75 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -19,3 +19,4 @@ Victor Godoy Poluceno <victorpoluceno@gmail.com>
 Javier Jardón <javierjc1982@gmail.com>
 Patryk Zawadski <patrys@pld-linux.org>
 Sebastian Reichel <elektranox@gmail.com>
+Tim Horton <hortont424@gmail.com>
index 8a4801c8003a0502a5159c7471a8d91d59a871f3..343c5f107c287b347dc515856d4fc376256b5c65 100644 (file)
@@ -35,3 +35,37 @@ AM_CPPFLAGS = $(GTK_DEPS_CFLAGS) -I$(top_srcdir) -DCHAMPLAIN_GTK_COMPILATION
 AM_LDFLAGS = $(GTK_DEPS_LIBS) -export-symbols-regex ^gtk_champlain_.*
 
 EXTRA_DIST = $(CHAMPLAIN_GTK_MARSHAL_LIST)
+
+if HAVE_INTROSPECTION
+BUILT_GIRSOURCES =
+
+GtkChamplain-0.3.gir: $(INTROSPECTION_SCANNER) libchamplain-gtk-0.3.la
+       $(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
+       --namespace GtkChamplain --nsversion=0.3 \
+       --strip-prefix=GtkChamplain \
+       $(INCLUDES) \
+       --add-include-path=$(srcdir) --add-include=path=. \
+       --c-include="$(libchamplain_include_HEADERS)" \
+       --include=Clutter-0.8 \
+       --include=Gtk-2.0 \
+       --library=champlain-gtk-0.3 \
+       --output $@ \
+       --pkg gobject-2.0 \
+       --pkg gtk+-2.0 \
+       $(libchamplain_gtk_0_3_la_SOURCES) $(libchamplain_include_HEADERS)
+
+BUILT_GIRSOURCES += GtkChamplain-0.3.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
index ebf7726297f89bf82486e1d29e9eabb20e31d05f..e81a29e5f74ec8ac581aa171d5b3808a3a02f4e1 100644 (file)
@@ -153,3 +153,38 @@ champlain-enum-types.c: $(libchamplain_headers) Makefile
                $(libchamplain_headers) ) > xgen-gtc \
        && cp xgen-gtc $(@F) \
        && rm -f xgen-gtc
+
+if HAVE_INTROSPECTION
+BUILT_GIRSOURCES =
+
+Champlain-0.3.gir: $(INTROSPECTION_SCANNER) libchamplain-0.3.la
+       $(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
+       --namespace Champlain --nsversion=0.3 \
+       --strip-prefix=Champlain \
+       $(INCLUDES) \
+       --add-include-path=$(srcdir) --add-include=path=. \
+       --c-include="$(libchamplain_include_HEADERS)" \
+       --include=Clutter-0.8 \
+       --include=Gtk-2.0 \
+       --library=champlain-0.3 \
+       --output $@ \
+       --pkg gobject-2.0 \
+       --pkg gtk+-2.0 \
+       $(libchamplain_0_3_la_SOURCES) $(libchamplain_include_HEADERS)
+
+BUILT_GIRSOURCES += Champlain-0.3.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
+
index b72df993fc5391768a58bf043be7255100a0a5ac..a62e9aa540f0ed7ba1f5667a54e713686cb1949c 100644 (file)
@@ -193,6 +193,7 @@ if test "x$enable_python" = "xyes" -a "x$have_python" != "xyes"; then
 fi
 
 AM_CONDITIONAL(ENABLE_PYTHON, test "x$enable_python" = "xyes")
+GOBJECT_INTROSPECTION_CHECK([0.6.3])
 
 # -----------------------------------------------------------
 AC_CONFIG_FILES([Makefile
@@ -232,6 +233,8 @@ echo "   libsoup-gnome: ${have_soup_gnome}"
 echo "       Gtk+ View: ${enable_gtk}"
 echo ""
 echo "Bindings:"
-echo " champlain-sharp: ${enable_managed}"
-echo " Python bindings: ${enable_python}"
+echo "       champlain-sharp: ${enable_managed}"
+echo "       Python bindings: ${enable_python}"
+echo " gobject-introspection: ${enable_introspection}"
+echo ""
 
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644 (file)
index 0000000..bb3a0da
--- /dev/null
@@ -0,0 +1,88 @@
+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)"
+    fi
+    AC_SUBST(INTROSPECTION_SCANNER)
+    AC_SUBST(INTROSPECTION_COMPILER)
+    AC_SUBST(INTROSPECTION_GENERATE)
+    AC_SUBST(INTROSPECTION_GIRDIR)
+    AC_SUBST(INTROSPECTION_TYPELIBDIR)
+
+    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])
+])