[tracker: 1/3] libtracker-sparql: Fix libtracker-remote-soup{2, 3} modules linking
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker: 1/3] libtracker-sparql: Fix libtracker-remote-soup{2, 3} modules linking
- Date: Wed, 30 Mar 2022 10:40:43 +0000 (UTC)
commit 471f7fd87da2fea4aeebdddb3579e95a14208647
Author: Daniele Nicolodi <daniele grinta net>
Date: Thu Mar 24 21:44:59 2022 +0100
libtracker-sparql: Fix libtracker-remote-soup{2,3} modules linking
The modules should link dynamically and not statically with
libteacker-sparql. Linking statically results in the modules and the
shared library to export definitions for the same GObjects, resulting
in type registration errors.
The tracker-remote modules however need access to the private
TrackerSerializer classes. Unless these GObject are made public, their
definition must be linked in the modules too. As the code implementing
TrackerSerializer and the specialized version is pretty small, the
simplest solution is to compile the sources twice, without going
through an intermediate library. The definitions being private to
libtracker-sparql and to the libtracker-remote-soup{2,3} modules,
having two defintions for them does not cause issues.
Fixes #358 and likely #350 too.
src/libtracker-sparql/meson.build | 109 +++++++++++++++++++++++---------------
1 file changed, 65 insertions(+), 44 deletions(-)
---
diff --git a/src/libtracker-sparql/meson.build b/src/libtracker-sparql/meson.build
index 668e21f5a..358084404 100644
--- a/src/libtracker-sparql/meson.build
+++ b/src/libtracker-sparql/meson.build
@@ -90,24 +90,64 @@ install_data(
subdir('bus')
subdir('direct')
-tracker_remote_dependencies = [json_glib, libxml2]
+libtracker_sparql = library('tracker-sparql-' + tracker_api_version,
+ '../libtracker-common/libtracker-common.vapi',
+ '../libtracker-data/libtracker-data.vapi',
+ 'direct/tracker-direct.vapi',
+ 'tracker-backend.vala',
+ 'tracker-remote-module.c',
+ tracker_gresources,
+
+ gnu_symbol_visibility: 'hidden',
+
+ soversion: soversion,
+ version: libversion,
+
+ install: true,
+ install_rpath: tracker_internal_libs_dir,
-libtracker_sparql_remote_c_sources = files (
+ c_args: [
+ '-include', 'libtracker-sparql/tracker-private.h',
+ '-DPRIVATE_LIBDIR="@0@"'.format(tracker_internal_libs_dir),
+ '-DBUILD_LIBDIR="@0@"'.format(meson.current_build_dir()),
+ '-DBUILDROOT="@0@"'.format(meson.build_root()),
+ ],
+
+ link_whole: [libtracker_sparql_intermediate],
+
+ dependencies: [tracker_common_dep, tracker_sparql_bus_dep, tracker_sparql_direct_dep,
tracker_sparql_vapi_dep, gmodule, libdl],
+)
+
+tracker_sparql_dep = declare_dependency(
+ link_with: libtracker_sparql,
+ include_directories: srcinc,
+ dependencies: [glib, gio],
+)
+
+libtracker_sparql_remote_c_sources = files(
'tracker-endpoint-http.c',
'remote/tracker-remote-statement.c',
+ 'tracker-serializer.c',
+ 'tracker-serializer-json.c',
+ 'tracker-serializer-trig.c',
+ 'tracker-serializer-turtle.c',
+ 'tracker-serializer-xml.c',
)
-remote_sources = [
- libtracker_sparql_remote_c_sources,
+libtracker_sparql_remote_vala_sources = files(
'remote/tracker-remote.vapi',
'remote/tracker-json-cursor.vala',
'remote/tracker-xml-cursor.vala',
'remote/tracker-remote.vala',
-]
+)
+
+libtracker_sparql_modules = []
if libsoup2.found()
- libtracker_remote_soup2 = shared_module('tracker-remote-soup2', remote_sources,
- dependencies: tracker_remote_dependencies + [tracker_common_dep, tracker_sparql_intermediate_dep,
libsoup2],
+ libtracker_remote_soup2 = shared_module('tracker-remote-soup2',
+ libtracker_sparql_remote_c_sources, libtracker_sparql_remote_vala_sources,
+ dependencies: [json_glib, libxml2, tracker_common_dep, tracker_sparql_dep,
+ tracker_sparql_vapi_dep, tracker_data_dep, libsoup2],
c_args: tracker_c_args + [
'-include', 'config.h',
'-include', 'libtracker-sparql/tracker-private.h',
@@ -124,11 +164,14 @@ if libsoup2.found()
install_dir: tracker_internal_libs_dir,
name_suffix: 'so',
)
+ libtracker_sparql_modules += libtracker_remote_soup2
endif
if libsoup3.found()
- libtracker_remote_soup3 = shared_module('tracker-remote-soup3', remote_sources,
- dependencies: tracker_remote_dependencies + [tracker_common_dep, tracker_sparql_intermediate_dep,
libsoup3],
+ libtracker_remote_soup3 = shared_module('tracker-remote-soup3',
+ libtracker_sparql_remote_c_sources, libtracker_sparql_remote_vala_sources,
+ dependencies: [json_glib, libxml2, tracker_common_dep, tracker_sparql_dep,
+ tracker_sparql_vapi_dep, tracker_data_dep, libsoup3],
c_args: tracker_c_args + [
'-include', 'config.h',
'-include', 'libtracker-sparql/tracker-private.h',
@@ -144,42 +187,9 @@ if libsoup3.found()
install_dir: tracker_internal_libs_dir,
name_suffix: 'so',
)
+ libtracker_sparql_modules += libtracker_remote_soup3
endif
-libtracker_sparql = library('tracker-sparql-' + tracker_api_version,
- '../libtracker-common/libtracker-common.vapi',
- '../libtracker-data/libtracker-data.vapi',
- 'direct/tracker-direct.vapi',
- 'tracker-backend.vala',
- 'tracker-remote-module.c',
- tracker_gresources,
-
- gnu_symbol_visibility: 'hidden',
-
- soversion: soversion,
- version: libversion,
-
- install: true,
- install_rpath: tracker_internal_libs_dir,
-
- c_args: [
- '-include', 'libtracker-sparql/tracker-private.h',
- '-DPRIVATE_LIBDIR="@0@"'.format(tracker_internal_libs_dir),
- '-DBUILD_LIBDIR="@0@"'.format(meson.current_build_dir()),
- '-DBUILDROOT="@0@"'.format(meson.build_root()),
- ],
-
- link_whole: [libtracker_sparql_intermediate],
-
- dependencies: [tracker_common_dep, tracker_sparql_bus_dep, tracker_sparql_direct_dep,
tracker_sparql_vapi_dep, gmodule, libdl],
-)
-
-tracker_sparql_dep = declare_dependency(
- link_with: libtracker_sparql,
- include_directories: srcinc,
- dependencies: [glib, gio],
-)
-
pkg.generate(libtracker_sparql,
description: 'Tracker : A SPARQL triple store library',
requires: [glib, gio, gobject],
@@ -196,9 +206,19 @@ 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()
tracker_sparql_gir = gnome.generate_gir(libtracker_sparql,
- sources: libtracker_sparql_c_sources + libtracker_sparql_c_public_headers,
+ sources: [libtracker_sparql_c_sources, libtracker_sparql_c_public_headers,
libtracker_sparql_modules_stamp],
nsversion: tracker_api_version,
namespace: 'Tracker',
identifier_prefix: 'Tracker',
@@ -213,4 +233,5 @@ if get_option('introspection').enabled()
],
export_packages: 'tracker-sparql-3.0')
endif
+
tracker_sparql_uninstalled_dir = meson.current_build_dir()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]