[tracker: 1/2] meson: Add options to define whether to install and where test utils



commit 7eb6f3c80c00402b00395eadd003ea583d16bca6
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Sep 17 14:22:44 2019 +0200

    meson: Add options to define whether to install and where test utils
    
    Since commit 8ae99192 we provide tracker test utils python modules.
    These are installed by default in tracker internal libdir, and as per meson
    default this is an arch-dependent path, while the test utils aren't.
    
    So in some distributions, not to provide such files in multiple packages for
    each architecture, we'd need to install those files somewhere else that is
    not arch-dependent.
    
    Unfortunately meson doesn't provide such path by default (which ideally
    would be /usr/lib/tracker-${abi-version}), and I think isn't correct either
    to install such files into the datadir, so in order to make this path
    customizable and at the same time to make it possible to locate, provide
    meson options and build a pkg config file for it, providing the python path
    variable that should be used.

 meson_options.txt                  |  4 ++++
 utils/trackertestutils/meson.build | 23 +++++++++++++++++++++--
 2 files changed, 25 insertions(+), 2 deletions(-)
---
diff --git a/meson_options.txt b/meson_options.txt
index fa1ce51dc..d4b3b2a81 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -22,3 +22,7 @@ option('dbus_services', type: 'string', value: '',
        description: 'Directory to install D-Bus .service files (leave blank to use the value from 
dbus-1.pc)')
 option('systemd_user_services', type: 'string', value: 'yes',
        description: 'Directory to install systemd user .service files (or "yes" for default directory, "no" 
to disable installation)')
+option('test_utils', type: 'boolean', value: true,
+       description: 'Whether to install the tracker test utils')
+option('test_utils_dir', type: 'string', value: '',
+       description: 'Directory to install tracker test utils (or empty to use the default)')
diff --git a/utils/trackertestutils/meson.build b/utils/trackertestutils/meson.build
index e8ab94c72..78c6fa59d 100644
--- a/utils/trackertestutils/meson.build
+++ b/utils/trackertestutils/meson.build
@@ -1,3 +1,5 @@
+pkg = import('pkgconfig')
+
 sources = [
   '__init__.py',
   'dbusdaemon.py',
@@ -7,5 +9,22 @@ sources = [
   'psutil_mini.py',
 ]
 
-install_data(sources,
-  install_dir: join_paths(tracker_internal_libs_dir, 'trackertestutils'))
+if get_option('test_utils')
+  testutils_dir = get_option('test_utils_dir')
+
+  if testutils_dir == ''
+    arch_independent_libdir = \
+      get_option('prefix') / 'lib' / 'tracker-' + tracker_api_version
+    testutils_dir = join_paths(arch_independent_libdir, 'trackertestutils')
+  endif
+
+  install_data(sources, install_dir: testutils_dir)
+
+  pkg.generate(
+    name: 'tracker-testutils-' + tracker_api_version,
+    description: 'tracker test utilities',
+    variables: [
+      'python_path=' + testutils_dir
+    ]
+  )
+endif


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