[gnome-games] [libgames-support] Copy in Clutter's introspection-building code



commit a913d9762a852abdf75701c8fe499b67e6a9e92c
Author: Tim Horton <hortont svn gnome org>
Date:   Thu Jun 11 03:20:27 2009 -0400

    [libgames-support] Copy in Clutter's introspection-building code
    
    We currently only search /usr/include/ggz*.h for GGZ headers; this is
    absolutely not portable and must be fixed. However, I'm not yet sure
    how to find the ggz headers properly. Alternatively, we could build
    introspection data for the various parts of GGZ instead.

 configure.in                 |    2 +
 libgames-support/Makefile.am |   32 +++++++++++++++
 m4/introspection.m4          |   88 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 122 insertions(+), 0 deletions(-)
---
diff --git a/configure.in b/configure.in
index d43ba53..e85db00 100644
--- a/configure.in
+++ b/configure.in
@@ -1157,6 +1157,7 @@ AC_SUBST([AM_LDFLAGS])
 ##############################################
 
 SHAVE_INIT([],[enable])
+GOBJECT_INTROSPECTION_CHECK([0.6.3])
 
 AC_CONFIG_FILES([
 Makefile
@@ -1298,6 +1299,7 @@ echo "
     Scores & setgid group: ${scores_group}
     Tests enabled:         ${enable_tests}
     Binreloc:              ${enable_binreloc}
+    Introspection data:    ${enable_introspection}
 "
 
 if grep "$scores_group:" /etc/group > /dev/null; then
diff --git a/libgames-support/Makefile.am b/libgames-support/Makefile.am
index e846679..a1da4ad 100644
--- a/libgames-support/Makefile.am
+++ b/libgames-support/Makefile.am
@@ -348,3 +348,35 @@ games-marshal.h: stamp-games-marshal.h
 stamp-games-marshal.h: games-marshal.list Makefile
 	$(GLIB_GENMARSHAL) --prefix=games_marshal $< --header $(GLIB_GENMARSHAL_INTERNAL) > games-marshal.h \
 	&& echo timestamp > $(@F)
+
+if HAVE_INTROSPECTION
+BUILT_GIRSOURCES =
+
+GnomeGamesSupport-1.0.gir: $(INTROSPECTION_SCANNER) libgames-support.la
+	$(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
+	--namespace GnomeGamesSupport --nsversion=1.0 \
+	$(INCLUDES) \
+	--add-include-path=$(srcdir) --add-include=path=. \
+	--include=Clutter-0.9 \
+	--include=Gtk-2.0 \
+	--library=games-support \
+	--output $@ \
+	--pkg gobject-2.0 \
+	--pkg gtk+-2.0 \
+	$(libgames_support_la_SOURCES)
+
+BUILT_GIRSOURCES += GnomeGamesSupport-1.0.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
diff --git a/m4/introspection.m4 b/m4/introspection.m4
new file mode 100644
index 0000000..bb3a0da
--- /dev/null
+++ b/m4/introspection.m4
@@ -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])
+])



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]