diff --git a/README.md b/README.md index 8bb27d8..3ddad21 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,9 @@ The following dependencies are required: * `girara` (>= 0.4.3) * `libmagic` from file(1): for mime-type detection * `json-glib` +* `sqlite3` (>= 3.6.23): sqlite3 database backend The following dependencies are optional: - -* `sqlite3` (>= 3.6.23): sqlite3 database backend * `libsynctex` from TeXLive (>= 1.19): SyncTeX support * `libseccomp`: sandbox support @@ -40,12 +39,6 @@ Note that `Sphinx` is needed to build the manpages. If it is not installed, the man pages won't be built. For building the HTML documentation, `doxygen`, `breathe` and `sphinx_rtd_theme` are needed in addition to `Sphinx`. -If you don't want to build with support for sqlite databases, you can configure -the build system with `-Dsqlite=disabled` and sqlite support won't be available. - -The use of magic to detect mime types is optional and can be disabled by -configuring the build system with `-Dmagic=disabled`. - The use of `libseccomp` to create a sandboxed environment is optional and can be disabled by configure the build system with `-Dseccomp=disabled`. The sandbox will by default be set to "normal" mode, which should not interfere diff --git a/meson.build b/meson.build index 8c4998f..f07151a 100644 --- a/meson.build +++ b/meson.build @@ -44,8 +44,9 @@ gtk3 = dependency('gtk+-3.0', version: '>=3.24') json_glib = dependency('json-glib-1.0') cairo = dependency('cairo') magic = cc.find_library('magic', required: true) +sqlite = dependency('sqlite3', version: '>=3.6.23', required: true) -build_dependencies = [libm, girara, glib, gio, gthread, gmodule, gtk3, cairo, magic, json_glib] +build_dependencies = [libm, girara, glib, gio, gthread, gmodule, gtk3, cairo, magic, json_glib, sqlite] if host_machine.system() == 'darwin' gtk_mac_integration = dependency('gtk-mac-integration-gtk3') @@ -76,16 +77,9 @@ flags = cc.get_supported_arguments(flags) # optional dependencies additional_sources = [] -sqlite = dependency('sqlite3', version: '>=3.6.23', required: get_option('sqlite')) synctex = dependency('synctex', version: '>=1.19', required: get_option('synctex')) seccomp = dependency('libseccomp', required: get_option('seccomp')) -if sqlite.found() - build_dependencies += sqlite - defines += '-DWITH_SQLITE' - additional_sources += files('zathura/database-sqlite.c') -endif - if synctex.found() build_dependencies += synctex defines += '-DWITH_SYNCTEX' @@ -126,6 +120,7 @@ sources = files( 'zathura/content-type.c', 'zathura/database.c', 'zathura/database-plain.c', + 'zathura/database-sqlite.c', 'zathura/dbus-interface.c', 'zathura/document.c', 'zathura/file-monitor.c', diff --git a/meson_options.txt b/meson_options.txt index db53870..303bd0d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,8 +1,3 @@ -option('sqlite', - type: 'feature', - value: 'auto', - description: 'SQLite database backend' -) option('synctex', type: 'feature', value: 'auto', diff --git a/zathura/zathura.c b/zathura/zathura.c index d4dede9..fd863be 100644 --- a/zathura/zathura.c +++ b/zathura/zathura.c @@ -28,9 +28,7 @@ #include "callbacks.h" #include "config.h" #include "commands.h" -#ifdef WITH_SQLITE #include "database-sqlite.h" -#endif #include "database-plain.h" #include "document.h" #include "shortcuts.h" @@ -370,9 +368,7 @@ init_css(zathura_t* zathura) return true; } -static void -init_database(zathura_t* zathura) -{ +static void init_database(zathura_t* zathura) { char* database = NULL; girara_setting_get(zathura->ui.session, "database", &database); @@ -384,30 +380,23 @@ init_database(zathura_t* zathura) if (g_strcmp0(database, "plain") == 0) { girara_debug("Using plain database backend."); zathura->database = zathura_plaindatabase_new(zathura->config.data_dir); -#ifdef WITH_SQLITE } else if (g_strcmp0(database, "sqlite") == 0) { girara_debug("Using sqlite database backend."); - char* tmp = - g_build_filename(zathura->config.data_dir, "bookmarks.sqlite", NULL); + char* tmp = g_build_filename(zathura->config.data_dir, "bookmarks.sqlite", NULL); zathura->database = zathura_sqldatabase_new(tmp); g_free(tmp); -#endif } else if (g_strcmp0(database, "null") != 0) { girara_error("Database backend '%s' is not supported.", database); } if (zathura->database == NULL && g_strcmp0(database, "null") != 0) { - girara_error( - "Unable to initialize database. Bookmarks won't be available."); - } - else { - g_object_set(G_OBJECT(zathura->ui.session->command_history), "io", - zathura->database, NULL); + girara_error("Unable to initialize database. Bookmarks won't be available."); + } else { + g_object_set(G_OBJECT(zathura->ui.session->command_history), "io", zathura->database, NULL); } g_free(database); } -static void init_jumplist(zathura_t* zathura) { int jumplist_size = 20;