Commit 32faf152 authored by Evan Nemerson's avatar Evan Nemerson

Add autotools vapigen integration for upstream bindings

Fixes bug 649526.
parent 3406eff1
......@@ -110,6 +110,7 @@ AC_CONFIG_FILES([Makefile
doc/Makefile
doc/vala/Makefile
gobject-introspection/Makefile
vapigen/vapigen.pc
vapigen/Makefile
vapigen/vala-gen-introspect/Makefile
vapigen/vala-gen-introspect/vala-gen-introspect])
......
......@@ -60,12 +60,31 @@ vapicheck_LDADD = \
../gobject-introspection/libgidl.la \
$(NULL)
if ENABLE_UNVERSIONED
makedir = $(datadir)/vala
make_DATA = Makefile.vapigen
aclocaldir = $(datadir)/aclocal
aclocal_DATA = vapigen.m4
endif
pkgconfigdir = $(datadir)/pkgconfig
pkgconfig_DATA = vapigen@PACKAGE_SUFFIX@.pc
vapigen@PACKAGE_SUFFIX@.pc: vapigen.pc
cp $< $@
EXTRA_DIST = $(vapigen_VALASOURCES) $(vapicheck_VALASOURCES) vapigen.vala.stamp vapicheck.vala.stamp
CLEANFILES = \
vapigen@PACKAGE_SUFFIX@.pc
$(NULL)
if ENABLE_UNVERSIONED
install-exec-hook:
cd $(DESTDIR)$(bindir) && $(LN_S) -f vapigen@PACKAGE_SUFFIX@$(EXEEXT) vapigen$(EXEEXT)
cd $(DESTDIR)$(bindir) && $(LN_S) -f vapicheck@PACKAGE_SUFFIX@$(EXEEXT) vapicheck$(EXEEXT)
cd $(DESTDIR)$(pkgconfigdir) && $(LN_S) -f vapigen@PACKAGE_SUFFIX@.pc vapigen.pc
endif
MAINTAINERCLEANFILES = \
......
# 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.
#
# *_GIR
#
# The GIR 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)_DIRS),$(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)_GIR)
endef
$(foreach vapi,$(VAPIGEN_VAPIS),$(eval $(call vapigen,$(vapi))))
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")
])
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
bindir=@bindir@
datarootdir=@datarootdir@
datadir=@datadir@
includedir=@includedir@
vapigen=${bindir}/vapigen@PACKAGE_SUFFIX@
vapidir=${datadir}/vala/vapi
vapidir_versioned=${datadir}/vala@PACKAGE_SUFFIX@/vapi
Name: vapigen
Description: Vala API Generator
Version: @VERSION@
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