[libsocialweb] introspection: Add basic support for gobject-introspection
- From: Ross Burton <rburton src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libsocialweb] introspection: Add basic support for gobject-introspection
- Date: Wed, 9 Mar 2011 23:30:31 +0000 (UTC)
commit 01830635cc0aaf48ab70c0043e5350d6af4c8189
Author: Marco Barisione <marco barisione org>
Date: Wed Oct 27 12:06:45 2010 +0100
introspection: Add basic support for gobject-introspection
.gitignore | 2 +
configure.ac | 3 +
libsocialweb-client/Makefile.am | 51 +++++++++++++++++++++-
m4/Makefile.am | 2 +
m4/introspection.m4 | 88 +++++++++++++++++++++++++++++++++++++++
5 files changed, 143 insertions(+), 3 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 13a594a..f0f9b37 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,8 @@ tests/test-upload
interfaces/*-ginterface.[ch]
*-bindings.h
*-marshals.[ch]
+*.gir
+*.typelib
test-runner
intltool-*
po/POTFILES
diff --git a/configure.ac b/configure.ac
index 6d1900f..489237f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,6 +60,8 @@ GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
# only check if gtk-doc is enabled
AS_IF([test "x$enable_gtk_doc" = "xyes"], [AC_CHECK_PROGS(XSLT, [xsltproc])])
+GOBJECT_INTROSPECTION_CHECK([0.9.6])
+
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.14)
PKG_CHECK_MODULES(GIO, gio-2.0)
PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= 2.14)
@@ -174,6 +176,7 @@ AC_SUBST([GCOV_LDFLAGS])
AC_OUTPUT([
Makefile
+ m4/Makefile
docs/Makefile
docs/libsocialweb/Makefile
docs/libsocialweb-client/Makefile
diff --git a/libsocialweb-client/Makefile.am b/libsocialweb-client/Makefile.am
index 77e5417..4c097bc 100644
--- a/libsocialweb-client/Makefile.am
+++ b/libsocialweb-client/Makefile.am
@@ -1,3 +1,5 @@
+CLEANFILES =
+
lib_LTLIBRARIES = libsocialweb-client.la
libsocialweb_client_ladir = $(includedir)/libsocialweb/libsocialweb-client
@@ -7,10 +9,53 @@ libsocialweb_client_la_LDFLAGS = -version-info $(LIBSOCIALWEB_CLIENT_CURRENT):$(
libsocialweb_client_la_HEADERS = sw-client.h \
sw-item.h sw-client-service.h \
sw-client-lastfm.h sw-client-item-view.h
-libsocialweb_client_la_SOURCES = sw-client.c \
+HANDWRITTED_C_SOURCES = sw-client.c \
sw-item.c sw-client-service.c \
- sw-client-service-private.h \
sw-client-lastfm.c \
- sw-client-item-view.c \
+ sw-client-item-view.c
+PRIVATE_H_SOURCES = sw-client-service-private.h
+libsocialweb_client_la_SOURCES = $(HANDWRITTED_C_SOURCES) \
+ $(PRIVATE_H_SOURCES) \
$(libsocialweb_client_la_HEADERS) \
$(BUILT_SOURCES)
+
+if HAVE_INTROSPECTION
+
+INTROSPECTION_FILES = $(HANDWRITTED_C_SOURCES) \
+ $(libsocialweb_client_la_HEADERS)
+
+SocialWebClient-0.25.gir: $(INTROSPECTION_SCANNER) \
+ $(INTROSPECTION_FILES) \
+ libsocialweb-client.la
+ $(AM_V_GEN)$(INTROSPECTION_SCANNER) -v \
+ --namespace SocialWebClient \
+ --nsversion=0.25 \
+ --identifier-prefix=Sw \
+ -I$(top_builddir) \
+ -I$(top_srcdir) \
+ --include=GLib-2.0 \
+ --include=Gio-2.0 \
+ --libtool="$(top_builddir)/libtool" \
+ --library=libsocialweb-client.la \
+ --warn-all \
+ --output $@ \
+ $(INTROSPECTION_FILES)
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = SocialWebClient-0.25.gir
+
+%.typelib: %.gir $(INTROSPECTION_COMPILER)
+ $(AM_V_GEN)$(top_builddir)/libtool --mode=execute \
+ $(INTROSPECTION_COMPILER) \
+ --includedir=$(srcdir) \
+ --includedir=. \
+ $(INTROSPECTION_COMPILER_OPTS) $< -o $(@F)
+
+typelibsdir = $(libdir)/girepository-1.0/
+typelibs_DATA = $(gir_DATA:.gir=.typelib)
+
+CLEANFILES += \
+ $(gir_DATA) \
+ $(typelibs_DATA)
+
+endif # if HAVE_INTROSPECTION
diff --git a/m4/Makefile.am b/m4/Makefile.am
new file mode 100644
index 0000000..e95f155
--- /dev/null
+++ b/m4/Makefile.am
@@ -0,0 +1,2 @@
+EXTRA_DIST = \
+introspection.m4
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]