From 1a0e9ba2e96e2122534a942a0336a84792067b7f Mon Sep 17 00:00:00 2001 From: Olivier Duchateau Date: Sat, 27 Jul 2019 17:27:44 +0200 Subject: [PATCH] Add Vala support --- .gitignore | 1 + Makefile.am | 5 +- configure.ac.in | 6 +++ m4/vapigen.m4 | 101 +++++++++++++++++++++++++++++++++++++++++ thunarx/Makefile.am | 17 +++++++ thunarx/thunarx-3.deps | 4 ++ 6 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 m4/vapigen.m4 create mode 100644 thunarx/thunarx-3.deps diff --git a/.gitignore b/.gitignore index 6d95f16e..bd33bafd 100644 --- a/.gitignore +++ b/.gitignore @@ -137,3 +137,4 @@ gtk-doc.m4 test-driver m4/* !m4/introspection.m4 +!m4/vapigen.m4 diff --git a/Makefile.am b/Makefile.am index 63076bf0..577bdc65 100644 --- a/Makefile.am +++ b/Makefile.am @@ -96,8 +96,9 @@ EXTRA_DIST = \ $(service_in_files) \ $(systemd_user_in_files) \ $(appdata_in_files) \ - $(polkit_in_in_files) \ - m4/introspection.m4 + $(polkit_in_in_files) \ + m4/introspection.m4 \ + m4/vapigen.m4 CLEANFILES = $(appdata_DATA) diff --git a/configure.ac.in b/configure.ac.in index 9bb106dd..8b3585c2 100644 --- a/configure.ac.in +++ b/configure.ac.in @@ -162,6 +162,11 @@ dnl *** GObject Instrospection *** dnl ****************************** GOBJECT_INTROSPECTION_CHECK([1.30.0]) +dnl ******************** +dnl *** Vala support *** +dnl ******************** +VAPIGEN_CHECK() + dnl ******************************************** dnl *** Check for session management support *** dnl ******************************************** @@ -277,6 +282,7 @@ echo "* Mount notification support: no" fi echo "* Debug Support: $enable_debug" echo "* GObject Instrospection support: $enable_introspection" +echo "* Vala support: $enable_vala" echo echo "Additional Plugins:" echo diff --git a/m4/vapigen.m4 b/m4/vapigen.m4 new file mode 100644 index 00000000..2c435e74 --- /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") +]) diff --git a/thunarx/Makefile.am b/thunarx/Makefile.am index dcc08478..2c5f4810 100644 --- a/thunarx/Makefile.am +++ b/thunarx/Makefile.am @@ -132,4 +132,21 @@ CLEANFILES += $(gir_DATA) $(typelib_DATA) endif +if ENABLE_VAPIGEN +-include $(VAPIGEN_MAKEFILE) + +thunarx-3.vapi: Thunarx-3.0.gir thunarx-3.deps + +VAPIGEN_VAPIS = thunarx-3.vapi +VAPIGEN_GIRDIRS = $(datadir)/gir-1.0 + +thunarx_3_vapi_DEPS = gobject-2.0 glib-2.0 gio-2.0 gtk+-3.0 +thunarx_3_vapi_FILES = Thunarx-3.0.gir + +vapidir = $(datadir)/vala/vapi +vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps) + +EXTRA_DIST += thunarx-3.deps +endif + # vi:set ts=8 sw=8 noet ai nocindent syntax=automake: diff --git a/thunarx/thunarx-3.deps b/thunarx/thunarx-3.deps new file mode 100644 index 00000000..dd3152c3 --- /dev/null +++ b/thunarx/thunarx-3.deps @@ -0,0 +1,4 @@ +gobject-2.0 +glib-2.0 +gio-2.0 +gtk+-3.0 -- 2.21.0