[planner: 25/40] build: Use directory helper variables throughout




commit ed337d6b14cc0e4ae2a08219e25fd801aae5a5e4
Author: Mart Raudsepp <leio gentoo org>
Date:   Wed Mar 4 15:50:17 2020 +0200

    build: Use directory helper variables throughout
    
    Instead of doing the same join_paths everywhere, define the paths at
    toplevel and use those everywhere. Also use the / operator instead of
    join_paths as a meson >=0.49 feature while at it. As a side-effect,
    this also fixes path operator in some path components in the
    join_paths calls, which should have been separate arguments before
    to theoretically support Windows.

 data/dtd/meson.build         |  4 ++--
 data/glade/meson.build       |  4 ++--
 data/images/meson.build      | 10 +++++-----
 data/meson.build             |  2 +-
 data/sql/meson.build         |  4 ++--
 data/stylesheets/meson.build |  4 ++--
 data/ui/meson.build          |  4 ++--
 docs/libplanner/meson.build  | 10 +++++-----
 examples/meson.build         |  4 ++--
 libplanner/meson.build       |  8 ++++----
 meson.build                  | 26 ++++++++++++++++++--------
 src/meson.build              | 12 ++++++------
 12 files changed, 51 insertions(+), 41 deletions(-)
---
diff --git a/data/dtd/meson.build b/data/dtd/meson.build
index 60de83bb..86c62894 100644
--- a/data/dtd/meson.build
+++ b/data/dtd/meson.build
@@ -2,6 +2,6 @@ dtd_data = [
   'mrproject-0.5.1.dtd',
   'mrproject-0.6.dtd',
 ]
-install_data(files(dtd_data),
-  install_dir: join_paths(get_option('datadir'), 'planner/dtd')
+install_data(dtd_data,
+  install_dir: planner_pkgdatadir / 'dtd'
 )
diff --git a/data/glade/meson.build b/data/glade/meson.build
index 3669c93f..4a4b38dc 100644
--- a/data/glade/meson.build
+++ b/data/glade/meson.build
@@ -14,6 +14,6 @@ glade_data = [
   'task-date-widget.glade',
   'eds.glade',
 ]
-install_data(files(glade_data),
-  install_dir: join_paths(get_option('datadir'), 'planner/glade')
+install_data(glade_data,
+  install_dir: planner_pkgdatadir / 'glade'
 )
diff --git a/data/images/meson.build b/data/images/meson.build
index cc7d9239..2dc3d497 100644
--- a/data/images/meson.build
+++ b/data/images/meson.build
@@ -17,18 +17,18 @@ images_data = [
   '24_task_up.png',
   'gnome-planner.png',
 ]
-install_data(files(images_data),
-  install_dir: join_paths(get_option('datadir'), 'planner/images')
+install_data(images_data,
+  install_dir: planner_pkgdatadir / 'images'
 )
 
 install_data('gnome-mime-application-x-planner.png',
-  install_dir: join_paths(get_option('datadir'), 'icons/hicolor/48x48/mimetypes')
+  install_dir: planner_datadir / 'icons' / 'hicolor' / '48x48' / 'mimetypes'
 )
 
 install_data('gnome-planner.png',
-  install_dir: join_paths(get_option('datadir'), 'icons/hicolor/48x48/apps')
+  install_dir: planner_datadir / 'icons' / 'hicolor' / '48x48' / 'apps'
 )
 
 install_data('gnome-planner.svg',
-  install_dir: join_paths(get_option('datadir'), 'icons/hicolor/scalable/apps')
+  install_dir: planner_datadir / 'icons' / 'hicolor' / 'scalable' / 'apps'
 )
diff --git a/data/meson.build b/data/meson.build
index c7c327c4..f313dfda 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -12,5 +12,5 @@ i18n.merge_file(
   type: 'desktop',
   po_dir: po_dir,
   install: true,
-  install_dir: join_paths(get_option('datadir'), 'applications'),
+  install_dir: planner_datadir / 'applications',
 )
diff --git a/data/sql/meson.build b/data/sql/meson.build
index fee13379..4b29a615 100644
--- a/data/sql/meson.build
+++ b/data/sql/meson.build
@@ -5,6 +5,6 @@ sql_data = [
   'upgrade-0.11-0.13.sql',
   'upgrade-0.6.x-0.11.sql',
 ]
-install_data(files(sql_data),
-  install_dir: join_paths(get_option('datadir'), 'planner/sql')
+install_data(sql_data,
+  install_dir: planner_pkgdatadir / 'sql'
 )
diff --git a/data/stylesheets/meson.build b/data/stylesheets/meson.build
index 44642e14..8067f157 100644
--- a/data/stylesheets/meson.build
+++ b/data/stylesheets/meson.build
@@ -10,6 +10,6 @@ stylesheets_data = [
   'msp2planner.xsl',
   'localizable.xml',
 ]
-install_data(files(stylesheets_data),
-  install_dir: join_paths(get_option('datadir'), 'planner/stylesheets')
+install_data(stylesheets_data,
+  install_dir: planner_pkgdatadir / 'stylesheets'
 )
diff --git a/data/ui/meson.build b/data/ui/meson.build
index 5f7360f3..be438ead 100644
--- a/data/ui/meson.build
+++ b/data/ui/meson.build
@@ -10,6 +10,6 @@ ui_data = [
   'eds-plugin.ui',
   'msp-plugin.ui',
 ]
-install_data(files(ui_data),
-  install_dir: join_paths(get_option('datadir'), 'planner/ui')
+install_data(ui_data,
+  install_dir: planner_pkgdatadir / 'ui'
 )
diff --git a/docs/libplanner/meson.build b/docs/libplanner/meson.build
index f8a12732..25c87140 100644
--- a/docs/libplanner/meson.build
+++ b/docs/libplanner/meson.build
@@ -1,7 +1,7 @@
 doc_module = 'libplanner'
-docpath = join_paths(get_option('datadir'), 'gtk-doc', 'html')
+docpath = planner_datadir / 'gtk-doc' / 'html'
 glib_prefix = glib_dep.get_pkgconfig_variable('prefix')
-glib_docpath = join_paths(glib_prefix, 'share', 'gtk-doc', 'html')
+glib_docpath = glib_prefix / 'share' / 'gtk-doc' / 'html'
 
 ignore_headers = [
   'mrp-file-module.h',
@@ -32,9 +32,9 @@ mkdb_args = [
 
 fixxref_args = [
   '--html-dir=@0@'.format(docpath),
-  '--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
-  '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
-  '--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
+  '--extra-dir=@0@'.format(glib_docpath / 'glib'),
+  '--extra-dir=@0@'.format(glib_docpath / 'gobject'),
+  '--extra-dir=@0@'.format(glib_docpath / 'gio'),
 ]
 
 gnome.gtkdoc(
diff --git a/examples/meson.build b/examples/meson.build
index d2d1fe72..77d52091 100644
--- a/examples/meson.build
+++ b/examples/meson.build
@@ -3,7 +3,7 @@ examples_data = [
   'kitchen.planner',
 ]
 if get_option('examples')
-  install_data(files(examples_data),
-    install_dir: join_paths(get_option('datadir'), 'doc/planner'),
+  install_data(examples_data,
+    install_dir: planner_datadir / 'doc' / 'planner',
   )
 endif
diff --git a/libplanner/meson.build b/libplanner/meson.build
index 1be74945..635d10ad 100644
--- a/libplanner/meson.build
+++ b/libplanner/meson.build
@@ -46,7 +46,7 @@ libstorage_mrproject_module = shared_module('storage-mrproject-1', [libstorage_m
   dependencies: [libplanner_dep],
   include_directories: [toplevel_inc],
   install: true,
-  install_dir: join_paths(get_option('libdir'), 'planner/storage-modules'),
+  install_dir: planner_storagemoduledir,
 )
 
 if gda_dep.found()
@@ -55,7 +55,7 @@ if gda_dep.found()
     dependencies: [libplanner_dep, gda_dep],
     include_directories: [toplevel_inc],
     install: true,
-    install_dir: join_paths(get_option('libdir'), 'planner/storage-modules'),
+    install_dir: planner_storagemoduledir,
   )
 endif
 
@@ -67,7 +67,7 @@ libmrp_xml_module = shared_module('mrp-xml', [libmrp_xml_srcs],
   dependencies: [libplanner_dep],
   include_directories: [toplevel_inc],
   install: true,
-  install_dir: join_paths(get_option('libdir'), 'planner/file-modules'),
+  install_dir: planner_filemoduledir,
 )
 libmrp_xsl_srcs = [
   'mrp-xsl.c',
@@ -76,5 +76,5 @@ libmrp_xsl_module = shared_module('mrp-xsl', [libmrp_xsl_srcs],
   dependencies: [libplanner_dep] + [xslt_dep, exslt_dep],
   include_directories: [toplevel_inc],
   install: true,
-  install_dir: join_paths(get_option('libdir'), 'planner/file-modules'),
+  install_dir: planner_filemoduledir,
 )
diff --git a/meson.build b/meson.build
index d2f4ac4e..b42be87d 100644
--- a/meson.build
+++ b/meson.build
@@ -2,9 +2,20 @@ project('planner',
   'c',
   version: '0.14.6',
   license: 'GPL-2+',
-  meson_version: '>= 0.48.0',
+  meson_version: '>= 0.49',
 )
 
+planner_prefix = get_option('prefix')
+planner_libdir = planner_prefix / get_option('libdir')
+planner_pkglibdir = planner_libdir / 'planner'
+planner_plugindir = planner_pkglibdir / 'plugins'
+planner_storagemoduledir = planner_pkglibdir / 'storage-modules'
+planner_filemoduledir = planner_pkglibdir / 'file-modules'
+planner_datadir = planner_prefix / get_option('datadir')
+planner_pkgdatadir = planner_datadir / 'planner'
+planner_localedir = planner_prefix / get_option('localedir')
+po_dir = meson.source_root() / 'po'
+
 cc = meson.get_compiler('c')
 pygobject_codegen = find_program('pygobject-codegen-2.0', required: get_option('python'))
 
@@ -12,16 +23,15 @@ i18n = import('i18n')
 gnome = import('gnome')
 pymod = import('python')
 
-po_dir = join_paths(meson.source_root(), 'po')
-
 conf_data = configuration_data()
 conf_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
 conf_data.set_quoted('VERSION', meson.project_version())
-conf_data.set_quoted('GNOMELOCALEDIR', join_paths(get_option('prefix'),get_option('localedir')))
-conf_data.set_quoted('PLUGINDIR', join_paths(get_option('prefix'),get_option('libdir'), 'planner/plugins'))
-conf_data.set_quoted('STORAGEMODULEDIR', join_paths(get_option('prefix'),get_option('libdir'), 
'planner/storage-modules'))
-conf_data.set_quoted('FILEMODULESDIR', join_paths(get_option('prefix'),get_option('libdir'), 
'planner/file-modules'))
-conf_data.set_quoted('DATADIR', join_paths(get_option('prefix'),get_option('datadir'), 'planner'))
+conf_data.set_quoted('GNOMELOCALEDIR', planner_localedir)
+conf_data.set_quoted('PLUGINDIR', planner_plugindir)
+conf_data.set_quoted('STORAGEMODULEDIR', planner_storagemoduledir)
+conf_data.set_quoted('FILEMODULESDIR', planner_filemoduledir)
+conf_data.set_quoted('DATADIR', planner_pkgdatadir)
+
 configure_file(
   output: 'config.h',
   configuration: conf_data,
diff --git a/src/meson.build b/src/meson.build
index 31166746..33d4f90b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -102,7 +102,7 @@ if gda_dep.found()
     dependencies: [planner_deps, gda_dep],
     include_directories: [toplevel_inc],
     install: true,
-    install_dir: join_paths(get_option('libdir'), 'planner/plugins'),
+    install_dir: planner_plugindir,
   )
 endif
 
@@ -112,7 +112,7 @@ if pygtk_dep.found() and python_dep.found()
     dependencies: [planner_deps, pygtk_dep, python_dep],
     include_directories: [toplevel_inc],
     install: true,
-    install_dir: join_paths(get_option('libdir'), 'planner/plugins'),
+    install_dir: planner_plugindir,
   )
 endif
 
@@ -122,7 +122,7 @@ if libeds_dep.found()
     dependencies: [planner_deps, libeds_dep],
     include_directories: [toplevel_inc],
     install: true,
-    install_dir: join_paths(get_option('libdir'), 'planner/plugins'),
+    install_dir: planner_plugindir,
   )
 endif
 
@@ -132,7 +132,7 @@ libhtml_plugin_module = shared_module('html-plugin',
   dependencies: [planner_deps],
   include_directories: [toplevel_inc],
   install: true,
-  install_dir: join_paths(get_option('libdir'), 'planner/plugins'),
+  install_dir: planner_plugindir,
 )
 
 libxmlplanner_plugin_srcs = [ 'planner-xml-planner-plugin.c' ]
@@ -141,7 +141,7 @@ libxmlplanner_plugin_module = shared_module('xmlplanner-plugin',
   dependencies: [planner_deps],
   include_directories: [toplevel_inc],
   install: true,
-  install_dir: join_paths(get_option('libdir'), 'planner/plugins'),
+  install_dir: planner_plugindir,
 )
 
 libmsp_plugin_srcs = [ 'planner-msp-plugin.c' ]
@@ -150,5 +150,5 @@ libmsp_plugin_module = shared_module('msp-plugin',
   dependencies: [planner_deps],
   include_directories: [toplevel_inc],
   install: true,
-  install_dir: join_paths(get_option('libdir'), 'planner/plugins'),
+  install_dir: planner_plugindir,
 )


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