diff options
author | Zeeshan Ali <zeenix@gmail.com> | 2018-05-17 13:25:16 +0000 |
---|---|---|
committer | Zeeshan Ali <zeenix@gmail.com> | 2018-05-17 13:25:16 +0000 |
commit | 02d0628a9dcd264440e2dc0fed1ff18bb1125e5e (patch) | |
tree | 667e88f51ed5d84c2ed082364f3198f70a54a960 | |
parent | 6cf8ac26328977a77e14a18c8b9a6e235bc6c1b8 (diff) | |
parent | 6c7ae431eede9d4dfc84addb39327c3e342cc426 (diff) |
Merge branch 'wip/tintou/vala' into 'master'
Generate .vapi file for Vala support
See merge request geoclue/geoclue!2
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | libgeoclue/Makefile.am | 16 | ||||
-rw-r--r-- | libgeoclue/libgeoclue-2.0.deps | 4 | ||||
-rw-r--r-- | m4/vapigen.m4 | 101 |
4 files changed, 122 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index 12ac43f..2f624d6 100644 --- a/configure.ac +++ b/configure.ac @@ -60,6 +60,7 @@ PKG_CHECK_MODULES(GEOCLUE, [ # GObject-introspection support GOBJECT_INTROSPECTION_CHECK([0.9.6]) +VAPIGEN_CHECK() build_introspection=no # libgeoclue diff --git a/libgeoclue/Makefile.am b/libgeoclue/Makefile.am index b3a9a47..bc79399 100644 --- a/libgeoclue/Makefile.am +++ b/libgeoclue/Makefile.am @@ -121,6 +121,22 @@ Geoclue-2.0.typelib: Geoclue-2.0.gir $(INTROSPECTION_COMPILER) CLEANFILES += $(gir_DATA) $(typelibs_DATA) +if ENABLE_VAPIGEN +-include $(VAPIGEN_MAKEFILE) + +libgeoclue-2.0.vapi: Geoclue-2.0.gir libgeoclue-2.0.deps + +VAPIGEN_VAPIS = libgeoclue-2.0.vapi + +libgeoclue_2_0_vapi_DEPS = glib-2.0 gobject-2.0 gio-2.0 gio-unix-2.0 +libgeoclue_2_0_vapi_FILES = Geoclue-2.0.gir + +vapidir = $(datadir)/vala/vapi +vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps) + +EXTRA_DIST = libgeoclue-2.0.deps +endif + endif # HAVE_INTROSPECTION pkgconfigdir = $(libdir)/pkgconfig diff --git a/libgeoclue/libgeoclue-2.0.deps b/libgeoclue/libgeoclue-2.0.deps new file mode 100644 index 0000000..cd62946 --- /dev/null +++ b/libgeoclue/libgeoclue-2.0.deps @@ -0,0 +1,4 @@ +glib-2.0 +gobject-2.0 +gio-2.0 +gio-unix-2.0 diff --git a/m4/vapigen.m4 b/m4/vapigen.m4 new file mode 100644 index 0000000..2c435e7 --- /dev/null +++ b/m4/vapigen.m4 @@ -0,0 +1,101 @@ +dnl vapigen.m4 +dnl +dnl Copyright 2012 Evan Nemerson +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 + +# VAPIGEN_CHECK([VERSION], [API_VERSION], [FOUND_INTROSPECTION], [DEFAULT]) +# -------------------------------------- +# Check vapigen existence and version +# +# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation +AC_DEFUN([VAPIGEN_CHECK], +[ + AS_IF([test "x$3" != "xyes"], [ + m4_provide_if([GOBJECT_INTROSPECTION_CHECK], [], [ + m4_provide_if([GOBJECT_INTROSPECTION_REQUIRE], [], [ + AC_MSG_ERROR([[You must call GOBJECT_INTROSPECTION_CHECK or GOBJECT_INTROSPECTION_REQUIRE before using VAPIGEN_CHECK unless using the FOUND_INTROSPECTION argument is "yes"]]) + ]) + ]) + ]) + + AC_ARG_ENABLE([vala], + [AS_HELP_STRING([--enable-vala[=@<:@no/auto/yes@:>@]],[build Vala bindings @<:@default=]ifelse($4,,auto,$4)[@:>@])],,[ + AS_IF([test "x$4" = "x"], [ + enable_vala=auto + ], [ + enable_vala=$4 + ]) + ]) + + AS_CASE([$enable_vala], [no], [enable_vala=no], + [yes], [ + AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [ + AC_MSG_ERROR([Vala bindings require GObject Introspection]) + ]) + ], [auto], [ + AS_IF([test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [ + enable_vala=no + ]) + ], [ + AC_MSG_ERROR([Invalid argument passed to --enable-vala, should be one of @<:@no/auto/yes@:>@]) + ]) + + AS_IF([test "x$2" = "x"], [ + vapigen_pkg_name=vapigen + ], [ + vapigen_pkg_name=vapigen-$2 + ]) + AS_IF([test "x$1" = "x"], [ + vapigen_pkg="$vapigen_pkg_name" + ], [ + vapigen_pkg="$vapigen_pkg_name >= $1" + ]) + + PKG_PROG_PKG_CONFIG + + PKG_CHECK_EXISTS([$vapigen_pkg], [ + AS_IF([test "$enable_vala" = "auto"], [ + enable_vala=yes + ]) + ], [ + AS_CASE([$enable_vala], [yes], [ + AC_MSG_ERROR([$vapigen_pkg not found]) + ], [auto], [ + enable_vala=no + ]) + ]) + + AC_MSG_CHECKING([for vapigen]) + + AS_CASE([$enable_vala], + [yes], [ + VAPIGEN=`$PKG_CONFIG --variable=vapigen $vapigen_pkg_name` + VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir $vapigen_pkg_name`/vala/Makefile.vapigen + AS_IF([test "x$2" = "x"], [ + VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir $vapigen_pkg_name` + ], [ + VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned $vapigen_pkg_name` + ]) + ]) + + AC_MSG_RESULT([$enable_vala]) + + AC_SUBST([VAPIGEN]) + AC_SUBST([VAPIGEN_VAPIDIR]) + AC_SUBST([VAPIGEN_MAKEFILE]) + + AM_CONDITIONAL(ENABLE_VAPIGEN, test "x$enable_vala" = "xyes") +]) |