[tracker/libraries: 1/3] Link to tracker-fts instead of loading it at runtime
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/libraries: 1/3] Link to tracker-fts instead of loading it at runtime
- Date: Fri, 21 Aug 2009 16:08:19 +0000 (UTC)
commit f0206c3646e7be4e64702f2d0ee01563ee9357b7
Author: Jürg Billeter <j bitron ch>
Date: Fri Aug 21 17:50:03 2009 +0200
Link to tracker-fts instead of loading it at runtime
configure.ac | 2 -
docs/manpages/tracker-store.1 | 7 ------
src/Makefile.am | 4 +-
src/libtracker-db/Makefile.am | 1 +
src/libtracker-db/tracker-db-interface-sqlite.c | 23 ++++-----------------
src/tracker-fts/Makefile.am | 12 ++++------
src/tracker-fts/tracker-fts.c | 24 +----------------------
tests/libtracker-data/tracker-ontology-test.c | 1 -
tests/libtracker-data/tracker-sparql-test.c | 1 -
utils/tracker-fts/Makefile.am | 1 +
utils/tracker-fts/tracker-fts-test.c | 12 +++-------
11 files changed, 19 insertions(+), 69 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9c9ec33..7835010 100644
--- a/configure.ac
+++ b/configure.ac
@@ -598,8 +598,6 @@ AC_CHECK_HEADERS([sys/inotify.h])
SQLITE_REQUIRED=3.5
PKG_CHECK_MODULES(SQLITE3, [sqlite3 >= $SQLITE_REQUIRED])
-AC_CHECK_LIB([sqlite3], [sqlite3_enable_load_extension], [:],
- [AC_MSG_ERROR([SQLite must be configured with --enable-load-extension.])])
AC_SUBST(SQLITE3_CFLAGS)
AC_SUBST(SQLITE3_LIBS)
diff --git a/docs/manpages/tracker-store.1 b/docs/manpages/tracker-store.1
index 1f3d0b3..9abe23e 100644
--- a/docs/manpages/tracker-store.1
+++ b/docs/manpages/tracker-store.1
@@ -83,13 +83,6 @@ This switch is only useful for debugging.
.SH ENVIRONMENT
.TP
-.B TRACKER_DB_MODULES_DIR
-This is the directory which the SQLite modules will be loaded from. At
-the moment this is only the tracker-fts module. If unset it will
-default to the correct place. This is used mainly for testing
-purposes.
-
-.TP
.B TRACKER_DB_SQL_DIR
This is the directory which tracker uses to load the .sql files from.
These are needed on each invocation of tracker-store. If unset it will
diff --git a/src/Makefile.am b/src/Makefile.am
index 86ce87f..977a8dc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,10 +4,10 @@ SUBDIRS = \
libstemmer \
libinotify \
libtracker-common \
+ tracker-fts \
libtracker-db \
libtracker-data \
libtracker \
- tracker-fts \
plugins \
tracker-store \
tracker-utils \
@@ -38,10 +38,10 @@ DIST_SUBDIRS = \
libstemmer \
libinotify \
libtracker-common \
+ tracker-fts \
libtracker-db \
libtracker-data \
libtracker \
- tracker-fts \
tracker-store \
tracker-utils \
tracker-explorer \
diff --git a/src/libtracker-db/Makefile.am b/src/libtracker-db/Makefile.am
index 01cc131..6569ad0 100644
--- a/src/libtracker-db/Makefile.am
+++ b/src/libtracker-db/Makefile.am
@@ -32,6 +32,7 @@ libtracker_db_la_LDFLAGS = \
libtracker_db_la_LIBADD = \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
+ $(top_builddir)/src/tracker-fts/libtracker-fts.la \
$(SQLITE3_LIBS) \
$(DBUS_LIBS) \
$(GCOV_LIBS) \
diff --git a/src/libtracker-db/tracker-db-interface-sqlite.c b/src/libtracker-db/tracker-db-interface-sqlite.c
index 1c54761..bcc8281 100644
--- a/src/libtracker-db/tracker-db-interface-sqlite.c
+++ b/src/libtracker-db/tracker-db-interface-sqlite.c
@@ -24,6 +24,8 @@
#include <sqlite3.h>
#include <stdlib.h>
+#include <tracker-fts/tracker-fts.h>
+
#include "tracker-db-interface-sqlite.h"
#define TRACKER_DB_INTERFACE_SQLITE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_DB_INTERFACE_SQLITE, TrackerDBInterfaceSqlitePrivate))
@@ -128,25 +130,10 @@ tracker_db_interface_sqlite_constructor (GType type,
sqlite3_extended_result_codes (priv->db, 0);
sqlite3_busy_timeout (priv->db, 100000);
- sqlite3_enable_load_extension (priv->db, 1);
-
- env_path = g_getenv ("TRACKER_DB_MODULES_DIR");
-
- if (G_LIKELY (!env_path)) {
- sqlite3_load_extension (priv->db, PKGLIBDIR "/tracker-fts.so", NULL, &err_msg);
- } else {
- gchar *filename;
-
- filename = g_build_filename (env_path, "tracker-fts.so", NULL);
- sqlite3_load_extension (priv->db, filename, NULL, &err_msg);
- g_free (filename);
- }
-
- if (err_msg) {
- g_critical ("Could not load tracker-fts extension:'%s'", err_msg);
- sqlite3_free (err_msg);
+ if (sqlite3Fts3Init (priv->db) != SQLITE_OK) {
+ g_critical ("Could not initialize tracker-fts extension");
} else {
- g_message ("Loaded tracker fts extension");
+ g_message ("Initialized tracker fts extension");
}
return object;
diff --git a/src/tracker-fts/Makefile.am b/src/tracker-fts/Makefile.am
index 686ea87..21b3d13 100644
--- a/src/tracker-fts/Makefile.am
+++ b/src/tracker-fts/Makefile.am
@@ -10,12 +10,10 @@ INCLUDES = \
$(PANGO_CFLAGS) \
$(SQLITE3_CFLAGS)
-module_flags = -module -avoid-version -no-undefined
-
tracker_fts_modulesdir = $(libdir)/tracker-$(TRACKER_API_VERSION)
-tracker_fts_modules_LTLIBRARIES = tracker-fts.la
+tracker_fts_modules_LTLIBRARIES = libtracker-fts.la
-tracker_fts_la_SOURCES = \
+libtracker_fts_la_SOURCES = \
tracker-fts.c \
tracker-fts.h \
tracker-fts-config.c \
@@ -23,10 +21,10 @@ tracker_fts_la_SOURCES = \
tracker-fts-hash.c \
tracker-fts-hash.h
-tracker_fts_la_LDFLAGS = $(module_flags)
+libtracker_fts_la_LDFLAGS = \
+ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
-tracker_fts_la_LIBADD = \
- $(top_builddir)/src/libtracker-db/libtracker-db.la \
+libtracker_fts_la_LIBADD = \
$(SQLITE3_LIBS) \
$(GTHREAD_LIBS) \
$(GCOV_LIBS) \
diff --git a/src/tracker-fts/tracker-fts.c b/src/tracker-fts/tracker-fts.c
index e37bef3..784ad13 100644
--- a/src/tracker-fts/tracker-fts.c
+++ b/src/tracker-fts/tracker-fts.c
@@ -277,7 +277,7 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#include <sqlite3ext.h>
+#include <sqlite3.h>
#include <libtracker-common/tracker-common.h>
#include <libtracker-db/tracker-db-manager.h>
@@ -286,8 +286,6 @@
#include "tracker-fts-config.h"
#include "tracker-fts-hash.h"
-SQLITE_EXTENSION_INIT1
-
/* TODO(shess) MAN, this thing needs some refactoring. At minimum, it
** would be nice to order the file better, perhaps something along the
** lines of:
@@ -429,12 +427,6 @@ static int safe_isalnum(char c){
return (c&0x80)==0 ? isalnum(c) : 0;
}
-int sqlite3_extension_init(
- sqlite3 *db,
- char **pzErrMsg,
- const sqlite3_api_routines *pApi
-);
-
typedef enum DocListType {
@@ -7805,10 +7797,6 @@ int sqlite3Fts3InitHashTable(sqlite3 *, fts3Hash *, const char *);
int sqlite3Fts3Init(sqlite3 *db){
int rc = SQLITE_OK;
- g_type_init ();
- if (!g_thread_supported ())
- g_thread_init (NULL);
-
/* Create the virtual table wrapper around the hash-table and overload
** the two scalar functions. If this is successful, register the
** module with sqlite.
@@ -7834,13 +7822,3 @@ int sqlite3Fts3Init(sqlite3 *db){
return rc;
}
-
-int sqlite3_extension_init(
- sqlite3 *db,
- char **pzErrMsg,
- const sqlite3_api_routines *pApi
-){
- SQLITE_EXTENSION_INIT2(pApi)
- return sqlite3Fts3Init(db);
-}
-
diff --git a/tests/libtracker-data/tracker-ontology-test.c b/tests/libtracker-data/tracker-ontology-test.c
index 062149b..b0de0e5 100644
--- a/tests/libtracker-data/tracker-ontology-test.c
+++ b/tests/libtracker-data/tracker-ontology-test.c
@@ -230,7 +230,6 @@ main (int argc, char **argv)
g_setenv ("XDG_DATA_HOME", current_dir, TRUE);
g_setenv ("XDG_CACHE_HOME", current_dir, TRUE);
- g_setenv ("TRACKER_DB_MODULES_DIR", TOP_BUILDDIR "/src/tracker-fts/.libs/", TRUE);
g_setenv ("TRACKER_DB_SQL_DIR", TOP_SRCDIR "/data/db/", TRUE);
g_setenv ("TRACKER_DB_ONTOLOGIES_DIR", TOP_SRCDIR "/data/ontologies/", TRUE);
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index ed909e0..5309579 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -254,7 +254,6 @@ main (int argc, char **argv)
g_setenv ("XDG_DATA_HOME", current_dir, TRUE);
g_setenv ("XDG_CACHE_HOME", current_dir, TRUE);
- g_setenv ("TRACKER_DB_MODULES_DIR", TOP_BUILDDIR "/src/tracker-fts/.libs/", TRUE);
g_setenv ("TRACKER_DB_SQL_DIR", TOP_SRCDIR "/data/db/", TRUE);
g_setenv ("TRACKER_DB_ONTOLOGIES_DIR", TOP_SRCDIR "/data/ontologies/", TRUE);
diff --git a/utils/tracker-fts/Makefile.am b/utils/tracker-fts/Makefile.am
index 920244e..86f6261 100644
--- a/utils/tracker-fts/Makefile.am
+++ b/utils/tracker-fts/Makefile.am
@@ -17,6 +17,7 @@ tracker_fts_test_SOURCES = \
tracker_fts_test_LDADD = \
$(top_builddir)/src/libtracker-common/libtracker-common.la \
+ $(top_builddir)/src/tracker-fts/libtracker-fts.la \
$(SQLITE3_LIBS) \
$(GTHREAD_LIBS) \
$(PANGO_LIBS) \
diff --git a/utils/tracker-fts/tracker-fts-test.c b/utils/tracker-fts/tracker-fts-test.c
index 2ccf2e9..53f2f8e 100644
--- a/utils/tracker-fts/tracker-fts-test.c
+++ b/utils/tracker-fts/tracker-fts-test.c
@@ -23,6 +23,7 @@
#include <stdlib.h>
#include <sqlite3.h>
+#include <tracker-fts/tracker-fts.h>
#include <glib.h>
#include <glib/gstdio.h>
@@ -66,7 +67,6 @@ main (int argc, char **argv)
sqlite3 *db;
gint rc;
gboolean db_exists = FALSE;
- gchar *st = NULL;
gchar *sql;
g_type_init ();
@@ -87,13 +87,9 @@ main (int argc, char **argv)
sqlite3_close(db);
return EXIT_FAILURE;
}
-
- sqlite3_enable_load_extension (db, 1);
- sqlite3_load_extension (db, PKGLIBDIR "/tracker-fts.so", NULL, &st);
-
- if (st) {
- fprintf(stderr, "SQL error: %s\n", st);
- sqlite3_free(st);
+
+ if (sqlite3Fts3Init (db) != SQLITE_OK) {
+ fprintf(stderr, "SQL error\n");
}
if (!db_exists) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]