[libgit2-glib/wip/inigomartinez/meson: 12/13] meson: Add support for VAPI generation



commit daab1c1404eea90155fee0d545c112deebda7df8
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Fri Jan 19 20:32:07 2018 +0100

    meson: Add support for VAPI generation
    
    autotools generates the VAPI files for the introspection files and
    is missing in meson.
    
    This patch adds support for VAPI generation in meson.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792699

 libgit2-glib/meson.build |   25 ++++++++++++++++---------
 meson.build              |    7 +++++++
 meson_options.txt        |    1 +
 3 files changed, 24 insertions(+), 9 deletions(-)
---
diff --git a/libgit2-glib/meson.build b/libgit2-glib/meson.build
index 91ffa78..c0f68de 100644
--- a/libgit2-glib/meson.build
+++ b/libgit2-glib/meson.build
@@ -230,13 +230,20 @@ libgit2_glib_dep = declare_dependency(link_with: libgit2_glib,
                                       sources: enum_types[1])
 
 if enable_gir
-  gnome.generate_gir(libgit2_glib,
-                     sources: headers + sources,
-                     namespace: libgit2_glib_ns,
-                     nsversion: libgit2_glib_api_version,
-                     identifier_prefix: libgit2_glib_ns,
-                     symbol_prefix: libgit2_glib_ns.to_lower(),
-                     includes: [ 'GObject-2.0', 'GLib-2.0', 'Gio-2.0' ],
-                     header: ggit_h,
-                     install: true)
+  libgit2_glib_gir = gnome.generate_gir(libgit2_glib,
+                                        sources: headers + sources,
+                                        namespace: libgit2_glib_ns,
+                                        nsversion: libgit2_glib_api_version,
+                                        identifier_prefix: libgit2_glib_ns,
+                                        symbol_prefix: libgit2_glib_ns.to_lower(),
+                                        includes: [ 'GObject-2.0', 'GLib-2.0', 'Gio-2.0' ],
+                                        header: ggit_h,
+                                        install: true)
+
+  if enable_vapi
+    gnome.generate_vapi(libgit2_glib_vapi_name,
+                        sources: libgit2_glib_gir[0],
+                        packages: 'gio-2.0',
+                        install: true)
+  endif
 endif
diff --git a/meson.build b/meson.build
index 043fb0b..fc6502c 100644
--- a/meson.build
+++ b/meson.build
@@ -16,6 +16,7 @@ libgit2_glib_api_version = '1.0'
 libgit2_glib_api_name = '@0@-@1@'.format(meson.project_name(), libgit2_glib_api_version)
 
 libgit2_glib_ns = 'Ggit'
+libgit2_glib_vapi_name = '@0@-@1@'.format(libgit2_glib_ns.to_lower(), libgit2_glib_api_version)
 
 libgit2_glib_buildtype = get_option('buildtype')
 
@@ -127,6 +128,12 @@ if enable_gir
   enable_gir = find_program('g-ir-scanner', required: false).found() and not meson.is_cross_build()
 endif
 
+enable_vapi = get_option('vapi')
+if enable_vapi
+  assert(enable_gir, 'vapi support was requested, but introspection support is mandatory.')
+  assert(add_languages('vala', required: false), 'vapi support was requested, but vala not found.')
+endif
+
 # Check for libgit2 ssh support
 enable_ssh = get_option('ssh')
 if enable_ssh
diff --git a/meson_options.txt b/meson_options.txt
index aa1c2c8..896c998 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,4 @@
 option('gtk_doc', type: 'boolean', value: false, description: 'Enable generating the API reference (depends 
on GTK-Doc)')
 option('introspection', type: 'boolean', value: true, description: 'Enable GObject Introspection')
 option('ssh', type: 'boolean', value: true, description: 'Build with libgit2 ssh support')
+option('vapi', type: 'boolean', value: true, description: 'Build Vala bindings')


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