From: Jens Georg Date: Thu, 23 Feb 2012 12:02:44 +0000 (+0200) Subject: Create vapi file from introspection X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ea8f8848d245863deb6b40c8efea8f9fed37f83;p=profile%2Fivi%2FGSSDP.git Create vapi file from introspection The skipping of the error-domain in .metadata and the -custom.vala file are necessary due to https://bugzilla.gnome.org/show_bug.cgi?id=670673. They can be removed once that is fixed https://bugzilla.gnome.org/show_bug.cgi?id=675355 --- diff --git a/Makefile.am b/Makefile.am index ed3a9f4..057a9b2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4,7 +4,7 @@ else TOOLS_DIR = endif -SUBDIRS = libgssdp $(TOOLS_DIR) tests doc +SUBDIRS = libgssdp $(TOOLS_DIR) tests doc vala ACLOCAL_AMFLAGS=${ACLOCAL_FLAGS} -I m4 diff --git a/configure.ac b/configure.ac index 1c48a0a..a6a1419 100644 --- a/configure.ac +++ b/configure.ac @@ -73,6 +73,16 @@ if test "x$enable_debug" = "xyes"; then fi GOBJECT_INTROSPECTION_CHECK([0.6.7]) + +# vapigen +AS_IF([test "x$found_introspection" = "xyes"], + [ + VALA_PROG_VAPIGEN([0.14]) + ] +) +AM_CONDITIONAL([HAVE_VAPIGEN], [test "x$VAPIGEN" != "x"]) + + dnl Check for Win32 AC_MSG_CHECKING([for Win32]) case "$host" in @@ -94,6 +104,7 @@ libgssdp/Makefile tools/Makefile tests/Makefile tests/gtest/Makefile +vala/Makefile doc/Makefile doc/version.xml gssdp-1.0.pc diff --git a/m4/vapigen.m4 b/m4/vapigen.m4 new file mode 100644 index 0000000..d8c86f6 --- /dev/null +++ b/m4/vapigen.m4 @@ -0,0 +1,41 @@ + +dnl vala.m4 +dnl +dnl Copyright 2010 Marc-Andre Lureau +dnl Copyright 2011 Rodney Dawes +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License, or (at your option) any later version. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +dnl dropped everything but VALA_PROG_VAPIGEN - Jens Georg + +# Check whether the Vala API Generator exists in `PATH'. If it is found, +# the variable VAPIGEN is set. Optionally a minimum release number of the +# generator can be requested. +# +# VALA_PROG_VAPIGEN([MINIMUM-VERSION]) +# ------------------------------------ +AC_DEFUN([VALA_PROG_VAPIGEN], +[AC_PATH_PROG([VAPIGEN], [vapigen], []) + AS_IF([test -z "$VAPIGEN"], + [AC_MSG_WARN([No Vala API Generator found. You will not be able to generate .vapi files.])], + [AS_IF([test -n "$1"], + [AC_MSG_CHECKING([$VAPIGEN is at least version $1]) + am__vapigen_version=`$VAPIGEN --version | sed 's/Vala API Generator *//'` + AS_VERSION_COMPARE([$1], ["$am__vapigen_version"], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Vala API Generator $1 not found.])])])]) +]) diff --git a/vala/GSSDP-1.0.metadata b/vala/GSSDP-1.0.metadata new file mode 100644 index 0000000..d765a74 --- /dev/null +++ b/vala/GSSDP-1.0.metadata @@ -0,0 +1,3 @@ +GSSDP cheader_filename="libgssdp/gssdp.h" +error_quark skip +Error skip diff --git a/vala/Makefile.am b/vala/Makefile.am new file mode 100644 index 0000000..c089e52 --- /dev/null +++ b/vala/Makefile.am @@ -0,0 +1,20 @@ +if HAVE_INTROSPECTION +if HAVE_VAPIGEN +gssdp-1.0.vapi: gssdp-1.0.stamp + @true + +gssdp-1.0.stamp: $(top_builddir)/libgssdp/GSSDP-1.0.gir \ + $(srcdir)/GSSDP-1.0.metadata \ + $(srcdir)/gssdp-1.0-custom.vala + $(AM_V_GEN)$(VAPIGEN) --metadatadir=$(srcdir) \ + --library=gssdp-1.0 --pkg=gio-2.0 \ + $(top_builddir)/libgssdp/GSSDP-1.0.gir \ + $(srcdir)/gssdp-1.0-custom.vala && \ + echo timestmap > $(@F) + +vapidir = $(datadir)/vala/vapi +vapi_DATA = gssdp-1.0.vapi $(srcdir)/gssdp-1.0.deps +CLEANFILES = gssdp-1.0.vapi gssdp-1.0.stamp +EXTRA_DIST = GSSDP-1.0.metadata gssdp-1.0-custom.vala +endif +endif diff --git a/vala/gssdp-1.0-custom.vala b/vala/gssdp-1.0-custom.vala new file mode 100644 index 0000000..04cd619 --- /dev/null +++ b/vala/gssdp-1.0-custom.vala @@ -0,0 +1,9 @@ +// Work-around gnome bug 670673; remove once fixed +namespace GSSDP { +[CCode (cheader_filename = "libgssdp/gssdp.h", cprefix = "GSSDP_ERROR_")] + public errordomain Error { + NO_IP_ADDRESS, + FAILED; + public static GLib.Quark quark (); + } +} diff --git a/vala/gssdp-1.0.deps b/vala/gssdp-1.0.deps new file mode 100644 index 0000000..cd10dfd --- /dev/null +++ b/vala/gssdp-1.0.deps @@ -0,0 +1 @@ +gio-2.0