From 9c5f47526eaef77727c6ff4eb53cdeb90c4e95b4 Mon Sep 17 00:00:00 2001
From: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Date: Mon, 2 Jan 2017 08:11:55 +0700
Subject: audio/clementine: Fix build against chromaprint 1.4.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
---
 audio/clementine/chromaprint-1.4.patch | 30 ++++++++++++++++++++++++++++++
 audio/clementine/clementine.SlackBuild | 13 +++++++++----
 2 files changed, 39 insertions(+), 4 deletions(-)
 create mode 100644 audio/clementine/chromaprint-1.4.patch

(limited to 'audio')

diff --git a/audio/clementine/chromaprint-1.4.patch b/audio/clementine/chromaprint-1.4.patch
new file mode 100644
index 0000000000..3b833aa48a
--- /dev/null
+++ b/audio/clementine/chromaprint-1.4.patch
@@ -0,0 +1,30 @@
+--- Clementine-1.3.1/src/musicbrainz/chromaprinter.cpp.orig	2016-04-19 22:08:35.000000000 +0700
++++ Clementine-1.3.1/src/musicbrainz/chromaprinter.cpp	2017-01-02 08:07:14.334983962 +0700
+@@ -143,16 +143,24 @@
+   ChromaprintContext* chromaprint =
+       chromaprint_new(CHROMAPRINT_ALGORITHM_DEFAULT);
+   chromaprint_start(chromaprint, kDecodeRate, kDecodeChannels);
+-  chromaprint_feed(chromaprint, reinterpret_cast<void*>(data.data()),
++  chromaprint_feed(chromaprint, reinterpret_cast<int16_t *>(data.data()),
+                    data.size() / 2);
+   chromaprint_finish(chromaprint);
+ 
+-  void* fprint = nullptr;
+   int size = 0;
++
++#if CHROMAPRINT_VERSION_MAJOR >= 1 && CHROMAPRINT_VERSION_MINOR >= 4
++  u_int32_t *fprint = nullptr;
++  char *encoded = nullptr;
++#else
++  void *fprint = nullptr;
++  void *encoded = nullptr;
++#endif
++
+   int ret = chromaprint_get_raw_fingerprint(chromaprint, &fprint, &size);
++
+   QByteArray fingerprint;
+   if (ret == 1) {
+-    void* encoded = nullptr;
+     int encoded_size = 0;
+     chromaprint_encode_fingerprint(fprint, size, CHROMAPRINT_ALGORITHM_DEFAULT,
+                                    &encoded, &encoded_size, 1);
diff --git a/audio/clementine/clementine.SlackBuild b/audio/clementine/clementine.SlackBuild
index e3b3c99a0f..d5e99369ae 100644
--- a/audio/clementine/clementine.SlackBuild
+++ b/audio/clementine/clementine.SlackBuild
@@ -27,12 +27,12 @@
 PRGNAM=clementine
 DIRNAM=Clementine
 VERSION=${VERSION:-1.3.1}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
 TAG=${TAG:-_SBo}
 
 if [ -z "$ARCH" ]; then
   case "$( uname -m )" in
-    i?86) export ARCH=i486 ;;
+    i?86) export ARCH=i586 ;;
     arm*) export ARCH=arm ;;
        *) export ARCH=$( uname -m ) ;;
   esac
@@ -43,8 +43,8 @@ TMP=${TMP:-/tmp/SBo}
 PKG=$TMP/package-$PRGNAM
 OUTPUT=${OUTPUT:-/tmp}
 
-if [ "$ARCH" = "i486" ]; then
-  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+if [ "$ARCH" = "i586" ]; then
+  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
   LIBDIRSUFFIX=""
 elif [ "$ARCH" = "i686" ]; then
   SLKCFLAGS="-O2 -march=i686 -mtune=i686"
@@ -73,6 +73,11 @@ find -L . \
   -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
 
 patch -p1 < $CWD/sqlite.patch
+
+# Add upstream patch for chromaprint 1.4 compatibility
+# https://github.com/clementine-player/Clementine/commit/ded312685735fc266d4154d355286eeb86db3bcd
+patch -p1 < $CWD/chromaprint-1.4.patch
+
 mkdir build
 cd build
   cmake \
-- 
cgit v1.2.3