[update] audio/chromaprint 1.1 -> 1.4.3

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[update] audio/chromaprint 1.1 -> 1.4.3

Charlene Wendling
Hi,

Here is an update for chromaprint that fixes build issues on ppc/arm.

Upstream didn't pin a 1.4.4 release [1], but this is what you get with
that diff.

What's new upstream (see [0]):

- move to github
- C++11 is required, chromaprint doesn't use boost anymore
- use newer ffmpeg api

What's new in the port:

- reorder the Makefile according to Makefile.template. It doesn't
  impact a lot the diff readability given the amount of changes.
- major bump SHARED_LIBS. check_sym reports deletions.
- s/sed/SUBST_CMD
- remove hardcoded path when finding gtest, it also required to add
  linking instructions for cmake to allow the use of devel/gtest
- add "1.4.4" fixes that make test endian neutral

Testing (macppc/amd64):

- 'make test' passes with all tests enabled
- All consumers build and run without issue. Clementine auto-tagging
  doesn't work with chromaprint-1.1 as well.


Comments/feedback are welcome :)

Charlène.


[0]
https://github.com/acoustid/chromaprint/blob/master/NEWS.txt
[1] https://github.com/acoustid/chromaprint/issues/59


Index: chromaprint/Makefile
===================================================================
RCS file: /cvs/ports/audio/chromaprint/Makefile,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile
--- chromaprint/Makefile 12 Jul 2019 20:43:32 -0000 1.12
+++ chromaprint/Makefile 13 Aug 2019 21:18:50 -0000
@@ -2,37 +2,39 @@
 
 COMMENT = audio fingerprint extraction library
 
-DISTNAME = chromaprint-1.1
+GH_ACCOUNT = acoustid
+GH_PROJECT = chromaprint
+GH_TAGNAME = v1.4.3
+
+SHARED_LIBS = chromaprint               2.0 # 1.4.3
+
 CATEGORIES = audio devel
-HOMEPAGE = https://acoustid.org/chromaprint
-MASTER_SITES = https://bitbucket.org/acoustid/chromaprint/downloads/
-REVISION = 3
 
-SHARED_LIBS = chromaprint               1.0 # 0.1
+HOMEPAGE = https://acoustid.org/chromaprint
 
-# LGPL2.1+
+# MIT with LGPL2.1+ parts
 PERMIT_PACKAGE = Yes
 
-WANTLIB += avcodec avformat avutil c m pthread ${COMPILER_LIBCXX} swresample
+WANTLIB += ${COMPILER_LIBCXX} avcodec avformat avutil c m swresample
 
-COMPILER = base-clang ports-gcc base-gcc
+# C++11
+COMPILER = base-clang ports-gcc
 
 MODULES = devel/cmake
 
-BUILD_DEPENDS = audio/taglib \
- devel/boost
+BUILD_DEPENDS = audio/taglib
+# gtest presence is checked in configure stage, so this cannot be
+# in TEST_DEPENDS
+BUILD_DEPENDS += devel/gtest
 
 LIB_DEPENDS = graphics/ffmpeg
 
-# gtest presence is checked in configure stage, so this cannot be in TEST_DEPENDS
-BUILD_DEPENDS += devel/gtest
-CONFIGURE_ARGS = -DBUILD_TESTS:Bool=Yes -DBUILD_EXAMPLES=ON
+CONFIGURE_ARGS = -DBUILD_TOOLS=ON \
+ -DBUILD_TESTS=ON
 
-post-patch:
- sed -i 's,/usr/local,${LOCALBASE},' \
- ${WRKSRC}/cmake/modules/FindGTest.cmake
+TEST_TARGET = check
 
-do-test:
- cd ${WRKBUILD}/tests && ./all_tests
+pre-configure:
+ ${SUBST_CMD} ${WRKSRC}/cmake/modules/FindGTest.cmake
 
 .include <bsd.port.mk>
Index: chromaprint/distinfo
===================================================================
RCS file: /cvs/ports/audio/chromaprint/distinfo,v
retrieving revision 1.2
diff -u -p -r1.2 distinfo
--- chromaprint/distinfo 9 May 2014 09:00:19 -0000 1.2
+++ chromaprint/distinfo 13 Aug 2019 21:18:50 -0000
@@ -1,2 +1,2 @@
-SHA256 (chromaprint-1.1.tar.gz) = axTX6klkWBtzvT+AOMiFfAHkRkIcGumcu/ZN4mtHzRI=
-SIZE (chromaprint-1.1.tar.gz) = 542360
+SHA256 (chromaprint-1.4.3.tar.gz) = 1K5llig6rXoBWlsERQEgVMY0pLkynssjAAzTVLQKKDs=
+SIZE (chromaprint-1.4.3.tar.gz) = 613718
Index: chromaprint/patches/patch-cmake_modules_FindGTest_cmake
===================================================================
RCS file: /cvs/ports/audio/chromaprint/patches/patch-cmake_modules_FindGTest_cmake,v
retrieving revision 1.1
diff -u -p -r1.1 patch-cmake_modules_FindGTest_cmake
--- chromaprint/patches/patch-cmake_modules_FindGTest_cmake 9 May 2014 09:00:19 -0000 1.1
+++ chromaprint/patches/patch-cmake_modules_FindGTest_cmake 13 Aug 2019 21:18:50 -0000
@@ -1,6 +1,10 @@
 $OpenBSD: patch-cmake_modules_FindGTest_cmake,v 1.1 2014/05/09 09:00:19 sthen Exp $
---- cmake/modules/FindGTest.cmake.orig Sat Nov 23 16:43:42 2013
-+++ cmake/modules/FindGTest.cmake Wed May  7 16:29:15 2014
+
+Find gtest from devel/gtest.
+
+Index: cmake/modules/FindGTest.cmake
+--- cmake/modules/FindGTest.cmake.orig
++++ cmake/modules/FindGTest.cmake
 @@ -71,12 +71,24 @@ find_path(GTEST_INCLUDE_DIR
  )
  mark_as_advanced(GTEST_INCLUDE_DIR)
@@ -10,7 +14,7 @@ $OpenBSD: patch-cmake_modules_FindGTest_
 +    FIND_LIBRARY(${varname}
 +        NAMES ${shortname}
 +        PATHS
-+        /usr/local/lib
++ ${LOCALBASE}/lib
 + NO_DEFAULT_PATH
 +        DOC "Location of GTEST Libraries"
 +    )
@@ -22,9 +26,10 @@ $OpenBSD: patch-cmake_modules_FindGTest_
 +find_package_handle_standard_args(GTest DEFAULT_MSG GTEST_INCLUDE_DIR)
 
  if(GTEST_FOUND)
- set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
+- set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
 - set(GTEST_LIBRARIES gtest)
 - set(GTEST_MAIN_LIBRARIES gtest_main)
++    set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
 +    GTEST_FIND(GTEST_LIBRARIES gtest)
 +    GTEST_FIND(GTEST_MAIN_LIBRARIES gtest_main)
      set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
Index: chromaprint/patches/patch-examples_fpcalc_c
===================================================================
RCS file: chromaprint/patches/patch-examples_fpcalc_c
diff -N chromaprint/patches/patch-examples_fpcalc_c
--- chromaprint/patches/patch-examples_fpcalc_c 18 Feb 2019 10:05:39 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,34 +0,0 @@
-$OpenBSD: patch-examples_fpcalc_c,v 1.1 2019/02/18 10:05:39 ajacoutot Exp $
-
-Update for newer FFmpeg API.
-
-Index: examples/fpcalc.c
---- examples/fpcalc.c.orig
-+++ examples/fpcalc.c
-@@ -126,7 +126,7 @@ int decode_audio_file(ChromaprintContext *chromaprint_
- remaining = max_length * codec_ctx->channels * codec_ctx->sample_rate;
- chromaprint_start(chromaprint_ctx, codec_ctx->sample_rate, codec_ctx->channels);
-
-- frame = avcodec_alloc_frame();
-+ frame = av_frame_alloc();
-
- while (1) {
- if (av_read_frame(format_ctx, &packet) < 0) {
-@@ -134,7 +134,7 @@ int decode_audio_file(ChromaprintContext *chromaprint_
- }
-
- if (packet.stream_index == stream_index) {
-- avcodec_get_frame_defaults(frame);
-+ av_frame_unref(frame);
-
- got_frame = 0;
- consumed = avcodec_decode_audio4(codec_ctx, frame, &got_frame, &packet);
-@@ -190,7 +190,7 @@ finish:
-
- done:
- if (frame) {
-- avcodec_free_frame(&frame);
-+ av_frame_free(&frame);
- }
- if (dst_data[0]) {
- av_freep(&dst_data[0]);
Index: chromaprint/patches/patch-tests_CMakeLists_txt
===================================================================
RCS file: /cvs/ports/audio/chromaprint/patches/patch-tests_CMakeLists_txt,v
retrieving revision 1.2
diff -u -p -r1.2 patch-tests_CMakeLists_txt
--- chromaprint/patches/patch-tests_CMakeLists_txt 13 Aug 2019 18:10:11 -0000 1.2
+++ chromaprint/patches/patch-tests_CMakeLists_txt 13 Aug 2019 21:18:50 -0000
@@ -1,24 +1,29 @@
 $OpenBSD: patch-tests_CMakeLists_txt,v 1.2 2019/08/13 18:10:11 phessler Exp $
 
-test-bit_string_*.cpp depends on signed char, failing on aarch64
+Using devel/gtest instead of using a third party one that we
+would need to download and extract.
 
 Index: tests/CMakeLists.txt
 --- tests/CMakeLists.txt.orig
 +++ tests/CMakeLists.txt
-@@ -3,7 +3,6 @@ include_directories(
- ${Boost_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR}/../src
+@@ -3,11 +3,9 @@ find_package(GTest REQUIRED)
+ include_directories(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${GTEST_INCLUDE_DIRS}
+- ${GTEST_SOURCE_DIR}
  )
--add_subdirectory(${GTEST_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/gtest_build)
 
- set(tests_SOURCES
+ set(SRCS
+- ${GTEST_SOURCE_DIR}/src/gtest-all.cc
  main.cpp
-@@ -15,8 +14,6 @@ set(tests_SOURCES
- test_integral_image.cpp
- test_lloyds.cpp
- test_audio_processor.cpp
-- test_bit_string_reader.cpp
-- test_bit_string_writer.cpp
- test_chromaprint.cpp
- test_chroma.cpp
- test_chroma_filter.cpp
+ test_api.cpp
+ test_utils.cpp
+@@ -37,6 +35,8 @@ if(BUILD_TOOLS)
+ set(SRCS ${SRCS} ../src/audio/ffmpeg_audio_reader_test.cpp)
+ link_libraries(fpcalc_libs)
+ endif()
++
++link_libraries(gtest)
+
+ add_executable(all_tests ${SRCS} $<TARGET_OBJECTS:chromaprint_objs>)
+ target_link_libraries(all_tests PRIVATE chromaprint ${CMAKE_THREAD_LIBS_INIT})
Index: chromaprint/patches/patch-tests_test_utils_cpp
===================================================================
RCS file: chromaprint/patches/patch-tests_test_utils_cpp
diff -N chromaprint/patches/patch-tests_test_utils_cpp
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ chromaprint/patches/patch-tests_test_utils_cpp 13 Aug 2019 21:18:50 -0000
@@ -0,0 +1,29 @@
+$OpenBSD$
+
+Make tests endian neutral. Can be removed with chromaprint>=1.4.4:
+https://github.com/acoustid/chromaprint/commit/8d5f2ca81db8fae6b59b6b9b8bda91526507dbd1
+
+Index: tests/test_utils.cpp
+--- tests/test_utils.cpp.orig
++++ tests/test_utils.cpp
+@@ -2,6 +2,7 @@
+ #include <algorithm>
+ #include <limits>
+ #include "utils.h"
++#include "test_utils.h"
+
+ using namespace chromaprint;
+
+@@ -91,4 +92,12 @@ TEST(Utils, CountSetBits64) {
+     EXPECT_EQ(56, CountSetBits(0xFFFFFFFFFFFFFFU));
+     EXPECT_EQ(64, CountSetBits(0xFFFFFFFFFFFFFFFFU));
+     EXPECT_EQ(8, CountSetBits(0x0101010101010101U));
++}
++
++TEST(Utils, LoadAudioFile) {
++ std::vector<short> data = LoadAudioFile("data/test_mono_44100.raw");
++ ASSERT_EQ(data.size(), 176400/2);
++ EXPECT_EQ(data[1000], 0);
++ EXPECT_EQ(data[2000], 107);
++ EXPECT_EQ(data[3000], 128);
+ }
Index: chromaprint/patches/patch-tests_test_utils_h
===================================================================
RCS file: chromaprint/patches/patch-tests_test_utils_h
diff -N chromaprint/patches/patch-tests_test_utils_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ chromaprint/patches/patch-tests_test_utils_h 13 Aug 2019 21:18:50 -0000
@@ -0,0 +1,29 @@
+$OpenBSD$
+
+Make tests endian neutral. Can be removed with chromaprint>=1.4.4:
+https://github.com/acoustid/chromaprint/commit/8d5f2ca81db8fae6b59b6b9b8bda91526507dbd1
+
+Index: tests/test_utils.h
+--- tests/test_utils.h.orig
++++ tests/test_utils.h
+@@ -31,11 +31,15 @@ inline std::vector<short> LoadAudioFile(const std::str
+ {
+ std::string path = TESTS_DIR + file_name;
+ std::ifstream file(path.c_str(), std::ifstream::in | std::ifstream::binary);
+- file.seekg(0, std::ios::end);
+- int length = file.tellg();
+- file.seekg(0, std::ios::beg);
+- std::vector<short> data(length / 2);
+- file.read((char *)&data[0], length);
++ uint8_t buf[4096];
++ std::vector<int16_t> data;
++ while (!file.eof()) {
++ file.read((char *) buf, 4096);
++ size_t nread = file.gcount();
++ for (size_t i = 0; i < nread - 1; i += 2) {
++ data.push_back((int16_t) (((uint16_t) buf[i+1] << 8) | ((uint16_t) buf[i])));
++ }
++ }
+ file.close();
+ return data;
+ }
Index: chromaprint/pkg/DESCR
===================================================================
RCS file: /cvs/ports/audio/chromaprint/pkg/DESCR,v
retrieving revision 1.2
diff -u -p -r1.2 DESCR
--- chromaprint/pkg/DESCR 9 May 2014 09:00:19 -0000 1.2
+++ chromaprint/pkg/DESCR 13 Aug 2019 21:18:50 -0000
@@ -4,4 +4,4 @@ fingerprints from any audio source.
 
 Overview of the fingerprint extraction process can be found in the blog
 post "How does Chromaprint work?":
-http://oxygene.sk/lukas/2011/01/how-does-chromaprint-work/
+https://oxygene.sk/lukas/2011/01/how-does-chromaprint-work/
Index: picard/Makefile
===================================================================
RCS file: /cvs/ports/audio/picard/Makefile,v
retrieving revision 1.29
diff -u -p -r1.29 Makefile
--- picard/Makefile 26 Jul 2019 02:54:23 -0000 1.29
+++ picard/Makefile 13 Aug 2019 21:18:50 -0000
@@ -4,7 +4,7 @@ COMMENT = automatic audio files tagger u
 
 MODPY_EGG_VERSION = 2.1.3
 DISTNAME = picard-${MODPY_EGG_VERSION}
-REVISION = 0
+REVISION = 1
 
 CATEGORIES = audio
 
Index: py-acoustid/Makefile
===================================================================
RCS file: /cvs/ports/audio/py-acoustid/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- py-acoustid/Makefile 12 Jul 2019 20:43:39 -0000 1.10
+++ py-acoustid/Makefile 13 Aug 2019 21:18:50 -0000
@@ -5,6 +5,7 @@ COMMENT = python bindings for Chromaprin
 MODPY_EGG_VERSION = 1.1.6
 DISTNAME = pyacoustid-${MODPY_EGG_VERSION}
 PKGNAME = py-acoustid-${MODPY_EGG_VERSION}
+REVISION = 0
 
 CATEGORIES = audio
 
Index: clementine/Makefile
===================================================================
RCS file: /cvs/ports/audio/clementine/Makefile,v
retrieving revision 1.40
diff -u -p -r1.40 Makefile
--- clementine/Makefile 13 Aug 2019 14:50:12 -0000 1.40
+++ clementine/Makefile 13 Aug 2019 21:18:50 -0000
@@ -6,7 +6,7 @@ GH_ACCOUNT = clementine-player
 GH_PROJECT = Clementine
 GH_TAGNAME = 1.2.3
 CATEGORIES = audio x11
-REVISION = 16
+REVISION = 17
 
 HOMEPAGE = https://clementine-player.org/