void-packages/srcpkgs/tracker/patches/fix-cross.patch

109 lines
4.0 KiB
Diff

diff --git meson.build meson.build
index 3794b1142..432445757 100644
--- meson.build
+++ meson.build
@@ -72,6 +72,7 @@ add_project_arguments(['-D', 'TRACKER_COMPILATION'],
language: 'vala')
enable_fts = get_option('fts')
+sqlite3_fts5 = get_option('sqlite3_fts5')
network_manager = dependency('libnm', required: get_option('network_manager'))
have_network_manager = network_manager.found()
@@ -88,41 +89,51 @@ have_libstemmer = libstemmer.found()
##################################################################
if enable_fts
- sqlite3_builtin_fts5_test = '''
- #include <sqlite3.h>
-
- int main (int argc, char *argv[]) {
- sqlite3 *db;
- int rc;
- rc = sqlite3_open(":memory:", &db);
- if (rc!=SQLITE_OK) return -1;
- rc = sqlite3_exec(db, "create table a(text)", 0, 0, 0);
- if (rc!=SQLITE_OK) return -1;
- rc = sqlite3_exec(db, "create virtual table t using fts5(content='a',text)", 0, 0, 0);
- if (rc!=SQLITE_OK) return -1;
- }
- '''
-
- result = cc.run(sqlite3_builtin_fts5_test,
- name: 'sqlite3 has builtin FTS5 module',
- dependencies: sqlite)
-
- if not result.compiled()
- error('Failed to compile SQLite FTS test.')
- endif
-
- if result.returncode() == 0
- message('Using sqlite3 builtin FTS module')
- sqlite3_has_builtin_fts5 = true
+ if meson.is_cross_build() and not meson.has_exe_wrapper()
+ if sqlite3_fts5 == 'auto'
+ error('Can\'t detect whether sqlite3 has builtin fts5. please set sqlite3_fts5 accordingly.')
+ elif sqlite3_fts5 == 'builtin'
+ sqlite3_has_builtin_fts5 = true
+ elif sqlite3_fts5 == 'external'
+ sqlite3_has_builtin_fts5 = false
+ endif
else
- message('FTS support was enabled but SQLite doesn\'t have the FTS module built in')
- if sqlite.version().version_compare('>= 3.20.0')
- error('sqlite3 >= 3.20.0 must be compiled with --enable-fts5 in order to get FTS support.')
+ sqlite3_builtin_fts5_test = '''
+ #include <sqlite3.h>
+
+ int main (int argc, char *argv[]) {
+ sqlite3 *db;
+ int rc;
+ rc = sqlite3_open(":memory:", &db);
+ if (rc!=SQLITE_OK) return -1;
+ rc = sqlite3_exec(db, "create table a(text)", 0, 0, 0);
+ if (rc!=SQLITE_OK) return -1;
+ rc = sqlite3_exec(db, "create virtual table t using fts5(content='a',text)", 0, 0, 0);
+ if (rc!=SQLITE_OK) return -1;
+ }
+ '''
+
+ result = cc.run(sqlite3_builtin_fts5_test,
+ name: 'sqlite3 has builtin FTS5 module',
+ dependencies: sqlite)
+
+ if not result.compiled()
+ error('Failed to compile SQLite FTS test.')
+ endif
+
+ if result.returncode() == 0
+ message('Using sqlite3 builtin FTS module')
+ sqlite3_has_builtin_fts5 = true
else
- message('sqlite3 is older than version 3.20.0, using FTS module that is bundled with Tracker')
- sqlite3_has_builtin_fts5 = false
+ message('FTS support was enabled but SQLite doesn\'t have the FTS module built in')
+ if sqlite.version().version_compare('>= 3.20.0')
+ error('sqlite3 >= 3.20.0 must be compiled with --enable-fts5 in order to get FTS support.')
+ else
+ message('sqlite3 is older than version 3.20.0, using FTS module that is bundled with Tracker')
+ sqlite3_has_builtin_fts5 = false
+ endif
endif
- endif
+ endif
else
sqlite3_has_builtin_fts5 = false
diff --git meson_options.txt meson_options.txt
index fa1ce51dc..19bfa02f3 100644
--- meson_options.txt
+++ meson_options.txt
@@ -22,3 +22,6 @@ 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('sqlite3_fts5', type: 'combo', choices: ['auto', 'builtin', 'external'], value: 'auto',
+ description: 'Whether sqlite has fts support builtin, meant for cross compilation')