[gnome-usage] build: Improve executable creation



commit 4598835f6eb56f4721f455713053b13f99cca8b2
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Wed Dec 20 16:40:21 2017 +0100

    build: Improve executable creation
    
    The name of the executable and the gettext domain use the project's
    name so they have been changed to use the same string.
    
    The C arguments have also been separated so they gain clarity. The
    `GNOMELOCALEDIR` macro definition has also been changed to use the
    `join_paths` function instead of joining them manually.
    
    The indentation has also been changed to be 2 spaces because meson
    build files usually used that indentation.

 po/meson.build  |  2 +-
 src/meson.build | 21 ++++++++++++++-------
 2 files changed, 15 insertions(+), 8 deletions(-)
---
diff --git a/po/meson.build b/po/meson.build
index 7ccc5fa..e9b77d7 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1 +1 @@
-i18n.gettext('gnome-usage', preset: 'glib')
+i18n.gettext(meson.project_name(), preset: 'glib')
diff --git a/src/meson.build b/src/meson.build
index 91072e5..5fb3db1 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -57,10 +57,17 @@ deps = [
   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: '--vapidir=' + vapi_dir,
-                     install: true,
-                     dependencies: deps)
+c_args = [
+  '-DVERSION="@0@"'.format(meson.project_version()),
+  '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
+  '-DGNOMELOCALEDIR="@0@"'.format(join_paths(get_option('prefix'), get_option('localedir')))
+]
+
+executable(
+  meson.project_name(),
+  vala_sources + resources,
+  dependencies: deps,
+  c_args: c_args,
+  vala_args: '--vapidir=' + vapi_dir,
+  install: true
+)


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