summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Espinosa <esodan@gmail.com>2015-02-04 11:46:30 -0600
committerDaniel Espinosa <esodan@gmail.com>2015-02-04 11:46:30 -0600
commitc3eb2f884d9cd141b9df0c41e8c362fce68e5664 (patch)
treef8f5492784531d49b6b330cf5a1ede50aff974e4
parent28b4e579bbaa1e573a831de98ad9c8ae1c9e3238 (diff)
downloadlibsoup-c3eb2f884d9cd141b9df0c41e8c362fce68e5664.tar.gz
Adding Vala bindings build upstream
-rw-r--r--configure.ac6
-rw-r--r--libsoup/Makefile.am12
-rw-r--r--libsoup/Soup-2.4.metadata4
-rw-r--r--m4/vapigen.m4177
4 files changed, 198 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index eb3e29cc..e8e2ca44 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5,6 +5,8 @@ dnl *******************************************
m4_define([soup_major_version], [2])
m4_define([soup_minor_version], [49])
m4_define([soup_micro_version], [1])
+AC_CONFIG_MACRO_DIR([m4])
+m4_include(m4/vapigen.m4)
AC_PREREQ(2.63)
AC_INIT([libsoup],[soup_major_version.soup_minor_version.soup_micro_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=libsoup])
@@ -162,6 +164,10 @@ dnl *** gobject-introspection ***
dnl *****************************
GOBJECT_INTROSPECTION_CHECK([0.9.5])
+if test "x$found_introspection" = "xyes"; then
+ VAPIGEN_CHECK()
+fi
+
AC_MSG_CHECKING([for glib-networking (glib TLS implementation)])
save_CFLAGS="$CFLAGS"
save_LIBS="$LIBS"
diff --git a/libsoup/Makefile.am b/libsoup/Makefile.am
index 431c99ee..65ce5e95 100644
--- a/libsoup/Makefile.am
+++ b/libsoup/Makefile.am
@@ -1,6 +1,7 @@
## Process this file with automake to produce Makefile.in
EXTRA_DIST =
+CLEANFILES =
include $(GLIB_MAKEFILE)
@@ -265,6 +266,15 @@ Soup_2_4_gir_FILES = \
INTROSPECTION_GIRS += Soup-2.4.gir
+if ENABLE_VAPIGEN
+libsoup-2.4.vapi: Soup-2.4.gir
+ $(VAPIGEN) --metadatadir=$(top_srcdir)/libsoup --pkg gio-2.0 --library=libsoup-2.4 $^
+
+vapidir=$(VAPIDIR)
+vapi_DATA=libsoup-2.4.vapi
+CLEANFILES += $(vapi_DATA)
+endif
+
if BUILD_LIBSOUP_GNOME
# GNOME extensions
@@ -292,7 +302,7 @@ gir_DATA = $(INTROSPECTION_GIRS)
typelibdir = $(libdir)/girepository-1.0
typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
-CLEANFILES = $(gir_DATA) $(typelib_DATA) $(BUILT_SOURCES)
+CLEANFILES += $(gir_DATA) $(typelib_DATA) $(BUILT_SOURCES)
endif
diff --git a/libsoup/Soup-2.4.metadata b/libsoup/Soup-2.4.metadata
new file mode 100644
index 00000000..90970227
--- /dev/null
+++ b/libsoup/Soup-2.4.metadata
@@ -0,0 +1,4 @@
+
+AuthDomain
+ .accepts#virtual_method abstract name="_accepts"
+ .challenge#virtual_method abstract name="_challenge"
diff --git a/m4/vapigen.m4 b/m4/vapigen.m4
new file mode 100644
index 00000000..7a0f1b8f
--- /dev/null
+++ b/m4/vapigen.m4
@@ -0,0 +1,177 @@
+dnl vapigen.m4
+dnl
+dnl Copyright 2012 Evan Nemerson, Daniel Espinosa
+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. GObject Introspection is required, then
+# set FOUND-INTROSPECTION to [yes] or use call GOBJECT_INTROSPECTION_CHECK or
+# GOBJECT_INTROSPECTION_REQUIRE. This is an internal macro, use VAPIGEN_CHECK,
+# VAPIGEN_GI_CHECK or VAPIGEN_GI_REQUIRE.
+#
+# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
+m4_define([_VAPIGEN_CHECK_INTERNAL],
+[
+ AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+ AC_REQUIRE([AM_PROG_VALAC])
+ 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_IF([ test "x$enable_vala" = "xyes" -o "x$enable_vala" = "xauto"],
+ [
+ AS_IF([ test "x$3" != "xyes" -a "x$found_introspection" != "xyes"], [
+ AC_MSG_ERROR([Vala bindings require GObject Introspection])
+ ])
+ ], [
+ AS_IF([ test "x$enable_vala" != "no"],[
+ vapigen_pkg_found=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"
+ ])
+ AS_IF([ test "x$enable_vala" = "xyes" -o "x$enable_vala" = "xauto"], [
+ AC_MSG_CHECKING([for vapigen $vapigen_pkg_name])
+ PKG_CHECK_EXISTS([ $vapigen_pkg ], [
+ vapigen_pkg_found=yes
+ ], [
+ vapigen_pkg_found=no
+ AC_MSG_RESULT([no])
+ AC_MSG_NOTICE([Searching for $vapigen_pkg_name program...])
+ AC_PATH_PROG(VAPIGEN, [$vapigen_pkg_name], [no])
+ if test "x$VAPIGEN" = "xno"
+ then
+ check_prog=no
+ else
+ check_prog=yes
+ fi
+ ])
+
+ AS_CASE([$vapigen_pkg_found],
+ [yes], [
+ VAPIGEN=`$PKG_CONFIG --variable=vapigen vapigen`
+ VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir vapigen`/vala/Makefile.vapigen
+ VAPIDIR=`$PKG_CONFIG --variable=vapidir vapigen`
+ AS_IF([ test "x$2" = "x"], [
+ VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir vapigen`
+ ], [
+ VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned vapigen`
+ ])
+ ],
+ [no], [
+ AS_CASE([$check_prog],[no],[
+ AC_MSG_ERROR([Can't locate $vapigen_pkg program])
+ ], [yes], [
+ AS_IF([ test "x$2" = "x"], [
+ vala_pkg_name=libvala
+ ], [
+ vala_pkg_name=libvala-$2
+ ])
+ AS_IF([ test "x$1" = "x"], [
+ vala_pkg="$vala_pkg_name"
+ ], [
+ vala_pkg="$vala_pkg_name >= $1"
+ ])
+ AC_MSG_CHECKING([for $vala_pkg])
+ PKG_CHECK_EXISTS([$vala_pkg], [
+ VALA_DATADIR=`pkg-config $vala_pkg --variable=datadir`
+ VAPIDIR="$VALA_DATADIR/vala/vapi"
+ VAPIGEN_MAKEFILE="$VALA_DATADIR/vala/Makefile.vapigen"
+ AS_IF([ test "x$2" = "x"], [
+ VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir vapigen`
+ ], [
+ VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned vapigen`
+ ])
+ vapigen_pkg_found=yes
+ ], [
+ AS_CASE([$enable_vala], [yes], [
+ AC_MSG_ERROR([$vala_pkg not found])
+ ], [auto], [
+ vapigen_pkg_found=no
+ ])
+ ])
+ ])
+ ])
+
+ AC_MSG_RESULT([$vapigen_pkg_found])
+
+
+ ])
+ AC_SUBST([VAPIGEN])
+ AC_SUBST([VAPIGEN_VAPIDIR])
+ AC_SUBST([VAPIDIR])
+ AC_SUBST([VAPIGEN_MAKEFILE])
+
+ AM_CONDITIONAL(ENABLE_VAPIGEN, test "x$vapigen_pkg_found" = "xyes")
+])
+
+dnl Check VAPIGEN
+# VAPIGEN_CHECK([VERSION], [API_VERSION], [FOUND-INTROSPECTION], [DEFAULT])
+# --------------------------------------
+# Check vapigen existence and version. Set FOUND-INTROSPECTION to [yes]
+# if you have detected GObject Introspection without GOBJECT_INTROSPECTION_CHECK
+# or GOBJECT_INTROSPECTION_REQUIRE macros.
+#
+# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
+AC_DEFUN([VAPIGEN_CHECK],
+[
+ _VAPIGEN_CHECK_INTERNAL($1,$2,$3,$4)
+]
+)
+
+dnl usage:
+# VAPIGEN_GI_CHECK([VERSION], [API_VERSION], [DEFAULT])
+# --------------------------------------
+# Check vapigen existence and version. You must call GOBJECT_INTROSPECTION_CHECK
+# first in order to call this macro.
+#
+# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
+AC_DEFUN([VAPIGEN_GI_CHECK],
+[
+ AC_REQUIRE([GOBJECT_INTROSPECTION_CHECK])
+ _VAPIGEN_CHECK_INTERNAL([$1],[$2],[$found_introspection],[$3])
+]
+)
+
+dnl usage:
+# VAPIGEN_GI_REQUIRE([VERSION], [API_VERSION], [DEFAULT])
+# --------------------------------------
+# Check vapigen existence and version. You must call GOBJECT_INTROSPECTION_REQUIRE
+# first in order to call this macro.
+#
+# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
+AC_DEFUN([VAPIGEN_GI_REQUIRE],
+[
+ AC_REQUIRE([GOBJECT_INTROSPECTION_REQUIRE])
+ _VAPIGEN_CHECK_INTERNAL([$1],[$2],[$found_introspection],[$3])
+]
+)
+