From 649fc842327e114cb4b0884266dff82b00f8dfa5 Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Sat, 5 Mar 2022 08:49:17 +0100 Subject: vala: Support building bindings for vte-2.91-gtk4 Fixes https://gitlab.gnome.org/GNOME/vte/-/issues/2546 --- bindings/meson.build | 2 +- bindings/vala/meson.build | 88 ++++++++++++++++++++++++++++------------------- 2 files changed, 54 insertions(+), 36 deletions(-) diff --git a/bindings/meson.build b/bindings/meson.build index 626e4679..2fc8dd60 100644 --- a/bindings/meson.build +++ b/bindings/meson.build @@ -22,6 +22,6 @@ if get_option('gir') and (get_option('gtk3') or get_option('gtk4')) subdir('gir') endif -if get_option('vapi') and get_option('gtk3') +if get_option('vapi') and (get_option('gtk3') or get_option('gtk4')) subdir('vala') endif diff --git a/bindings/vala/meson.build b/bindings/vala/meson.build index ec1ddf0b..d27a1302 100644 --- a/bindings/vala/meson.build +++ b/bindings/vala/meson.build @@ -15,7 +15,6 @@ # along with this library. If not, see . assert(get_option('gir'), 'gir is required for vala support') -assert(get_option('gtk3'), 'vala support only available for gtk3') add_languages('vala', required: true) @@ -24,20 +23,6 @@ assert(valac.version().version_compare('>= 0.24.0'), 'vala >= 0.24 required') posix_dep = valac.find_library('posix') -libvte_gtk3_vapi_deps = [ - 'gio-2.0', - 'glib-2.0', - 'pango', - 'gtk+-3.0', -] - -libvte_gtk3_vapi_dep = gnome.generate_vapi( - vte_gtk3_api_name, - sources: libvte_gtk3_gir[0], - packages: libvte_gtk3_vapi_deps, - install: true, -) - # Vala test application vapp_resource_data = files( @@ -71,30 +56,63 @@ if valac.version().version_compare('>= 0.31.1') vapp_valaflags += '--disable-since-check' endif -if gtk3_dep.version().version_compare('>= 3.16') - vapp_valaflags += '--define=GTK_3_16' -endif - vapp_incs = [ top_inc, src_inc, vte_inc, ] -vapp_deps = [ - gio_dep, - glib_dep, - gtk3_dep, - libvte_gtk3_vapi_dep, - posix_dep, -] +if get_option('gtk3') + libvte_gtk3_vapi_deps = [ + 'gio-2.0', + 'glib-2.0', + 'pango', + 'gtk+-3.0', + ] + + libvte_gtk3_vapi_dep = gnome.generate_vapi( + vte_gtk3_api_name, + sources: libvte_gtk3_gir[0], + packages: libvte_gtk3_vapi_deps, + install: true, + ) + + if gtk3_dep.version().version_compare('>= 3.16') + vapp_valaflags += '--define=GTK_3_16' + endif + + vapp_deps = [ + gio_dep, + glib_dep, + gtk3_dep, + libvte_gtk3_vapi_dep, + posix_dep, + ] + + vapp = executable( + 'vala-test', + sources: vapp_sources, + include_directories: vapp_incs, + dependencies: vapp_deps, + c_args: vapp_cflags, + vala_args: vapp_valaflags, + install: false, + ) +endif -vapp = executable( - 'vala-test', - sources: vapp_sources, - include_directories: vapp_incs, - dependencies: vapp_deps, - c_args: vapp_cflags, - vala_args: vapp_valaflags, - install: false, -) +if get_option('gtk4') + libvte_gtk4_vapi_deps = [ + 'gio-2.0', + 'glib-2.0', + 'graphene-1.0', + 'pango', + 'gtk4', + ] + + libvte_gtk4_vapi_dep = gnome.generate_vapi( + vte_gtk4_api_name, + sources: libvte_gtk4_gir[0], + packages: libvte_gtk4_vapi_deps, + install: true, + ) +endif -- cgit v1.2.1