[Spice-devel] [PATCH] Add vapi bindings generation

Marc-André Lureau marcandre.lureau at gmail.com
Tue Oct 25 13:19:18 PDT 2011


---
 Makefile.am      |    2 +-
 configure.ac     |    8 ++++++++
 vapi/Makefile.am |   32 ++++++++++++++++++++++++++++++++
 3 files changed, 41 insertions(+), 1 deletions(-)
 create mode 100644 vapi/Makefile.am

diff --git a/Makefile.am b/Makefile.am
index 84a022c..9825349 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
 ACLOCAL_AMFLAGS = -I m4
 NULL =
 
-SUBDIRS = common gtk po python_modules doc data
+SUBDIRS = common gtk po python_modules doc data vapi
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA =					\
diff --git a/configure.ac b/configure.ac
index 4550c8d..09d97bc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -387,8 +387,15 @@ VALA_REQUIRED=0.11.7
 if test x$enable_vala = xyes ; then
     # check for vala
     AM_PROG_VALAC([$VALA_REQUIRED])
+    AC_PATH_PROG(VAPIGEN, vapigen, no)
+    if test "x$VAPIGEN" == "xno"; then
+        AC_MSG_ERROR([Cannot find the "vapigen" binary in your PATH])
+    fi
+    AC_SUBST(VAPIGEN)
 fi
 
+AM_CONDITIONAL(WITH_VALA, [test "x$enable_vala" = "xyes"])
+
 VAPIDIR="${datadir}/vala/vapi"
 AC_SUBST(VAPIDIR)
 
@@ -544,6 +551,7 @@ gtk/Makefile
 gtk/controller/Makefile
 doc/Makefile
 doc/reference/Makefile
+vapi/Makefile
 ])
 
 dnl ==========================================================================
diff --git a/vapi/Makefile.am b/vapi/Makefile.am
new file mode 100644
index 0000000..330c2a2
--- /dev/null
+++ b/vapi/Makefile.am
@@ -0,0 +1,32 @@
+NULL =
+
+if WITH_VALA
+vapidir = $(datadir)/vala/vapi
+vapi_DATA =						\
+	spice-client-glib-2.0.vapi			\
+	spice-client-gtk-$(SPICE_GTK_API_VERSION).deps	\
+	spice-client-gtk-$(SPICE_GTK_API_VERSION).vapi	\
+	$(NULL)
+
+spice-client-glib-2.0.vapi: $(top_builddir)/gtk/SpiceClientGLib-2.0.gir
+	$(AM_V_GEN)$(VAPIGEN)			\
+		--library spice-client-glib-2.0	\
+		$<
+
+spice-client-gtk-$(SPICE_GTK_API_VERSION).vapi: $(top_builddir)/gtk/SpiceClientGtk-$(SPICE_GTK_API_VERSION).gir spice-client-glib-2.0.vapi
+	$(AM_V_GEN)$(VAPIGEN)						\
+		--vapidir=$(builddir)					\
+		--pkg spice-client-glib-2.0				\
+		--pkg gtk+-$(GTK_API_VERSION)				\
+		--library spice-client-gtk-$(SPICE_GTK_API_VERSION)	\
+		$<
+
+spice-client-gtk-$(SPICE_GTK_API_VERSION).deps: spice-client-gtk-$(SPICE_GTK_API_VERSION).vapi
+	@echo "spice-client-glib-2.0" > $@
+	@echo "gtk+-$(GTK_API_VERSION)" >> $@
+
+endif
+
+CLEANFILES = $(vapi_DATA)
+
+-include $(top_srcdir)/git.mk
-- 
1.7.6.2



More information about the Spice-devel mailing list