[virt-tools-list] [libosinfo 6/7] Let there be Vala bindings!

Zeeshan Ali (Khattak) zeeshanak at gnome.org
Wed Oct 5 00:36:27 UTC 2011


From: "Zeeshan Ali (Khattak)" <zeeshanak at gnome.org>

Generate Vala bindings if vapigen tool is available, unless explicitly
asked not to.
---
 configure.ac       |   19 +++++++++++++++++++
 osinfo/Makefile.am |   16 +++++++++++++++-
 2 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index eeaad45..da3569d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -93,6 +93,25 @@ if test "x$enable_introspection" != "xno" ; then
 fi
 AM_CONDITIONAL([WITH_GOBJECT_INTROSPECTION], [test "x$enable_introspection" = "xyes"])
 
+if test "x$enable_introspection" = "xyes" ; then
+        AC_ARG_ENABLE([vala],
+                      AS_HELP_STRING([--enable-vala], [enable Vala binding generation]),
+                      [], [enable_vala=check])
+
+        if test "x$enable_vala" != "xno" ; then
+                AC_PATH_PROG(VAPIGEN, vapigen, no)
+                if test "x$VAPIGEN" != "xno"; then
+                        if test "x$enable_vala" == "xcheck" ; then
+                                enable_vala=yes
+                                AC_SUBST(VAPIGEN)
+                        else
+                                AC_MSG_ERROR([Cannot find the "vapigen" binary in your PATH])
+                        fi
+                fi
+        fi
+fi
+AM_CONDITIONAL([WITH_VALA], [test "x$enable_vala" = "xyes"])
+
 AC_ARG_ENABLE([udev],
         AS_HELP_STRING([--enable-udev], [enable Udev support]),
         [], [enable_udev=no])
diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am
index a40fc98..3cffb7b 100644
--- a/osinfo/Makefile.am
+++ b/osinfo/Makefile.am
@@ -128,6 +128,20 @@ typelibs_DATA = Libosinfo-1.0.typelib
 		--includedir=$(girdir) \
 		-o $@ $<
 
-CLEANFILES = $(gir_DATA) $(typelibs_DATA) $(wildcard *.gcno)
+if WITH_VALA
+vapidir = $(datadir)/vala/vapi
+vapi_DATA = libosinfo-1.0.vapi
+
+libosinfo-1.0.vapi: Libosinfo-1.0.gir Libosinfo-1.0.typelib
+	$(AM_V_GEN)$(VAPIGEN) \
+		--vapidir=. \
+		--pkg gobject-2.0 \
+		--pkg gio-2.0 \
+		--library libosinfo-1.0 \
+		Libosinfo-1.0.gir
+
+endif # WITH_VALA
+
+CLEANFILES = $(gir_DATA) $(typelibs_DATA) $(vapi_DATA) $(wildcard *.gcno)
 
 endif # WITH_GOBJECT_INTROSPECTION
-- 
1.7.6.2




More information about the virt-tools-list mailing list