[tracker: 1/2] meson: Use pkgconfig module to generate files



commit a0e9efb0cfeb268677312c9848e8ed12f4f70cbd
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Tue Sep 24 22:29:47 2019 +0200

    meson: Use pkgconfig module to generate files
    
    Meson provides a pkgconfig module to generate .pc files without any
    need to defile stub files, but reusing libraries.
    
    So just use this convenience feature instead of manually redefininig
    variables and files.

 meson.build                                  | 16 ++--------------
 src/libtracker-control/meson.build           | 14 ++++++++------
 src/libtracker-control/tracker-control.pc.in | 11 -----------
 src/libtracker-miner/meson.build             | 14 ++++++++------
 src/libtracker-miner/tracker-miner.pc.in     | 11 -----------
 src/libtracker-sparql-backend/meson.build    | 19 +++++++++++++++++++
 src/libtracker-sparql/meson.build            |  7 -------
 src/libtracker-sparql/tracker-sparql.pc.in   | 19 -------------------
 utils/trackertestutils/meson.build           |  2 --
 9 files changed, 37 insertions(+), 76 deletions(-)
---
diff --git a/meson.build b/meson.build
index 6d2ecb0e5..b7049890f 100644
--- a/meson.build
+++ b/meson.build
@@ -4,6 +4,7 @@ project('tracker', 'c', 'vala',
 
 gnome = import('gnome')
 i18n = import('i18n')
+pkg = import('pkgconfig')
 cc = meson.get_compiler('c')
 
 # This is the X.Y used in -llibtracker-FOO-X.Y
@@ -267,22 +268,9 @@ conf.set('TRACKER_MICRO_VERSION', tracker_micro_version)
 conf.set('TRACKER_INTERFACE_AGE', 0)
 conf.set('TRACKER_BINARY_AGE', 100 * tracker_minor_version + tracker_micro_version)
 
-# Config that goes in some other generated files (.desktop, .pc, etc)
+# Config that goes in some other generated files (.desktop, .service, etc)
 conf.set('abs_top_builddir', meson.current_build_dir())
-conf.set('exec_prefix', get_option('prefix'))
-conf.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
-conf.set('datadir', datadir)
-conf.set('datarootdir', join_paths(get_option('prefix'), get_option('datadir')))
-conf.set('dbus_services_dir', dbus_services_dir)
-conf.set('includedir', join_paths(get_option('prefix'), get_option('includedir')))
-conf.set('libdir', libdir)
 conf.set('libexecdir', join_paths(get_option('prefix'), get_option('libexecdir')))
-conf.set('prefix', get_option('prefix'))
-conf.set('TRACKER_API_VERSION', tracker_api_version)
-conf.set('VERSION', meson.project_version())
-conf.set('tracker_store', join_paths ('${libexecdir}', 'tracker-store'))
-conf.set('ontologies_dir', join_paths ('${datadir}', 'tracker', 'ontologies'))
-conf.set('domain_ontologies_dir', join_paths('${datadir}', 'tracker', 'domain-ontologies'))
 
 configure_file(input: 'config.h.meson.in',
                output: 'config.h',
diff --git a/src/libtracker-control/meson.build b/src/libtracker-control/meson.build
index 7efc65168..49f51a084 100644
--- a/src/libtracker-control/meson.build
+++ b/src/libtracker-control/meson.build
@@ -42,12 +42,14 @@ gnome.generate_vapi(
       install : true,
     )
 
-configure_file(
-    input: 'tracker-control.pc.in',
-    output: 'tracker-control-@0@.pc'.format(tracker_api_version),
-    configuration: conf,
-    install: true,
-    install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'pkgconfig'))
+pkg.generate(libtracker_control,
+    description: 'A library to monitor/control tracker miners',
+    requires: [glib, gio],
+    subdirs: 'tracker-' + tracker_api_version,
+    variables: [
+        'exec_prefix=${prefix}'
+    ],
+)
 
 install_headers (headers,
     subdir: 'tracker-@0@/libtracker-control'.format(tracker_api_version))
diff --git a/src/libtracker-miner/meson.build b/src/libtracker-miner/meson.build
index a3bd2d9d9..53e230013 100644
--- a/src/libtracker-miner/meson.build
+++ b/src/libtracker-miner/meson.build
@@ -101,12 +101,14 @@ gnome.generate_vapi(
       install : true,
     )
 
-configure_file(
-    input: 'tracker-miner.pc.in',
-    output: 'tracker-miner-@0@.pc'.format(tracker_api_version),
-    configuration: conf,
-    install: true,
-    install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'pkgconfig'))
+pkg.generate(libtracker_miner,
+    description: 'A library to develop tracker data miners',
+    requires: [libtracker_sparql],
+    subdirs: 'tracker-' + tracker_api_version,
+    variables: [
+        'exec_prefix=${prefix}'
+    ],
+)
 
 install_headers(miner_headers, subdir: 'tracker-@0@/libtracker-miner'.format(tracker_api_version))
 
diff --git a/src/libtracker-sparql-backend/meson.build b/src/libtracker-sparql-backend/meson.build
index c30d182d5..633941e31 100644
--- a/src/libtracker-sparql-backend/meson.build
+++ b/src/libtracker-sparql-backend/meson.build
@@ -25,6 +25,25 @@ tracker_sparql_dep = declare_dependency(
     dependencies: [tracker_common_dep],
 )
 
+pkg.generate(libtracker_sparql,
+    description: 'Tracker : A library to perform SPARQL queries and updates in the Tracker Store',
+    requires: [glib, gio, gobject, gmodule],
+    subdirs: [
+        'tracker-' + tracker_api_version,
+        'tracker-' + tracker_api_version / 'libtracker-sparql',
+    ],
+    variables: [
+        'exec_prefix=${prefix}',
+        'libexecdir=${prefix}' / get_option('libexecdir'),
+        'tracker_store=${libexecdir}' / 'tracker-store',
+        'datadir=${prefix}' / get_option('datadir'),
+        'tracker_datadir=${datadir}' / 'tracker',
+        'ontologies_dir=' + tracker_ontologies_dir,
+        'domain_ontologies_dir=${tracker_datadir}' / 'domain-ontologies',
+        'dbus_services_dir=' + dbus_services_dir,
+    ],
+)
+
 # The introspection generation for libtracker-sparql is awkward because we have
 # both C and Vala code, and we have to generate an introspection repo for each
 # one separately and then combine them together manually.
diff --git a/src/libtracker-sparql/meson.build b/src/libtracker-sparql/meson.build
index 71b5f0272..2bd750f36 100644
--- a/src/libtracker-sparql/meson.build
+++ b/src/libtracker-sparql/meson.build
@@ -89,13 +89,6 @@ tracker_sparql_intermediate_dep = declare_dependency(
     dependencies: [ tracker_sparql_intermediate_dependencies, libtracker_sparql_c_vapi_dep ],
 )
 
-configure_file(
-    input: 'tracker-sparql.pc.in',
-    output: 'tracker-sparql-@0@.pc'.format(tracker_api_version),
-    configuration: conf,
-    install: true,
-    install_dir: join_paths(get_option('prefix'), get_option('libdir'), 'pkgconfig'))
-
 install_headers(
     libtracker_sparql_c_public_headers,
     'tracker-ontologies.h',
diff --git a/utils/trackertestutils/meson.build b/utils/trackertestutils/meson.build
index 78c6fa59d..501b7f0ec 100644
--- a/utils/trackertestutils/meson.build
+++ b/utils/trackertestutils/meson.build
@@ -1,5 +1,3 @@
-pkg = import('pkgconfig')
-
 sources = [
   '__init__.py',
   'dbusdaemon.py',


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