[geary/mjog/meson-cleanup: 7/8] Move source build config from top-level to src meson.build



commit 4a959ab440e28708a8482ce0c26b48f2ebc9fb50
Author: Michael Gratton <mike vee net>
Date:   Sat Sep 28 00:26:23 2019 +1000

    Move source build config from top-level to src meson.build
    
    Sort the config vars, ensure internal vars all start with an underscore,
    and ensure the config is being used for all builds.

 meson.build                                        | 25 ------------------
 .../plugin/desktop-notifications/meson.build       |  1 +
 src/client/plugin/messaging-menu/meson.build       |  1 +
 src/client/plugin/notification-badge/meson.build   |  1 +
 src/client/util/util-international.vala            | 13 +++++-----
 src/meson.build                                    | 30 ++++++++++++++++++++--
 6 files changed, 37 insertions(+), 34 deletions(-)
---
diff --git a/meson.build b/meson.build
index af71f60a..918e7e43 100644
--- a/meson.build
+++ b/meson.build
@@ -35,7 +35,6 @@ geary_version = meson.project_version()
 # Some variables
 cc = meson.get_compiler('c')
 valac = meson.get_compiler('vala')
-config_h_dir = include_directories('.')
 geary_prefix = get_option('prefix')
 
 # Source dirs
@@ -180,30 +179,6 @@ if iso_3166_xml == ''
 endif
 files(iso_639_xml, iso_3166_xml) # Check to make sure these exist
 
-# Configuration
-conf = configuration_data()
-conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
-conf.set_quoted('G_LOG_DOMAIN', meson.project_name())
-conf.set_quoted('PACKAGE_NAME', meson.project_name())
-conf.set_quoted('PACKAGE_STRING', '@0@-@1@'.format(meson.project_name(), meson.project_version()))
-conf.set_quoted('PACKAGE_VERSION', meson.project_version())
-conf.set_quoted('_BUILD_ROOT_DIR', meson.build_root())
-conf.set_quoted('_SOURCE_ROOT_DIR', meson.source_root())
-conf.set_quoted('_GSETTINGS_DIR', join_paths(meson.build_root(), 'desktop'))
-conf.set_quoted('_INSTALL_PREFIX', geary_prefix)
-conf.set_quoted('_WEB_EXTENSIONS_DIR', web_extensions_dir)
-conf.set_quoted('_PLUGINS_DIR', plugins_dir)
-conf.set_quoted('LANGUAGE_SUPPORT_DIRECTORY', locale_dir)
-conf.set_quoted('ISO_CODE_639_XML', iso_639_xml)
-conf.set_quoted('ISO_CODE_3166_XML', iso_3166_xml)
-conf.set('GCR_API_SUBJECT_TO_CHANGE', true)
-conf.set_quoted('_VERSION', geary_version)
-conf.set_quoted('_APP_ID', geary_id)
-conf.set_quoted('_PROFILE', profile)
-conf.set_quoted('_NAME_SUFFIX', name_suffix)
-conf.set_quoted('_REVNO', revno)
-configure_file(output: 'config.h', configuration: conf)
-
 # Post-install scripts
 meson.add_install_script(join_paths('build-aux', 'post_install.py'))
 
diff --git a/src/client/plugin/desktop-notifications/meson.build 
b/src/client/plugin/desktop-notifications/meson.build
index b2caf81f..6bf12c6a 100644
--- a/src/client/plugin/desktop-notifications/meson.build
+++ b/src/client/plugin/desktop-notifications/meson.build
@@ -9,6 +9,7 @@ shared_module(
   plugin_name,
   sources: plugin_src,
   dependencies: plugin_dependencies,
+  include_directories: config_h_dir,
   vala_args: geary_vala_args,
   c_args: plugin_c_args,
   install: true,
diff --git a/src/client/plugin/messaging-menu/meson.build b/src/client/plugin/messaging-menu/meson.build
index c161b3b3..d757e442 100644
--- a/src/client/plugin/messaging-menu/meson.build
+++ b/src/client/plugin/messaging-menu/meson.build
@@ -28,6 +28,7 @@ if libmessagingmenu_dep.found()
     plugin_name + '-geary',
     sources: plugin_src,
     dependencies: messaging_menu_dependencies,
+    include_directories: config_h_dir,
     vala_args: geary_vala_args,
     c_args: plugin_c_args,
     install: true,
diff --git a/src/client/plugin/notification-badge/meson.build 
b/src/client/plugin/notification-badge/meson.build
index da032f7b..f15870f0 100644
--- a/src/client/plugin/notification-badge/meson.build
+++ b/src/client/plugin/notification-badge/meson.build
@@ -13,6 +13,7 @@ if libunity.found()
     plugin_name,
     sources: plugin_src,
     dependencies: badge_dependencies,
+    include_directories: config_h_dir,
     vala_args: geary_vala_args,
     c_args: plugin_c_args,
     install: true,
diff --git a/src/client/util/util-international.vala b/src/client/util/util-international.vala
index ac2d7a56..eb640e12 100644
--- a/src/client/util/util-international.vala
+++ b/src/client/util/util-international.vala
@@ -4,10 +4,9 @@
  * (version 2.1 or later).  See the COPYING file in this distribution.
  */
 
-extern const string LANGUAGE_SUPPORT_DIRECTORY;
-extern const string ISO_CODE_639_XML;
-extern const string ISO_CODE_3166_XML;
-public const string TRANSLATABLE = "translatable";
+extern const string _LANGUAGE_SUPPORT_DIRECTORY;
+extern const string _ISO_CODE_639_XML;
+extern const string _ISO_CODE_3166_XML;
 
 namespace Util.International {
 
@@ -25,7 +24,7 @@ namespace Util.International {
 
     // TODO: Geary should be able to use langpacks from the build directory
     private string get_langpack_dir_path(string program_path) {
-        return LANGUAGE_SUPPORT_DIRECTORY;
+        return _LANGUAGE_SUPPORT_DIRECTORY;
     }
 
     /**
@@ -147,7 +146,7 @@ namespace Util.International {
         if (language_names == null) {
             language_names = new HashTable<string, string>(GLib.str_hash, GLib.str_equal);
 
-            unowned Xml.Doc doc = Xml.Parser.parse_file(ISO_CODE_639_XML);
+            unowned Xml.Doc doc = Xml.Parser.parse_file(_ISO_CODE_639_XML);
             if (doc == null) {
                 return null;
             }
@@ -197,7 +196,7 @@ namespace Util.International {
         if (country_names == null) {
             country_names = new HashTable<string, string>(GLib.str_hash, GLib.str_equal);
 
-            unowned Xml.Doc doc = Xml.Parser.parse_file(ISO_CODE_3166_XML);
+            unowned Xml.Doc doc = Xml.Parser.parse_file(_ISO_CODE_3166_XML);
 
             if (doc == null) {
                 return null;
diff --git a/src/meson.build b/src/meson.build
index eed2529b..90b628d3 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -1,4 +1,26 @@
-# Common vala options
+# Build source configuration
+config_h_dir = include_directories('.')
+
+conf = configuration_data()
+conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
+conf.set_quoted('G_LOG_DOMAIN', meson.project_name())
+conf.set_quoted('_APP_ID', geary_id)
+conf.set_quoted('_BUILD_ROOT_DIR', meson.build_root())
+conf.set_quoted('_GSETTINGS_DIR', join_paths(meson.build_root(), 'desktop'))
+conf.set_quoted('_INSTALL_PREFIX', geary_prefix)
+conf.set_quoted('_ISO_CODE_3166_XML', iso_3166_xml)
+conf.set_quoted('_ISO_CODE_639_XML', iso_639_xml)
+conf.set_quoted('_LANGUAGE_SUPPORT_DIRECTORY', locale_dir)
+conf.set_quoted('_NAME_SUFFIX', name_suffix)
+conf.set_quoted('_PLUGINS_DIR', plugins_dir)
+conf.set_quoted('_PROFILE', profile)
+conf.set_quoted('_REVNO', revno)
+conf.set_quoted('_SOURCE_ROOT_DIR', meson.source_root())
+conf.set_quoted('_VERSION', geary_version)
+conf.set_quoted('_WEB_EXTENSIONS_DIR', web_extensions_dir)
+configure_file(output: 'config.h', configuration: conf)
+
+# Common valac options
 geary_vala_args = [
   '--enable-checking',
 ]
@@ -12,6 +34,7 @@ if not poodle
   geary_vala_args += [ '--define=DISABLE_POODLE' ]
 endif
 
+# Common cc options
 geary_c_args = [
   '-include', 'config.h',
   # Enable GLib structured logging
@@ -21,6 +44,7 @@ geary_c_args = [
   '-DUNW_LOCAL_ONLY',
   # None of these kids want to hang out unless you are cool enough
   '-DGCK_API_SUBJECT_TO_CHANGE',
+  '-DGCR_API_SUBJECT_TO_CHANGE',
   '-DGOA_API_IS_SUBJECT_TO_CHANGE',
   '-DHANDY_USE_UNSTABLE_API',
 ]
@@ -39,13 +63,15 @@ geary_web_process_sources = files(
 # Web process extension library
 geary_web_process = library('geary-web-process',
   geary_web_process_sources,
-  c_args: geary_c_args,
   dependencies: [
     geary_engine_dep,
     gee,
     gmime,
     webkit2gtk_web_extension,
   ],
+  include_directories: config_h_dir,
+  vala_args: geary_client_vala_args,
+  c_args: geary_c_args,
   install: true,
   install_dir: web_extensions_dir
 )


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