Hi,

I've 2 itches to scratch with clementine now my chromaprint update has
a pretty good shape and works fine on macppc/amd64.

1) Support chromaprint >= 1.4
   --------------------------

Because our version of clementine is old, it's not compatible with
recent versions of chromaprint. What i'm proposing here is an upstream
fix that allows clementine to be built with chromaprint-1.1 (what we
have in CVS at the moment) and chromaprint-1.4.3.

This change impacts all archs.

2) Unbreak with ports-gcc
   ----------------------

> http://build-failures.rhaalovely.net/sparc64/last/audio/clementine.log
(does not build on macppc, chromaprint-1.1 is broken due to narrowing
errors)

The problem is that:

- clementine is expected to be built with -std=c++0x
- since protobuf>=3.6, we now need to build it with C++11
- the bundled libechonest is built with -Werror with GCC
  only, and use features that are deprecated in C++11, 
  generating a warning and thus a build failure
- a header was missing further in the build :]


Testing
-------

On macppc/arm* you'll need the -wip chromaprint-1.4.3 [0].

Please note that music tags autofill won't work in any case. I suspect
the musicbrainz code in our clementine is too old as well. It's not a
chromaprint issues, py-acoustid, another consumer, find the same songs.

- amd64:        builds and works fine with any version of chromaprint 
- macppc:       with the -wip chromaprint-1.4.3, it builds [1] and
                still either stay stuck trying to load tracks,
                or SIGSEGV with egdb getting a SIGTRAP as soon as i
                press the play button. That was already there back in
                gcc-4.9.  

ports-lib-depends-check reports extra stuff in wantlib but it's 
actually linked against them according to ldd, or otherwise dlopen()'d.

Comments/testing reports are welcome!

Charlène.

[0]
https://github.com/jasperla/openbsd-wip/tree/master/audio/chromaprint
[1] https://bin.charlenew.xyz/clementine.png


Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/clementine/Makefile,v
retrieving revision 1.37
diff -u -p -u -p -r1.37 Makefile
--- Makefile    12 Jul 2019 20:43:32 -0000      1.37
+++ Makefile    15 Jul 2019 18:15:39 -0000
@@ -5,7 +5,7 @@ COMMENT =       Qt4-based featureful music pla
 V =            1.2.3
 DISTNAME =     clementine-${V}
 CATEGORIES =   audio x11
-REVISION =     14
+REVISION =     15
 
 HOMEPAGE =     https://clementine-player.org/
 
@@ -32,6 +32,8 @@ WANTLIB += plist
 
 MODULES =              devel/cmake x11/qt4
 COMPILER =             base-clang ports-gcc
+# clementine is originally meant to be build with c++0x, but
+# protobuf>=3.6 wants c++11
 CXXFLAGS +=            -std=c++11
 
 BUILD_DEPENDS =                devel/boost \
Index: patches/patch-3rdparty_libechonest_CMakeLists_txt
===================================================================
RCS file: patches/patch-3rdparty_libechonest_CMakeLists_txt
diff -N patches/patch-3rdparty_libechonest_CMakeLists_txt
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-3rdparty_libechonest_CMakeLists_txt   15 Jul 2019 18:15:39 
-0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+
+ports-gcc: don't build with -Werror because the code uses dynamic
+exception specifications that are deprecated in C++11, thus
+generating a warning.
+
+Index: 3rdparty/libechonest/CMakeLists.txt
+--- 3rdparty/libechonest/CMakeLists.txt.orig
++++ 3rdparty/libechonest/CMakeLists.txt
+@@ -40,10 +40,6 @@ set( LIBECHONEST_H
+ 
+ QT4_WRAP_CPP( ${LIBECHONEST_H} )
+ 
+-if (CMAKE_COMPILER_IS_GNUCXX)
+-    add_definitions( -Werror )
+-endif (CMAKE_COMPILER_IS_GNUCXX)
+-
+ SET( OS_SPECIFIC_LINK_LIBRARIES "" )
+ IF( APPLE OR MINGW )
+   SET( OS_SPECIFIC_LINK_LIBRARIES ${QJSON_LIBRARIES} )
Index: patches/patch-src_devices_giolister_cpp
===================================================================
RCS file: patches/patch-src_devices_giolister_cpp
diff -N patches/patch-src_devices_giolister_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_devices_giolister_cpp     15 Jul 2019 18:15:39 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Add missing header for ports-gcc, from upstream:
+https://github.com/clementine-player/Clementine/pull/5630/commits/a2f7d018c7bdee96d4cefd5a1ec0c4f710fea226
+
+Index: src/devices/giolister.cpp
+--- src/devices/giolister.cpp.orig
++++ src/devices/giolister.cpp
+@@ -17,6 +17,7 @@
+ 
+ #include "config.h"
+ 
++#include <functional>
+ #include <memory>
+ 
+ #include <QFile>
Index: patches/patch-src_musicbrainz_chromaprinter_cpp
===================================================================
RCS file: patches/patch-src_musicbrainz_chromaprinter_cpp
diff -N patches/patch-src_musicbrainz_chromaprinter_cpp
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_musicbrainz_chromaprinter_cpp     15 Jul 2019 18:15:39 
-0000
@@ -0,0 +1,34 @@
+$OpenBSD$
+
+Unbreak with chromaprint >=1.4 (and keep backward compat), see:
+https://github.com/clementine-player/Clementine/commit/d3ea0c8482dfd3f6264a30cfceb456076d76e6cd
+
+Index: src/musicbrainz/chromaprinter.cpp
+--- src/musicbrainz/chromaprinter.cpp.orig
++++ src/musicbrainz/chromaprinter.cpp
+@@ -127,15 +127,22 @@ QString Chromaprinter::CreateFingerprint() {
+ 
+   ChromaprintContext* chromaprint = 
chromaprint_new(CHROMAPRINT_ALGORITHM_DEFAULT);
+   chromaprint_start(chromaprint, kDecodeRate, kDecodeChannels);
+-  chromaprint_feed(chromaprint, reinterpret_cast<void*>(data.data()), 
data.size() / 2);
++  chromaprint_feed(chromaprint, reinterpret_cast<int16_t*>(data.data()), 
data.size() / 2);
+   chromaprint_finish(chromaprint);
+ 
+-  void* fprint = NULL;
+   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 = NULL;
+     int encoded_size = 0;
+     chromaprint_encode_fingerprint(
+         fprint, size, CHROMAPRINT_ALGORITHM_DEFAULT, &encoded, &encoded_size, 
1);

Reply via email to