[tracker: 2/3] build: Generalize hack to ensure soup modules are a dependency of GIR




commit ffaecd122e0f123aafd8849a4b616bcc6c081921
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Mar 29 16:15:27 2022 +0200

    build: Generalize hack to ensure soup modules are a dependency of GIR
    
    We want to avoid meson version bumps, but this hack to ensure that GIR
    generation depends on the soup modules (since they will be pulled at
    runtime by g-ir-scanner during introspection) does not work across all
    meson versions.
    
    Use different hacks dependent on the meson version, so that the modules
    are a build-time dependency of the GIR target.

 src/libtracker-sparql/meson.build | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/src/libtracker-sparql/meson.build b/src/libtracker-sparql/meson.build
index 358084404..629ba0c2e 100644
--- a/src/libtracker-sparql/meson.build
+++ b/src/libtracker-sparql/meson.build
@@ -206,19 +206,29 @@ pkg.generate(libtracker_sparql,
     ],
 )
 
-# This custom target has the only purpose to inject a dependency from
-# the libtracker_sparql_modules into the tarcker_sparql_gir target to
-# force meson to build the loadable shared modules before attempting
-# to run g-ir-scanner.
-libtracker_sparql_modules_stamp = custom_target('libtracker-sparql-modules-stamp',
-    output: 'tracker-sparql-modules-stamp.c',
-    command: ['touch', '@OUTPUT@'],
-    depends: libtracker_sparql_modules,
-)
-
 if get_option('introspection').enabled()
+    # These are various hacks to ensure the GIR file depends on the
+    # remote connection modules as they are needed at g-ir-scanner
+    # runtime. Different meson versions need different hacks.
+    introspection_extra_sources = []
+    introspection_extra_deps = []
+
+    if meson.version().version_compare('>=0.59')
+        introspection_extra_sources += custom_target('libtracker-sparql-modules-stamp',
+            output: 'tracker-sparql-modules-stamp.c',
+            command: ['touch', '@OUTPUT@'],
+            depends: libtracker_sparql_modules)
+    else
+        introspection_extra_deps += libtracker_sparql_modules
+    endif
+
     tracker_sparql_gir = gnome.generate_gir(libtracker_sparql,
-        sources: [libtracker_sparql_c_sources, libtracker_sparql_c_public_headers, 
libtracker_sparql_modules_stamp],
+        sources: [
+            libtracker_sparql_c_sources,
+            libtracker_sparql_c_public_headers,
+            introspection_extra_sources,
+        ],
+        dependencies: introspection_extra_deps,
         nsversion: tracker_api_version,
         namespace: 'Tracker',
         identifier_prefix: 'Tracker',


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