[vte] bindings: vala: Add vapi for vte/gtk4



commit 254416436fe346ffc23fb4bb79460f7fdb60171e
Author: Christian Persch <chpe src gnome org>
Date:   Fri Apr 8 21:50:18 2022 +0200

    bindings: vala: Add vapi for vte/gtk4
    
    Fixes: https://gitlab.gnome.org/GNOME/vte/-/issues/2546

 bindings/meson.build      |  2 +-
 bindings/vala/meson.build | 85 +++++++++++++----------------------------------
 2 files changed, 24 insertions(+), 63 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..659ee6b3 100644
--- a/bindings/vala/meson.build
+++ b/bindings/vala/meson.build
@@ -15,7 +15,6 @@
 # along with this library.  If not, see <https://www.gnu.org/licenses/>.
 
 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,77 +23,39 @@ assert(valac.version().version_compare('>= 0.24.0'), 'vala >= 0.24 required')
 
 posix_dep = valac.find_library('posix')
 
-libvte_gtk3_vapi_deps = [
+libvte_common_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 get_option('gtk3')
 
-# Vala test application
+  libvte_gtk3_vapi_deps = libvte_common_vapi_deps + [
+    'gtk+-3.0',
+  ]
 
-vapp_resource_data = files(
-  'app.ui',
-  'search-popover.ui',
-)
+  libvte_gtk3_vapi_dep = gnome.generate_vapi(
+    vte_gtk3_api_name,
+    sources: libvte_gtk3_gir[0],
+    packages: libvte_gtk3_vapi_deps,
+    install: true,
+  )
 
-vapp_resource_sources = gnome.compile_resources(
-  'appresources',
-  'app.gresource.xml',
-  c_name: 'app',
-  dependencies: vapp_resource_data,
-  export: true,
-)
-
-vapp_sources = vapp_resource_sources + files(
-  'config.vapi',
-  'app.vala'
-)
-
-vapp_cflags = [
-  '-Wno-unused-but-set-variable',
-  '-Wno-unused-variable',
-]
-
-vapp_valaflags = [
-  '--enable-deprecated'
-]
-
-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
+if get_option('gtk4')
 
-vapp_incs = [
-  top_inc,
-  src_inc,
-  vte_inc,
-]
+  libvte_gtk4_vapi_deps = libvte_common_vapi_deps + [
+    'graphene-1.0',
+    'gtk4',
+  ]
 
-vapp_deps = [
-  gio_dep,
-  glib_dep,
-  gtk3_dep,
-  libvte_gtk3_vapi_dep,
-  posix_dep,
-]
+  libvte_gtk4_vapi_dep = gnome.generate_vapi(
+    vte_gtk4_api_name,
+    sources: libvte_gtk4_gir[0],
+    packages: libvte_gtk4_vapi_deps,
+    install: true,
+  )
 
-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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]