[network-manager-applet/wip/inigomartinez/meson-improvements: 5/7] build(meson): Use a variable for the name



commit be3b79079d5e71f796ba916b836b0d1d32b03d76
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Sat Nov 11 17:28:43 2017 +0100

    build(meson): Use a variable for the name
    
    This patch uses a new variable for the name, which would help in
    case it should be renamed.
    
    It also helps in consistency, since the same string is used where it
    is needed, avoiding any error caused by handwriting.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=790178

 meson.build     |   30 +++++++++++++++---------------
 po/meson.build  |    2 +-
 src/meson.build |    6 ++----
 3 files changed, 18 insertions(+), 20 deletions(-)
---
diff --git a/meson.build b/meson.build
index b6b2957..94900ad 100644
--- a/meson.build
+++ b/meson.build
@@ -9,7 +9,7 @@ project(
   meson_version: '>= 0.43.0'
 )
 
-nma_long_name = 'network-manager-applet'
+nma_name = 'nm-applet'
 
 nma_version = meson.project_version()
 version_array = nma_version.split('.')
@@ -51,16 +51,16 @@ config_h = configuration_data()
 # defines
 set_defines = [
   # package
-  ['PACKAGE', nma_long_name],
+  ['PACKAGE', meson.project_name()],
   ['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=NetworkManager'],
-  ['PACKAGE_NAME', 'nm-applet'],
-  ['PACKAGE_STRING', 'nm-applet ' + nma_version],
-  ['PACKAGE_TARNAME', nma_long_name],
+  ['PACKAGE_NAME', nma_name],
+  ['PACKAGE_STRING', '@0@ @1@'.format(nma_name, nma_version)],
+  ['PACKAGE_TARNAME', meson.project_name()],
   ['PACKAGE_URL', ''],
   ['PACKAGE_VERSION', nma_version],
   ['VERSION', nma_version],
   # i18n
-  ['GETTEXT_PACKAGE', 'nm-applet']
+  ['GETTEXT_PACKAGE', nma_name]
 ]
 
 foreach define: set_defines
@@ -391,14 +391,6 @@ else
 endif
 config_h.set('NM_MORE_ASSERTS', more_asserts)
 
-config = 'config.h'
-
-configure_file(
-  input: config + '.meson',
-  output: config,
-  configuration: config_h
-)
-
 gnome = import('gnome')
 i18n = import('i18n')
 pkg = import('pkgconfig')
@@ -459,7 +451,7 @@ custom_target(
 )
 
 schema_conf = configuration_data()
-schema_conf.set('GETTEXT_PACKAGE', 'nm-applet')
+schema_conf.set('GETTEXT_PACKAGE', nma_name)
 
 schema = 'org.gnome.nm-applet.gschema.xml'
 
@@ -526,6 +518,14 @@ if enable_gtk_doc
   )
 endif
 
+config = 'config.h'
+
+configure_file(
+  input: config + '.meson',
+  output: config,
+  configuration: config_h
+)
+
 meson.add_install_script(
   'meson_post_install.py',
   nma_datadir,
diff --git a/po/meson.build b/po/meson.build
index 64eaaff..6e61499 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1 +1 @@
-i18n.gettext('nm-applet', preset: 'glib')
+i18n.gettext(nma_name, preset: 'glib')
diff --git a/src/meson.build b/src/meson.build
index 45ff246..c5638bb 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -31,8 +31,6 @@ endif
 
 subdir('connection-editor')
 
-program_name = 'nm-applet'
-
 sources = files(
   'ap-menu-item.c',
   'applet-agent.c',
@@ -87,7 +85,7 @@ cflags = [
   '-DSYSCONFDIR="@0@"'.format(nma_sysconfdir),
   '-DAUTOSTARTDIR="@0@"'.format(nma_autostartdir),
   '-DICONDIR="@0@"'.format(nma_icondir),
-  '-DG_LOG_DOMAIN="@0@"'.format(program_name)
+  '-DG_LOG_DOMAIN="@0@"'.format(nma_name)
 ]
 
 ldflags = []
@@ -109,7 +107,7 @@ if enable_wwan
 endif
 
 executable(
-  program_name,
+  nma_name,
   sources,
   include_directories: incs,
   dependencies: deps,


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