[gnome-usage] build: Improve vapi files handling



commit 32a5cea1d860ce6385de082aafa69d176e685de0
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Wed Dec 20 14:24:53 2017 +0100

    build: Improve vapi files handling
    
    The common directory for holding vapi files is usually the `vapi`
    directory in the root source directory.
    
    The `vapis` directory have been moved to the root source directory
    from the `src` directory, and has been renamed to `vapi`.
    
    meson is also able to detect vala dependencies, so that feature is
    used instead of vala arguments.

 meson.build                              |  2 ++
 src/meson.build                          | 27 +++++++++++++++++----------
 {src/vapis => vapi}/accountsservice.vapi |  0
 {src/vapis => vapi}/config.vapi          |  0
 {src/vapis => vapi}/egg.vapi             |  0
 {src/vapis => vapi}/libgtop-2.0.vapi     |  0
 {src/vapis => vapi}/rg.vapi              |  0
 7 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/meson.build b/meson.build
index f5db785..ef4d2c5 100644
--- a/meson.build
+++ b/meson.build
@@ -6,6 +6,7 @@ project(
 )
 
 cc = meson.get_compiler('c')
+valac = meson.get_compiler('vala')
 
 glib = dependency('glib-2.0', version : '>=2.38')
 gobject = dependency('gobject-2.0')
@@ -19,6 +20,7 @@ gnome = import('gnome')
 i18n = import('i18n')
 
 po_dir = join_paths(meson.source_root(), 'po')
+vapi_dir = join_paths (meson.source_root (), 'vapi')
 
 subdir('data')
 subdir('po')
diff --git a/src/meson.build b/src/meson.build
index 503d515..91072e5 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -41,19 +41,26 @@ vala_sources = [
     'view.vala',
     'window.vala']
 
-vala_args = [
-    '--pkg=rg',
-    '--pkg=egg',
-    '--pkg=libgtop-2.0',
-    '--pkg=accountsservice',
-    '--pkg=config',
-    '--pkg=posix',
-    '--vapidir=' + meson.current_source_dir() + '/vapis']
+deps = [
+  accountsservice,
+  egg,
+  gio,
+  glib,
+  gobject,
+  gtk,
+  gtop,
+  math,
+  rg,
+  valac.find_library('config', dirs: vapi_dir),
+  valac.find_library('egg', dirs: vapi_dir),
+  valac.find_library('posix'),
+  valac.find_library('rg', dirs: vapi_dir)
+]
 
 usage = executable('gnome-usage',
                      vala_sources,
                      resources,
                      c_args : [ '-DVERSION="' + meson.project_version() + '"', 
'-DGETTEXT_PACKAGE="gnome-usage"', '-DGNOMELOCALEDIR="' + get_option('prefix') + '/' + 
get_option('localedir') + '"' ],
-                     vala_args: vala_args,
+                     vala_args: '--vapidir=' + vapi_dir,
                      install: true,
-                     dependencies : [glib, gobject, gio, gtk, rg, egg, math, gtop, accountsservice])
+                     dependencies: deps)
diff --git a/src/vapis/accountsservice.vapi b/vapi/accountsservice.vapi
similarity index 100%
rename from src/vapis/accountsservice.vapi
rename to vapi/accountsservice.vapi
diff --git a/src/vapis/config.vapi b/vapi/config.vapi
similarity index 100%
rename from src/vapis/config.vapi
rename to vapi/config.vapi
diff --git a/src/vapis/egg.vapi b/vapi/egg.vapi
similarity index 100%
rename from src/vapis/egg.vapi
rename to vapi/egg.vapi
diff --git a/src/vapis/libgtop-2.0.vapi b/vapi/libgtop-2.0.vapi
similarity index 100%
rename from src/vapis/libgtop-2.0.vapi
rename to vapi/libgtop-2.0.vapi
diff --git a/src/vapis/rg.vapi b/vapi/rg.vapi
similarity index 100%
rename from src/vapis/rg.vapi
rename to vapi/rg.vapi


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