[eog: 4/11] build: Use a variable for project name




commit 1d4a71ef42f54b23d49a1c46d691852980dde2d3
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Wed Oct 27 10:04:45 2021 +0200

    build: Use a variable for project name
    
    Instead of calling multiple times to the `project_name` method, a
    new variable holds this value to be reused whenever is necessary.

 data/meson.build          |  2 +-
 doc/reference/meson.build |  4 ++--
 help/meson.build          |  2 +-
 meson.build               | 13 +++++++------
 po/meson.build            |  2 +-
 src/meson.build           | 14 +++++++-------
 tests/meson.build         |  2 +-
 7 files changed, 20 insertions(+), 19 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 7f76c582..96208833 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -39,7 +39,7 @@ i18n.merge_file(
 configure_file(
   input: 'org.gnome.eog.gschema.xml.in',
   output: '@BASENAME@',
-  configuration: {'GETTEXT_PACKAGE': meson.project_name()},
+  configuration: {'GETTEXT_PACKAGE': eog_name},
   install: true,
   install_dir: gio_schemasdir,
 )
diff --git a/doc/reference/meson.build b/doc/reference/meson.build
index 716955c0..8bbef69d 100644
--- a/doc/reference/meson.build
+++ b/doc/reference/meson.build
@@ -28,8 +28,8 @@ version_xml = configure_file(
 )
 
 gnome.gtkdoc(
-  meson.project_name(),
-  main_xml: meson.project_name() + '-docs.xml',
+  eog_name,
+  main_xml: eog_name + '-docs.xml',
   src_dir: src_inc,
   ignore_headers: private_headers,
   dependencies: libeog_dep,
diff --git a/help/meson.build b/help/meson.build
index bd278cde..d349df40 100644
--- a/help/meson.build
+++ b/help/meson.build
@@ -43,7 +43,7 @@ media = [
 ]
 
 gnome.yelp(
-  meson.project_name(),
+  eog_name,
   sources: sources,
   media: media,
 )
diff --git a/meson.build b/meson.build
index f9f09f67..720d8635 100644
--- a/meson.build
+++ b/meson.build
@@ -6,12 +6,13 @@ project(
   meson_version: '>= 0.53.0',
 )
 
+eog_name = meson.project_name()
 eog_version = meson.project_version()
 version_array = eog_version.split('.')
 eog_major_version = version_array[0].to_int()
 
 eog_api_version = '3.0'
-eog_api_name = '@0@-@1@'.format(meson.project_name(), eog_api_version)
+eog_api_name = '@0@-@1@'.format(eog_name, eog_api_version)
 
 eog_gir_ns = 'Eog'
 eog_gir_version = '1.0'
@@ -21,9 +22,9 @@ eog_datadir = get_option('datadir')
 eog_libdir = get_option('libdir')
 eog_localedir = get_option('localedir')
 
-eog_pkgdatadir = eog_datadir / meson.project_name()
-eog_pkglibdir = eog_libdir / meson.project_name()
-eog_pkglibexecdir = get_option('libexecdir') / meson.project_name()
+eog_pkgdatadir = eog_datadir / eog_name
+eog_pkglibdir = eog_libdir / eog_name
+eog_pkglibexecdir = get_option('libexecdir') / eog_name
 
 eog_pluginsdir = eog_pkglibdir / 'plugins'
 
@@ -58,10 +59,10 @@ set_defines = [
   ['APPLICATION_ID', application_id],
   ['PROFILE', profile],
   # package
-  ['PACKAGE', meson.project_name()],
+  ['PACKAGE', eog_name],
   ['VERSION', eog_version],
   # i18n
-  ['GETTEXT_PACKAGE', meson.project_name()],
+  ['GETTEXT_PACKAGE', eog_name],
 ]
 
 foreach define: set_defines
diff --git a/po/meson.build b/po/meson.build
index 527d2549..740b3935 100644
--- a/po/meson.build
+++ b/po/meson.build
@@ -1,2 +1,2 @@
-i18n.gettext(meson.project_name(), preset: 'glib',
+i18n.gettext(eog_name, preset: 'glib',
              args: [ '--keyword=Description' ])
diff --git a/src/meson.build b/src/meson.build
index d7ddcad2..ef398d22 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -94,7 +94,7 @@ endif
 
 install_headers(
   headers,
-  subdir: eog_api_name / meson.project_name(),
+  subdir: eog_api_name / eog_name,
 )
 
 sources += gnome.compile_resources(
@@ -133,7 +133,7 @@ deps = common_deps + [
 ]
 
 cflags = [
-  '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name().to_upper()),
+  '-DG_LOG_DOMAIN="@0@"'.format(eog_name.to_upper()),
   '-DEOG_DATA_DIR="@0@"'.format(eog_prefix / eog_pkgdatadir),
   '-DEOG_PLUGIN_DIR="@0@"'.format(eog_prefix / eog_pluginsdir),
   '-DLIBDIR="@0@"'.format(eog_prefix / eog_libdir),
@@ -155,7 +155,7 @@ if enable_x11
 endif
 
 libeog = shared_library(
-  meson.project_name(),
+  eog_name,
   sources: sources,
   include_directories: top_inc,
   dependencies: deps,
@@ -177,20 +177,20 @@ pkg.generate(
   version: eog_version,
   name: 'Eye of GNOME',
   description: 'The GNOME Image Viewer',
-  filebase: meson.project_name(),
+  filebase: eog_name,
   subdirs: eog_api_name,
   requires: 'gtk+-3.0',
   variables: [
     'exec_prefix=${prefix}',
     # the equivalent of eog_pluginsdir but using ${libdir} for variable replacement
-    'pluginsdir=' + ('${libdir}' / meson.project_name() / 'plugins'),
+    'pluginsdir=' + ('${libdir}' / eog_name / 'plugins'),
   ],
 )
 
 deps = [libeog_dep]
 
 cflags = [
-  '-DG_LOG_DOMAIN="@0@"'.format(meson.project_name().to_upper()),
+  '-DG_LOG_DOMAIN="@0@"'.format(eog_name.to_upper()),
   '-DEOG_LOCALE_DIR="@0@"'.format(eog_prefix / eog_localedir),
 ]
 
@@ -199,7 +199,7 @@ if enable_introspection
 endif
 
 eog = executable(
-  meson.project_name(),
+  eog_name,
   'main.c',
   include_directories: top_inc,
   dependencies: deps,
diff --git a/tests/meson.build b/tests/meson.build
index f9ab2b6d..7caf2579 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -1,5 +1,5 @@
 tests_execdir = eog_pkglibexecdir / 'installed-tests'
-tests_metadir = eog_datadir / 'installed-tests' / meson.project_name()
+tests_metadir = eog_datadir / 'installed-tests' / eog_name
 
 tests_data = files(
   'actions.feature',


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