[alsa-devel] [PATCH 05/13] libhinawa: support GObject Introspection for language bindings

Takashi Sakamoto o-takashi at sakamocchi.jp
Sun Jan 25 12:34:26 CET 2015


GObject Introspection is a mechanism to give a metadata of library
to each language bindings. The library should be written by GObject
way.

This commit applies this mechanism to this library to produce language
bindings, thus adds a dependency with:
 - GObject Introspaction 1.32.1 or later

The comments in each methods and signals are important for GObject
Introspection scanner because of a hint to create better metadata.

Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
 libhinawa/README          |  1 +
 libhinawa/configure.ac    |  6 +++++-
 libhinawa/src/Makefile.am | 29 +++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/libhinawa/README b/libhinawa/README
index f6a0650..1bd0d52 100644
--- a/libhinawa/README
+++ b/libhinawa/README
@@ -4,6 +4,7 @@ Requirements
 - GNU libtool 2.2.6 or later
 - Glib 2.32.4 or later
 - GTK-Doc 1.18-2
+- GObject Introspection 1.32.1 or later
 
 How to build
  $ ./autogen.sh
diff --git a/libhinawa/configure.ac b/libhinawa/configure.ac
index 28ca374..b0d9517 100644
--- a/libhinawa/configure.ac
+++ b/libhinawa/configure.ac
@@ -26,7 +26,8 @@ AC_CONFIG_SRCDIR([src])
 AC_CONFIG_HEADERS([config.h])
 
 # Automake 1.13 or later
-AM_INIT_AUTOMAKE([1.10.1])
+# GObject Introspection uses GNU Make-specific functionality.
+AM_INIT_AUTOMAKE([1.10.1  -Wno-portability])
 # Don't output command lines
 AM_SILENT_RULES([yes])
 
@@ -48,6 +49,9 @@ AM_PATH_GLIB_2_0([2.32.4], [], [], [gobject])
 # GTK-Doc 1.18-2 or later
 GTK_DOC_CHECK([1.18-2])
 
+# GObject introspection 1.32.1 or later
+GOBJECT_INTROSPECTION_REQUIRE([1.32.1])
+
 # The files generated from *.in
 AC_CONFIG_FILES([
   Makefile
diff --git a/libhinawa/src/Makefile.am b/libhinawa/src/Makefile.am
index 9eda8f4..d9519ab 100644
--- a/libhinawa/src/Makefile.am
+++ b/libhinawa/src/Makefile.am
@@ -43,3 +43,32 @@ hinawa_sigs_marshal.h: hinawa_sigs_marshal.list
 hinawa_sigs_marshal.c: hinawa_sigs_marshal.list hinawa_sigs_marshal.h
 	$(AM_V_GEN)(echo '#include "hinawa_sigs_marshal.h"';		\
 		glib-genmarshal --body --prefix=hinawa_sigs_marshal $< ) > $@
+
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --warn-all
+INTROSPECTION_COMPILER_ARGS =
+
+if HAVE_INTROSPECTION
+Hinawa-1.0.gir: libhinawa.la
+Hinawa_1_0_gir_PACKAGES =
+Hinawa_1_0_gir_EXPORT_PACKAGES = hinawa
+Hinawa_1_0_gir_INCLUDES = GObject-2.0
+Hinawa_1_0_gir_CFLAGS =
+Hinawa_1_0_gir_LIBS = libhinawa.la
+Hinawa_1_0_gir_FILES = $(libhinawa_la_SOURCES)
+Hinawa_1_0_gir_SCANNERFLAGS =			\
+	--identifier-prefix=Hinawa		\
+	--symbol-prefix=hinawa
+INTROSPECTION_GIRS += Hinawa-1.0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES +=					\
+	$(gir_DATA)				\
+	$(typelib_DATA)
+endif
-- 
2.1.0



More information about the Alsa-devel mailing list