contribs: chromaprint: more fixes for .pc file.
authorKonstantin Pavlov <thresh@videolan.org>
Fri, 8 Dec 2017 12:12:30 +0000 (12:12 +0000)
committerKonstantin Pavlov <thresh@videolan.org>
Fri, 8 Dec 2017 14:23:29 +0000 (17:23 +0300)
- Moved AVFFT check: FFMPEG_LIBRARIES might be unset even if
all needed FFmpeg libraries were found.
- Added an ability to link with VDSP/Accelerate Framework on macOS.

contrib/src/chromaprint/avutil.patch [deleted file]
contrib/src/chromaprint/linklibs.patch [new file with mode: 0644]
contrib/src/chromaprint/rules.mak

diff --git a/contrib/src/chromaprint/avutil.patch b/contrib/src/chromaprint/avutil.patch
deleted file mode 100644 (file)
index 8055cd9..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
---- chromaprint/src/fft_lib_avfft.h.ORIG       2016-12-28 15:10:42.000000000 -0500
-+++ chromaprint/src/fft_lib_avfft.h    2017-12-06 20:37:33.723124874 -0500
-@@ -5,6 +5,7 @@
- #define CHROMAPRINT_FFT_LIB_AVFFT_H_
- extern "C" {
-+#include <libavutil/mem.h>
- #include <libavcodec/avcodec.h>
- #include <libavcodec/avfft.h>
- #include <libavutil/mem.h>
---- chromaprint/libchromaprint.pc.cmake.ORIG   2016-12-28 15:10:42.000000000 -0500
-+++ chromaprint/libchromaprint.pc.cmake        2017-12-06 21:11:55.612701955 -0500
-@@ -7,6 +7,6 @@
- Description: Audio fingerprint library
- URL: http://acoustid.org/chromaprint
- Version: ${PROJECT_VERSION}
--Libs: -L${LIB_INSTALL_DIR} -lchromaprint
-+Libs: -L${LIB_INSTALL_DIR} -lchromaprint ${CHROMAPRINT_LIBS_AVFFT}
- Cflags: -I${INCLUDE_INSTALL_DIR}
---- chromaprint/CMakeLists.txt.ORIG    2016-12-28 15:10:42.000000000 -0500
-+++ chromaprint/CMakeLists.txt 2017-12-06 21:59:26.164398701 -0500
-@@ -96,6 +96,9 @@
-       check_function_exists(av_frame_alloc HAVE_AV_FRAME_ALLOC)
-       check_function_exists(av_frame_free HAVE_AV_FRAME_FREE)
-       cmake_pop_check_state()
-+      find_package(PkgConfig)
-+      pkg_check_modules(AVFFT REQUIRED libavcodec libavutil)
-+      string(REPLACE ";" " " CHROMAPRINT_LIBS_AVFFT "${AVFFT_LDFLAGS}")
- endif()
- if(NOT FFT_LIB OR FFT_LIB STREQUAL "fftw3" OR FFT_LIB STREQUAL "fftw3f")
diff --git a/contrib/src/chromaprint/linklibs.patch b/contrib/src/chromaprint/linklibs.patch
new file mode 100644 (file)
index 0000000..de4fb88
--- /dev/null
@@ -0,0 +1,42 @@
+diff -urN chromaprint.orig/CMakeLists.txt chromaprint/CMakeLists.txt
+--- chromaprint.orig/CMakeLists.txt    2016-12-28 21:10:42.000000000 +0100
++++ chromaprint/CMakeLists.txt 2017-12-08 14:59:39.000000000 +0100
+@@ -135,12 +135,16 @@
+ if(FFT_LIB STREQUAL "vdsp")
+       if(ACCELERATE_LIBRARIES)
+               set(USE_VDSP ON)
++              set(CHROMAPRINT_ADDITIONAL_LIBS "-F${ACCELERATE_LIBRARIES} -framework Accelerate")
+       else()
+               message(FATAL_ERROR "Selected ${FFT_LIB} for FFT calculations, but the library is not found")
+       endif()
+ elseif(FFT_LIB STREQUAL "avfft")
+       if(FFMPEG_LIBAVCODEC_FFT_FOUND)
+               set(USE_AVFFT ON)
++              find_package(PkgConfig)
++              pkg_check_modules(AVFFT REQUIRED libavcodec libavutil)
++              string(REPLACE ";" " " CHROMAPRINT_ADDITIONAL_LIBS "${AVFFT_LDFLAGS}")
+       else()
+               message(FATAL_ERROR "Selected ${FFT_LIB} for FFT calculations, but the library is not found")
+       endif()
+diff -urN chromaprint.orig/libchromaprint.pc.cmake chromaprint/libchromaprint.pc.cmake
+--- chromaprint.orig/libchromaprint.pc.cmake   2016-12-28 21:10:42.000000000 +0100
++++ chromaprint/libchromaprint.pc.cmake        2017-12-08 14:56:22.000000000 +0100
+@@ -7,6 +7,6 @@
+ Description: Audio fingerprint library
+ URL: http://acoustid.org/chromaprint
+ Version: ${PROJECT_VERSION}
+-Libs: -L${LIB_INSTALL_DIR} -lchromaprint
++Libs: -L${LIB_INSTALL_DIR} -lchromaprint ${CHROMAPRINT_ADDITIONAL_LIBS}
+ Cflags: -I${INCLUDE_INSTALL_DIR}
+diff -urN chromaprint.orig/src/fft_lib_avfft.h chromaprint/src/fft_lib_avfft.h
+--- chromaprint.orig/src/fft_lib_avfft.h       2016-12-28 21:10:42.000000000 +0100
++++ chromaprint/src/fft_lib_avfft.h    2017-12-08 14:55:35.000000000 +0100
+@@ -5,6 +5,7 @@
+ #define CHROMAPRINT_FFT_LIB_AVFFT_H_
+ extern "C" {
++#include <libavutil/mem.h>
+ #include <libavcodec/avcodec.h>
+ #include <libavcodec/avfft.h>
+ #include <libavutil/mem.h>
index 0473504..235b2cd 100644 (file)
@@ -15,7 +15,7 @@ $(TARBALLS)/chromaprint-$(CHROMAPRINT_VERSION).tar.gz:
 
 chromaprint: chromaprint-$(CHROMAPRINT_VERSION).tar.gz .sum-chromaprint
        $(UNPACK)
-       $(APPLY) $(SRC)/chromaprint/avutil.patch
+       $(APPLY) $(SRC)/chromaprint/linklibs.patch
        $(MOVE)
 
 DEPS_chromaprint = ffmpeg $(DEPS_ffmpeg)