summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-05-11 18:04:36 +0100
committerEmmanuele Bassi <ebassi@linux.intel.com>2009-05-11 18:04:36 +0100
commit89bf3ebf4a5bd8a666ff94d81061f1209c5d53d9 (patch)
treed76178475f768fe9d8319c64b02f8610af9fd660
parent7209f24a26e26bf674ffaf391b7ca223816fd143 (diff)
downloadclutter-gtk-89bf3ebf4a5bd8a666ff94d81061f1209c5d53d9.tar.gz
Build GObject introspection data for clutter-gtk
Generate the GIR and the typelib for Clutter-GTK using the GObject-Introspection scanner and compiler, respectively. Original patch by: Colin Walters <walters@verbum.org> Patch updated by: Brian Cameron <brian.cameron@sun.com> Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
-rw-r--r--.gitignore2
-rw-r--r--Makefile.am2
-rw-r--r--build/autotools/Makefile.am2
-rw-r--r--build/autotools/introspection.m488
-rw-r--r--build/autotools/shave-libtool.in8
-rw-r--r--clutter-gtk/Makefile.am36
-rw-r--r--configure.ac3
7 files changed, 137 insertions, 4 deletions
diff --git a/.gitignore b/.gitignore
index b49e249..b02f716 100644
--- a/.gitignore
+++ b/.gitignore
@@ -46,3 +46,5 @@ libtool
ltmain.sh
missing
stamp-h1
+/clutter-gtk/GtkClutter-*.gir
+/clutter-gtk/GtkClutter-*.typelib
diff --git a/Makefile.am b/Makefile.am
index e84e9d7..61273df 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -16,7 +16,7 @@ CLEANFILES = clutter-gtk-0.9.pc
DISTCLEANFILES = clutter-gtk.pc
-EXTRA_DIST = clutter-gtk.pc.in
+EXTRA_DIST = clutter-gtk.pc.in introspection.m4
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --enable-maintainer-flags
diff --git a/build/autotools/Makefile.am b/build/autotools/Makefile.am
index a17717f..8b1268d 100644
--- a/build/autotools/Makefile.am
+++ b/build/autotools/Makefile.am
@@ -1,3 +1,3 @@
-EXTRA_DIST = shave-libtool.in shave.in shave.m4
+EXTRA_DIST = shave-libtool.in shave.in shave.m4 introspection.m4
DISTCLEANFILES = shave-libtool shave
diff --git a/build/autotools/introspection.m4 b/build/autotools/introspection.m4
new file mode 100644
index 0000000..bb3a0da
--- /dev/null
+++ b/build/autotools/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])
+])
diff --git a/build/autotools/shave-libtool.in b/build/autotools/shave-libtool.in
index 1f3a720..7b3d63f 100644
--- a/build/autotools/shave-libtool.in
+++ b/build/autotools/shave-libtool.in
@@ -11,8 +11,12 @@ lt_unmangle ()
last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'`
}
-# the real libtool to use
-LIBTOOL="$1"
+tempval=`echo $1 | sed s/\'//g`
+if test "x$tempval" = "x$SHELL"; then
+ shift
+fi
+tempval=`echo $1 | sed s/\'//g`
+LIBTOOL="$tempval"
shift
# if 1, don't print anything, the underlaying wrapper will do it
diff --git a/clutter-gtk/Makefile.am b/clutter-gtk/Makefile.am
index b4ade95..7a9e66f 100644
--- a/clutter-gtk/Makefile.am
+++ b/clutter-gtk/Makefile.am
@@ -1,6 +1,8 @@
+CLEANFILES=
INCLUDES = \
-I$(srcdir) \
-I$(top_srcdir) \
+ $(CLUTTER_CFLAGS) \
-DG_LOG_DOMAIN=\"Clutter-Gtk\" \
-DPREFIX=\""$(prefix)"\" \
-DLIBDIR=\""$(libdir)"\" \
@@ -39,3 +41,37 @@ cluttergtkheaders_HEADERS = \
gtk-clutter-scrollable.h \
gtk-clutter-util.h \
gtk-clutter-viewport.h
+
+if HAVE_INTROSPECTION
+BUILT_GIRSOURCES =
+
+GtkClutter-@CLUTTER_GTK_API_VERSION@.gir: $(INTROSPECTION_SCANNER) libclutter-gtk-0.9.la
+ $(QUIET_GEN)$(INTROSPECTION_SCANNER) -v \
+ --namespace GtkClutter --nsversion=@CLUTTER_GTK_API_VERSION@ \
+ $(INCLUDES) \
+ --add-include-path=$(srcdir) --add-include=path=. \
+ --include=Clutter-@CLUTTER_GTK_API_VERSION@ \
+ --include=Gtk-2.0 \
+ --library=clutter-gtk-@CLUTTER_GTK_API_VERSION@ \
+ --output $@ \
+ --pkg gobject-2.0 \
+ --pkg clutter-@CLUTTER_GTK_API_VERSION@ \
+ --pkg gtk+-2.0 \
+ $(cluttergtkheaders_HEADERS) \
+ $(libclutter_gtk_0_9_la_SOURCES)
+
+BUILT_GIRSOURCES += GtkClutter-@CLUTTER_GTK_API_VERSION@.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/configure.ac b/configure.ac
index 7cdf174..d20530f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -153,6 +153,8 @@ AC_SUBST(CLUTTER_PREFIX)
GTK_DOC_CHECK([1.11])
+GOBJECT_INTROSPECTION_CHECK([0.6.3])
+
dnl ========================================================================
SHAVE_INIT([build/autotools], [enable])
@@ -185,4 +187,5 @@ echo " Flavour: ${CLUTTER_GTK_FLAVOUR}"
echo " Debug level: ${enable_debug}"
echo " Documentation: ${enable_gtk_doc}"
echo " Compiler flags: $MAINTAINER_CFLAGS"
+echo " Introspection data: ${enable_introspection}"
echo ""