Commit b1e1ee79 authored by Alberto Ruiz's avatar Alberto Ruiz Committed by Dan Williams

vala: add vala bindings for libnm-util and libnm-glib

This patch adds the autotools facilities to generate vapi files so that
libnm-util and libnm-glib can be consumed from Vala.

It depends on vapigen and it is a soft dependency.
parent 4366fd2f
......@@ -16,7 +16,8 @@ SUBDIRS = \
po \
man \
docs \
examples
examples \
vapi
EXTRA_DIST = \
CONTRIBUTING \
......
......@@ -712,6 +712,13 @@ NM_COMPILER_WARNINGS
GTK_DOC_CHECK(1.0)
dnl -------------------------
dnl Vala bindings
dnl -------------------------
VAPIGEN_CHECK(0.17)
dnl
dnl Tests
dnl
......@@ -824,6 +831,7 @@ examples/ruby/Makefile
examples/C/Makefile
examples/C/glib/Makefile
examples/C/qt/Makefile
vapi/Makefile
])
AC_OUTPUT
......
dnl vala.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])
# --------------------------------------
# Check that vapigen existence and version
#
# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
AC_DEFUN([VAPIGEN_CHECK],
[
AC_BEFORE([GOBJECT_INTROSPECTION_CHECK],[$0])
AC_BEFORE([GOBJECT_INTROSPECTION_REQUIRE],[$0])
AC_ARG_ENABLE([vala],
AS_HELP_STRING([--enable-vala[=@<:@no/auto/yes@:>@]],
[build Vala bindings [[default=auto]]]),,
[enable_vala=auto])
AS_CASE([$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
])
])
AS_CASE([$enable_vala],
[yes], [
VAPIGEN=`$PKG_CONFIG --variable=vapigen vapigen`
VAPIGEN_MAKEFILE=`$PKG_CONFIG --variable=datadir vapigen`/vala/Makefile.vapigen
AS_IF([test "x$2" = "x"], [
VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir vapigen`
], [
VAPIGEN_VAPIDIR=`$PKG_CONFIG --variable=vapidir_versioned vapigen`
])
])
AC_SUBST([VAPIGEN])
AC_SUBST([VAPIGEN_VAPIDIR])
AC_SUBST([VAPIGEN_MAKEFILE])
AM_CONDITIONAL(ENABLE_VAPIGEN, test "x$enable_vala" = "xyes")
])
EXTRA_DIST = \
NetworkManager-1.0.metadata \
NMClient-1.0.metadata \
libnm-util.deps \
libnm-glib.deps
if ENABLE_VAPIGEN
include $(VAPIGEN_MAKEFILE)
libnm-util.vapi: $(top_srcdir)/libnm-util/NetworkManager-1.0.gir libnm-util.deps NetworkManager-1.0.metadata
libnm-glib.vapi: $(top_srcdir)/libnm-glib/NMClient-1.0.gir libnm-glib.deps NMClient-1.0.metadata
libnm_util_vapi_METADATADIRS = $(srcdir)
libnm_util_vapi_FILES = $(top_builddir)/libnm-util/NetworkManager-1.0.gir
libnm_util_vapi_DIRS = $(srcdir)
libnm_glib_vapi_METADATADIRS = $(srcdir)
libnm_glib_vapi_FILES = $(top_builddir)/libnm-glib/NMClient-1.0.gir
libnm_glib_vapi_DIRS = $(srcdir)
libnm_glib_vapi_VAPIDIRS = $(srcdir)
VAPIGEN_VAPIS = libnm-util.vapi libnm-glib.vapi
VAPIGEN_VAPIDIRS = $(srcdir)
vapidir = $(VAPIGEN_VAPIDIR)
vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps)
endif
# Makefile for Vala API Generator (vapigen)
# Written by Evan Nemerson
#
# The author disclaims copyright to this source code. In place of
# a legal notice, here is a blessing:
#
# May you do good and not evil.
# May you find forgiveness for yourself and forgive others.
# May you share freely, never taking more than you give.
#
# See http://live.gnome.org/Vala/UpstreamGuide for detailed documentation
#
# Variables:
#
# VAPIGEN_FILES
#
# VAPIs to create
#
# *_DEPS / VAPIGEN_DEPS
#
# The dependencies. Generally the pkg-config names.
#
# *_METADATADIRS / VAPIGEN_METADATADIRS
#
# Directory containing the metadata.
#
# *_VAPIDIRS / VAPIGEN_VAPIDIRS
#
# Additional location(s) to search for VAPI dependencies.
#
# *_GIRDIRS / VAPIGEN_GIRDIRS
#
# Additional location(s) to search for GIR dependencies.
#
# *_FILES
#
# The files which should be used to generate the VAPI.
_vapigen_silent_prefix = $(_vapigen_silent_prefix_$(V))
_vapigen_silent_prefix_ = $(_vapigen_silent_prefix_$(AM_DEFAULT_VERBOSITY))
_vapigen_silent_prefix_0 = @echo " VAPIGEN $(1)";
_vapigen_silent_opts = $(_vapigen_silent_opts_$(V))
_vapigen_silent_opts_ = $(_vapigen_silent_opts_$(AM_DEFAULT_VERBOSITY))
_vapigen_silent_opts_0 = --quiet
$(if $(VAPIGEN),,$(error You must define VAPIGEN))
_vapi_name = $(subst /,_,$(subst -,_,$(subst .,_,$(1))))
define vapigen
$(1): $$($(_vapi_name)_GIR)
$(_vapigen_silent_prefix) $(VAPIGEN) $(_vapigen_silent_opts) \
--library $(1:.vapi=) \
$(foreach _vapi_metadatadir_name,$(if $($(_vapi_name)_METADATADIRS),$($(_vapi_name)_METADATADIRS),$(VAPIGEN_METADATADIRS)),--metadatadir $(_vapi_metadatadir_name)) \
$(foreach _vapi_dir_name,$(if $($(_vapi_name)_VAPIDIRS),$($(_vapi_name)_VAPIDIRS),$(VAPIGEN_VAPIDIRS)),--vapidir $(_vapi_dir_name)) \
$(foreach _vapi_dep_name,$(if $($(_vapi_name)_DEPS),$($(_vapi_name)_DEPS),$(VAPIGEN_DEPS)),--pkg $(_vapi_dep_name)) \
$$($(_vapi_name)_FILES)
endef
$(foreach vapi,$(VAPIGEN_VAPIS),$(eval $(call vapigen,$(vapi))))
RemoteSettings.new_async skip
RemoteConnection.updated#virtual_method skip
Client.new_async skip
ACTIVE_CONNECTION_* cheader_filename="nm-active-connection.h" name="ACTIVE_CONNECTION_(.+)" parent="NM.ActiveConnection"
CLIENT_* cheader_filename="nm-client.h" name="CLIENT_(.+)" parent="NM.Client"
ACCESS_POINT_* cheader_filename="nm-access-point.h" name="ACCESS_POINT_(.+)" parent="NM.AccessPoint"
DEVICE_* cheader_filename="nm-device.h" name="DEVICE_(.+)" parent="NM.Device"
DEVICE_ADSL_* cheader_filename="nm-device-adsl.h" name="DEVICE_ADSL_(.+)" parent="NM.DeviceAdsl"
DEVICE_BOND_* cheader_filename="nm-device-bond.h" name="DEVICE_BOND_(.+)" parent="NM.DeviceBond"
DEVICE_BT_* cheader_filename="nm-device-bt.h" name="DEVICE_BT_(.+)" parent="NM.DeviceBt"
DEVICE_ETHERNET_* cheader_filename="nm-device-ethernet.h" name="DEVICE_ETHERNET_(.+)" parent="NM.DeviceEthernet"
DEVICE_INFINIBAND_* cheader_filename="nm-device-infiniband.h" name="DEVICE_INFINIBAND_(.+)" parent="NM.DeviceInfiniband"
DEVICE_MODEM_* cheader_filename="nm-device-modem.h" name="DEVICE_MODEM_(.+)" parent="NM.DeviceModem"
DEVICE_OLPC_MESH_* cheader_filename="nm-device-olpc-mesh.h" name="DEVICE_OLPC_(.+)" parent="NM.DeviceOlpcMesh"
DEVICE_VLAN_* cheader_filename="nm-device-vlan.h" name="DEVICE_VLAN_(.+)" parent="NM.DeviceVlan"
DEVICE_WIFI_* cheader_filename="nm-device-wifi.h" name="DEVICE_WIFI_(.+)" parent="NM.DeviceWifi"
DEVICE_WIMAX_* cheader_filename="nm-device-wimax.h" name="DEVICE_WIMAX_(.+)" parent="NM.DeviceWimax"
DHCP4_CONFIG_OPTIONS cheader_filename="nm-dhcp4-config.h" name="DHCP4_CONFIG_(.+)" parent="NM.DHCP4Config"
DHCP6_CONFIG_OPTIONS cheader_filename="nm-dhcp6-config.h" name="DHCP4_CONFIG_(.+)" parent="NM.DHCP6Config"
IP4_CONFIG_* cheader_filename="nm-ip4-config.h" name="IP4_CONFIG_(.+)" parent="NM.IP4Config"
IP6_CONFIG_* cheader_filename="nm-ip6-config.h" name="IP6_CONFIG_(.+)" parent="NM.IP6Config"
OBJECT_* cheader_filename="nm-object.h" name="OBJECT_(.+)" parent="NM.Object"
REMOTE_CONNECTION_* cheader_filename="nm-remote-connection.h" name="REMOTE_CONNECTION_(.+)" parent="NM.RemoteConnection"
REMOTE_SETTINGS_* cheader_filename="nm-remote-settings.h" name="REMOTE_SETTINGS_(.+)" parent="NM.RemoteSettings"
SECRET_AGENT_* cheader_filename="nm-secret-agent.h" name="SECRET_AGENT_(.+)" parent="NM.SecretAgent"
VPN_CONNECTION_* cheader_filename="nm-vpn-connection.h" name="VPN_CONNECTION_(.+)" parent="NM.VPNConnection"
WIMAX_NSP_* cheader_filename="nm-wimax-nsp.h" name="WIMAX_NSP_(.+)" parent="NM.WimaxNsp"
AccessPoint cheader_filename="nm-access-point.h"
ActiveConnection cheader_filename="nm-active-connection.h"
Client cheader_filename="nm-client.h"
DHCP4Config cheader_filename="nm-dhcp4-config.h"
DHCP6Config cheader_filename="nm-dhcp6-config.h"
Device cheader_filename="nm-device.h"
DeviceAdsl cheader_filename="nm-device-adsl.h"
DeviceBond cheader_filename="nm-device-bond.h"
DeviceBt cheader_filename="nm-device-bt.h"
DeviceEthernet cheader_filename="nm-device-ethernet.h"
DeviceInfiniband cheader_filename="nm-device-infiniband.h"
DeviceModem cheader_filename="nm-device-modem.h"
DeviceOlpcMesh cheader_filename="nm-device-olpc-mesh.h"
DeviceVlan cheader_filename="nm-device-vlan.h"
DeviceWifi cheader_filename="nm-device-wifi.h"
DeviceWimax cheader_filename="nm-device-wimax.h"
IP4Config cheader_filename="nm-ip4-config.h"
IP6AddressArray cheader_filename="nm-types.h"
IP6AddressObjectArray cheader_filename="nm-types.h"
IP6Config cheader_filename="nm-ip6-config.h"
IP6RouteObjectArray cheader_filename="nm-types.h"
ObjectArray cheader_filename="nm-types.h"
RemoteConnection cheader_filename="nm-remote-connection.h"
RemoteSettings cheader_filename="nm-remote-settings.h"
Ssid cheader_filename="nm-types.h"
StringArray cheader_filename="nm-types.h"
UintArray cheader_filename="nm-types.h"
VPNConnection cheader_filename="nm-vpn-connection.h"
WimaxNsp cheader_filename="nm-wimax-nsp.h"
ClientPermission cheader_filename="nm-client.h"
ClientPermissionResult cheader_filename="nm-client.h"
DeviceAdslError cheader_filename="nm-device-adsl.h"
DeviceBondError cheader_filename="nm-device-bond.h"
DeviceBtError cheader_filename="nm-device-bt.h"
DeviceEthernetError cheader_filename="nm-device-ethernet.h"
DeviceInfinibandError cheader_filename="nm-device-infiniband.h"
DeviceModemError cheader_filename="nm-device-modem.h"
DeviceOlpcMeshError cheader_filename="nm-device-olpc-mesh.h"
DeviceVlanError cheader_filename="nm-device-vlan.h"
DeviceWifiError cheader_filename="nm-device-wifi.h"
DeviceWimaxError cheader_filename="nm-device-wimax.h"
ObjectError cheader_filename="nm-object.h"
RemoteSettingsError cheader_filename="nm-remote-settings.h"
SecretAgentError cheader_filename="nm-secret-agent.h"
SecretAgentGetSecretsFlags cheader_filename="nm-secret-agent.h"
WimaxNspNetworkType cheader_filename="nm-wimax-nsp.h"
ClientActivateFn cheader_filename="nm-client.h"
ClientAddActivateFn cheader_filename="nm-client.h"
DeviceDeactivateFn cheader_filename="nm-device.h"
RemoteConnectionCommitFunc cheader_filename="nm-remote-connection.h"
RemoteConnectionDeleteFunc cheader_filename="nm-remote-connection.h"
RemoteConnectionGetSecretsFunc cheader_filename="nm-remote-connection.h"
RemoteSettingsAddConnectionFunc cheader_filename="nm-remote-settings.h"
RemoteSettingsSaveHostnameFunc cheader_filename="nm-remote-settings.h"
SecretAgentDeleteSecretsFunc cheader_filename="nm-secret-agent.h"
SecretAgentGetSecretsFunc cheader_filename="nm-secret-agent.h"
SecretAgentSaveSecretsFunc cheader_filename="nm-secret-agent.h"
device_adsl_error_quark cheader_filename="nm-device-adsl.h" parent="NM.DeviceAdslError" name="device_adsl_error_(.+)"
device_bond_error_quark cheader_filename="nm-device-bond.h" parent="NM.DeviceBondError" name="device_bond_error_(.+)"
device_bt_error_quark cheader_filename="nm-device-bt.h" parent="NM.DeviceBtError" name="device_bt_error_(.+)"
device_ethernet_error_quark cheader_filename="nm-device-ethernet.h" parent="NM.DeviceEthernetError" name="device_ethernet_error_(.+)"
device_infiniband_error_quark cheader_filename="nm-device-infiniband.h" parent="NM.DeviceInfinibandError" name="device_infiniband_error_(.+)"
device_modem_error_quark cheader_filename="nm-device-modem.h" parent="NM.DeviceModemError" name="device_modem_error_(.+)"
device_olpc_mesh_error_quark cheader_filename="nm-device-olpc-mesh.h" parent="NM.DeviceOlpcMeshError" name="device_olpc_mesh_error_(.+)"
device_vlan_error_quark cheader_filename="nm-device-vlan.h" parent="NM.DeviceVlanError" name="device_vlan_error(.+)"
device_wifi_error_quark cheader_filename="nm-device-wifi.h" parent="NM.DeviceWifiError" name="device_wifi_error_(.+)"
device_wimax_error_quark cheader_filename="nm-device-wimax.h" parent="NM.DeviceWimaxError" name="device_wimax_error_(.+)"
object_error_quark cheader_filename="nm-object.h" parent="NM.ObjectError" name="object_error_(.+)"
remote_settings_error_quark cheader_filename="nm-remote-settings.h" name="remote_settings_error_(.+)" parent="NM.RemoteSettingsError"
secret_agent_error_quark cheader_filename="nm-secret-agent.h" name="secret_agent_error_(.+)" parent="NM.SecretAgentError"
Object cheader_filename="nm-object.h"
SecretAgent cheader_filename="nm-secret-agent.h"
This diff is collapsed.
dbus-glib-1
libnm-util
gio-2.0
dbus-glib-1
gio-2.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment