[PATCH 1/3] Build introspection for python use

Andrew Bird ajb at spheresystems.co.uk
Wed Nov 14 08:23:54 PST 2012


This patch enables building of the introspection info
so that libqmi may be used from python. After buildng and
installing, the library may be imported into python by:

from gi.repository import libqmi

Signed-off-by: Andrew Bird <ajb at spheresystems.co.uk>
---
 Makefile.am             |  1 +
 configure.ac            |  1 +
 libqmi-glib/Makefile.am | 28 ++++++++++++++++++++++++++++
 3 files changed, 30 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index aba56b3..6e8161c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,5 +4,6 @@ SUBDIRS = . data build-aux libqmi-glib cli utils docs
 ACLOCAL_AMFLAGS = -I m4
 
 DISTCHECK_CONFIGURE_FLAGS = \
+	--enable-introspection \
 	--with-tests=yes \
 	--with-docs=yes
diff --git a/configure.ac b/configure.ac
index 676c509..18ded4f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,6 +18,7 @@ dnl Required programs
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_INSTALL
+GOBJECT_INTROSPECTION_CHECK([1.30.0])
 
 dnl Initialize libtool
 LT_PREREQ([2.2])
diff --git a/libqmi-glib/Makefile.am b/libqmi-glib/Makefile.am
index 50c49f6..e0de398 100644
--- a/libqmi-glib/Makefile.am
+++ b/libqmi-glib/Makefile.am
@@ -46,3 +46,31 @@ include_HEADERS = \
 	qmi-message.h \
 	qmi-device.h \
 	qmi-client.h
+
+CLEANFILES=
+
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+if HAVE_INTROSPECTION
+
+libqmi-glib.gir: $(lib_LTLIBRARIES)
+libqmi_glib_gir_INCLUDES = Gio-2.0 GLib-2.0 GObject-2.0
+libqmi_glib_gir_PACKAGES = gio-2.0 glib-2.0 gobject-2.0
+libqmi_glib_gir_CFLAGS = $(INCLUDES) -I$(top_srcdir) -I$(top_srcdir)/libqmi-glib -I$(top_srcdir)/libqmi-glib/generated
+libqmi_glib_gir_LIBS = $(lib_LTLIBRARIES)
+libqmi_glib_gir_FILES = $(libqmi_glib_la_SOURCES)
+libqmi_glib_gir_SCANNERFLAGS = --warn-all --identifier-prefix=Qmi --symbol-prefix=qmi_
+INTROSPECTION_GIRS += libqmi-glib.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
-- 
1.7.11.7



More information about the libqmi-devel mailing list