summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/databases.scm16
-rw-r--r--gnu/packages/music.scm5
-rw-r--r--gnu/packages/patches/clementine-fix-sqlite.patch23
4 files changed, 28 insertions, 17 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index e8f1dbe661..e14657c2d1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -611,6 +611,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/clang-runtime-asan-build-fixes.patch	\
   %D%/packages/patches/clang-runtime-esan-build-fixes.patch	\
   %D%/packages/patches/classpath-aarch64-support.patch		\
+  %D%/packages/patches/clementine-fix-sqlite.patch		\
   %D%/packages/patches/clementine-remove-crypto++-dependency.patch	\
   %D%/packages/patches/clementine-use-openssl.patch		\
   %D%/packages/patches/clisp-glibc-2.26.patch			\
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 04b9085e50..dc2c85b961 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -27,7 +27,7 @@
 ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
 ;;; Copyright © 2017, 2018 Ben Woodcroft <donttrustben@gmail.com>
 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
-;;; Copyright © 2017 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2017, 2018 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2015, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2017 Kristofer Buffington <kristoferbuffington@gmail.com>
 ;;; Copyright © 2018 Amirouche Boubekki <amirouche@hypermove.net>
@@ -1069,20 +1069,6 @@ is in the public domain.")
        ((#:configure-flags flags)
         `(cons "--enable-fts5" ,flags))))))
 
-;; This is used by Clementine.
-(define-public sqlite-with-fts3
-  (package (inherit sqlite)
-    (name "sqlite-with-fts3")
-    (arguments
-     (substitute-keyword-arguments (package-arguments sqlite)
-       ((#:configure-flags flags)
-        `(list (string-append "CFLAGS=-O2 -DSQLITE_SECURE_DELETE "
-                              "-DSQLITE_ENABLE_UNLOCK_NOTIFY "
-                              "-DSQLITE_ENABLE_DBSTAT_VTAB "
-                              "-DSQLITE_ENABLE_FTS3 "
-                              "-DSQLITE_ENABLE_FTS3_PARENTHESIS "
-                              "-DSQLITE_ENABLE_FTS3_TOKENIZER")))))))
-
 (define-public tdb
   (package
     (name "tdb")
diff --git a/gnu/packages/music.scm b/gnu/packages/music.scm
index cf1e0f82f4..7d4aeff990 100644
--- a/gnu/packages/music.scm
+++ b/gnu/packages/music.scm
@@ -238,7 +238,8 @@ score, keyboard, guitar, drum and controller views.")
                       "tinysvcmdns"))
                     #t))
                 (patches (search-patches "clementine-use-openssl.patch"
-                                         "clementine-remove-crypto++-dependency.patch"))))
+                                         "clementine-remove-crypto++-dependency.patch"
+                                         "clementine-fix-sqlite.patch"))))
       (build-system cmake-build-system)
       (arguments
        '(#:test-target "clementine_test"
@@ -281,7 +282,7 @@ score, keyboard, guitar, drum and controller views.")
          ("pulseaudio" ,pulseaudio)
          ("qtbase" ,qtbase)
          ("qtx11extras" ,qtx11extras)
-         ("sqlite" ,sqlite-with-fts3)
+         ("sqlite" ,sqlite)
          ("sparsehash" ,sparsehash)
          ("taglib" ,taglib)))
       (home-page "http://clementine-player.org")
diff --git a/gnu/packages/patches/clementine-fix-sqlite.patch b/gnu/packages/patches/clementine-fix-sqlite.patch
new file mode 100644
index 0000000000..f9d44f9074
--- /dev/null
+++ b/gnu/packages/patches/clementine-fix-sqlite.patch
@@ -0,0 +1,23 @@
+Patch downloaded from https://github.com/clementine-player/Clementine/pull/5669 .
+
+diff -ruN clementine-1.3.1.565.gd20c2244a.orig/src/core/database.cpp clementine-1.3.1.565.gd20c2244a/src/core/database.cpp
+--- clementine-1.3.1.565.gd20c2244a.orig/src/core/database.cpp	2018-07-07 23:59:24.018540126 +0200
++++ clementine-1.3.1.565.gd20c2244a/src/core/database.cpp	2018-07-08 00:04:47.991551728 +0200
+@@ -265,6 +265,17 @@
+   StaticInit();
+ 
+   {
++
++#ifdef SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER
++    // In case sqlite>=3.12 is compiled without -DSQLITE_ENABLE_FTS3_TOKENIZER
++    // (generally a good idea  due to security reasons) the fts3 support should be enabled explicitly.
++    QVariant v = db.driver()->handle();
++    if (v.isValid() && qstrcmp(v.typeName(), "sqlite3*") == 0) {
++      sqlite3 *handle = *static_cast<sqlite3**>(v.data());
++      if (handle) sqlite3_db_config(handle, SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, 1, NULL);
++    }
++#endif
++
+     QSqlQuery set_fts_tokenizer(db);
+     set_fts_tokenizer.prepare("SELECT fts3_tokenizer(:name, :pointer)");
+     set_fts_tokenizer.bindValue(":name", "unicode");