[gitg/wip/valadoc: 5/12] meson: Move meson declarations



commit d7c544d97b67f6a8f1b1c06b0549bff0b7d46294
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Thu Oct 4 13:23:31 2018 +0200

    meson: Move meson declarations
    
    Used meson modules and directory definitions were placed at the end
    of the root meson build file. However, this is recommended to be
    placed at the start of the file, so they are usable early.
    
    Following meson portng guidelines[0], `source_root()` and
    `build_root()` functions have also been replaced.
    
    [0] https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting

 libgitg-ext/meson.build |  6 +++---
 meson.build             | 38 ++++++++++++++++++++------------------
 2 files changed, 23 insertions(+), 21 deletions(-)
---
diff --git a/libgitg-ext/meson.build b/libgitg-ext/meson.build
index 5a025666..4e2cdd2d 100644
--- a/libgitg-ext/meson.build
+++ b/libgitg-ext/meson.build
@@ -107,11 +107,11 @@ if enable_docs
 
   valaproc_cmd = [
     valadoc,
-    '--directory', join_paths(meson.source_root(), 'docs'),
+    '--directory', join_paths(source_root, 'docs'),
     '--package-name', 'gitgext',
     vala_pkgs,
-    '--basedir', meson.source_root(),
-    '--vapidir', join_paths(meson.build_root(), 'gitg'),
+    '--basedir', source_root,
+    '--vapidir', join_paths(build_root, 'gitg'),
     sources,
   ]
 
diff --git a/meson.build b/meson.build
index 867c0c93..c875d876 100644
--- a/meson.build
+++ b/meson.build
@@ -41,6 +41,23 @@ gitg_debug = get_option('buildtype').contains('debug')
 cc = meson.get_compiler('c')
 valac = meson.get_compiler('vala')
 
+gnome = import('gnome')
+i18n = import('i18n')
+pkg = import('pkgconfig')
+
+source_root = meson.current_source_dir()
+build_root = meson.current_build_dir()
+
+po_dir = join_paths(source_root, 'po')
+vapi_dir = join_paths(source_root, 'vapi')
+
+intltool_merge = find_program('intltool-merge')
+intltool_cache = join_paths(po_dir, '.intltool-merge-cache')
+intltool_desktop_cmd = [intltool_merge, '-d', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
+intltool_xml_cmd = [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
+
+top_inc = include_directories('.')
+
 config_h = configuration_data()
 
 # defines
@@ -96,11 +113,9 @@ endif
 add_project_arguments(common_flags, language: 'c')
 
 # vala compiler flags
-vapi_dir = join_paths(meson.source_root(), 'vapi')
-
 add_project_arguments('--vapidir=' + vapi_dir, language: 'vala')
 
-symbol_map = join_paths(meson.current_source_dir(), 'libgitg.map')
+symbol_map = join_paths(source_root, 'libgitg.map')
 common_ldflags = cc.get_supported_link_arguments('-Wl,--version-script,@0@'.format(symbol_map))
 
 glib_req_version = '>= 2.38'
@@ -157,23 +172,10 @@ g_ir_compiler = find_program('g-ir-compiler')
 
 enable_docs = get_option('docs')
 if enable_docs
-  docs_dir = join_paths(meson.source_root(), 'docs')
+  docs_dir = join_paths(source_root, 'docs')
   valadoc = find_program('valadoc')
 endif
 
-gnome = import('gnome')
-i18n = import('i18n')
-pkg = import('pkgconfig')
-
-po_dir = join_paths(meson.source_root(), 'po')
-
-intltool_merge = find_program('intltool-merge')
-intltool_cache = join_paths(po_dir, '.intltool-merge-cache')
-intltool_desktop_cmd = [intltool_merge, '-d', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
-intltool_xml_cmd = [intltool_merge, '-x', '-u', '-c', intltool_cache, po_dir, '@INPUT@', '@OUTPUT@']
-
-top_inc = include_directories('.')
-
 subdir('po')
 subdir('contrib/xml')
 subdir('contrib/ide')
@@ -197,7 +199,7 @@ meson.add_install_script(
 )
 
 output = '\nConfiguration:\n\n'
-output += '        Source code location:   ' + meson.source_root() + '\n'
+output += '        Source code location:   ' + source_root + '\n'
 output += '        Compiler:               ' + cc.get_id() + '\n'
 output += '        Glade catalog:          ' + enable_glade_catalog.to_string() + '\n'
 output += '        Debug enabled:          ' + gitg_debug.to_string() + '\n'


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