commit 3627ff877e4f75525a631f9461db1510ccec9782
Author: leigh123linux <leigh123linux(a)googlemail.com>
Date: Sun Jun 18 11:29:58 2017 +0100
Fix build (patches from Debian)
01-Fix-build-with-upcoming-Libav-10-release.patch | 203 ++++++++++++++++++++++
02-CodecID.patch | 34 ++++
03-pkg-config.patch | 48 +++++
04-typo-warning.patch | 20 +++
05-g++-6-char-cast.patch | 26 +++
06-taglib.patch | 41 +++++
acoustid-fingerprinter-0.6-ffmpeg.patch | 31 ----
acoustid-fingerprinter.spec | 30 ++--
8 files changed, 389 insertions(+), 44 deletions(-)
---
diff --git a/01-Fix-build-with-upcoming-Libav-10-release.patch
b/01-Fix-build-with-upcoming-Libav-10-release.patch
new file mode 100644
index 0000000..f85d7e4
--- /dev/null
+++ b/01-Fix-build-with-upcoming-Libav-10-release.patch
@@ -0,0 +1,203 @@
+Description: Fix build with upcoming Libav 10 release
+ Drops support for pre-0.8 releases to reduce clutter, but those are over
+ three years old now and no current distros carry them.
+Forwarded:
https://bitbucket.org/acoustid/acoustid-fingerprinter/pull-request/3/fix-...
+Author: Anton Khirnov <anton(a)khirnov.net>
+diff --git a/decoder.h b/decoder.h
+index 028f58f..310fe2d 100644
+--- a/decoder.h
++++ b/decoder.h
+@@ -28,6 +28,12 @@
+ extern "C" {
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
++
++#define NEW_AVFRAME_API (LIBAVCODEC_VERSION_MAJOR >= 55)
++#if NEW_AVFRAME_API
++#include <libavutil/frame.h>
++#endif
++
+ #ifdef HAVE_AV_AUDIO_CONVERT
+ #include "ffmpeg/audioconvert.h"
+ #include "ffmpeg/samplefmt.h"
+@@ -35,10 +41,6 @@ extern "C" {
+ }
+ #include "fingerprintcalculator.h"
+
+-#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 64, 0)
+-#define AV_SAMPLE_FMT_S16 SAMPLE_FMT_S16
+-#endif
+-
+ class Decoder
+ {
+ public:
+@@ -67,8 +69,6 @@ public:
+ static void initialize();
+
+ private:
+- static const int BUFFER_SIZE = AVCODEC_MAX_AUDIO_FRAME_SIZE * 2;
+- uint8_t *m_buffer1;
+ uint8_t *m_buffer2;
+ std::string m_file_name;
+ std::string m_error;
+@@ -77,6 +77,7 @@ private:
+ bool m_codec_open;
+ AVStream *m_stream;
+ static QMutex m_mutex;
++ AVFrame *m_frame;
+ #ifdef HAVE_AV_AUDIO_CONVERT
+ AVAudioConvert *m_convert_ctx;
+ #endif
+@@ -114,8 +115,15 @@ inline Decoder::Decoder(const std::string &file_name)
+ , m_convert_ctx(0)
+ #endif
+ {
+- m_buffer1 = (uint8_t *)av_malloc(BUFFER_SIZE + 16);
+- m_buffer2 = (uint8_t *)av_malloc(BUFFER_SIZE + 16);
++#ifdef HAVE_AV_AUDIO_CONVERT
++ m_buffer2 = (uint8_t *)av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE * 2 + 16);
++#endif
++
++#if NEW_AVFRAME_API
++ m_frame = av_frame_alloc();
++#else
++ m_frame = avcodec_alloc_frame();
++#endif
+ }
+
+ inline Decoder::~Decoder()
+@@ -125,39 +133,32 @@ inline Decoder::~Decoder()
+ avcodec_close(m_codec_ctx);
+ }
+ if (m_format_ctx) {
+-#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 17, 0)
+- av_close_input_file(m_format_ctx);
+-#else
+ avformat_close_input(&m_format_ctx);
+-#endif
+ }
+ #ifdef HAVE_AV_AUDIO_CONVERT
+ if (m_convert_ctx) {
+ av_audio_convert_free(m_convert_ctx);
+ }
+-#endif
+- av_free(m_buffer1);
+ av_free(m_buffer2);
++#endif
++
++#if NEW_AVFRAME_API
++ av_frame_free(&m_frame);
++#else
++ av_freep(&m_frame);
++#endif
+ }
+
+ inline bool Decoder::Open()
+ {
+ QMutexLocker locker(&m_mutex);
+
+-#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 2, 0)
+- if (av_open_input_file(&m_format_ctx, m_file_name.c_str(), NULL, 0, NULL) != 0) {
+-#else
+ if (avformat_open_input(&m_format_ctx, m_file_name.c_str(), NULL, NULL) != 0) {
+-#endif
+ m_error = "Couldn't open the file." + m_file_name;
+ return false;
+ }
+
+-#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(53, 6, 0)
+- if (av_find_stream_info(m_format_ctx) < 0) {
+-#else
+ if (avformat_find_stream_info(m_format_ctx, NULL) < 0) {
+-#endif
+ m_error = "Couldn't find stream information in the file.";
+ return false;
+ }
+@@ -166,11 +167,7 @@ inline bool Decoder::Open()
+
+ for (int i = 0; i < m_format_ctx->nb_streams; i++) {
+ AVCodecContext *avctx = m_format_ctx->streams[i]->codec;
+-#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 64, 0)
+- if (avctx && avctx->codec_type == CODEC_TYPE_AUDIO) {
+-#else
+ if (avctx && avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
+-#endif
+ m_stream = m_format_ctx->streams[i];
+ m_codec_ctx = avctx;
+ break;
+@@ -187,11 +184,7 @@ inline bool Decoder::Open()
+ return false;
+ }
+
+-#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(53, 8, 0)
+- if (avcodec_open(m_codec_ctx, codec) < 0) {
+-#else
+ if (avcodec_open2(m_codec_ctx, codec, NULL) < 0) {
+-#endif
+ m_error = "Couldn't open the codec.";
+ return false;
+ }
+@@ -244,17 +237,9 @@ inline void Decoder::Decode(FingerprintCalculator *consumer, int
max_length)
+ packet_temp.data = packet.data;
+ packet_temp.size = packet.size;
+ while (packet_temp.size > 0) {
+- int buffer_size = BUFFER_SIZE;
+-#if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52, 25, 0)
+- int consumed = avcodec_decode_audio2(
+- m_codec_ctx, (int16_t *)m_buffer1, &buffer_size,
+- packet_temp.data, packet_temp.size);
+-#else
+- int consumed = avcodec_decode_audio3(
+- m_codec_ctx, (int16_t *)m_buffer1, &buffer_size,
+- &packet_temp);
+-#endif
+-
++ int got_output;
++ int consumed = avcodec_decode_audio4(m_codec_ctx, m_frame,
++ &got_output, &packet_temp);
+ if (consumed < 0) {
+ break;
+ }
+@@ -262,36 +247,31 @@ inline void Decoder::Decode(FingerprintCalculator *consumer, int
max_length)
+ packet_temp.data += consumed;
+ packet_temp.size -= consumed;
+
+- if (buffer_size <= 0) {
++ if (!got_output) {
+ continue;
+ }
+
+ int16_t *audio_buffer;
+ #ifdef HAVE_AV_AUDIO_CONVERT
+ if (m_convert_ctx) {
+- const void *ibuf[6] = { m_buffer1 };
++ const void *ibuf[6] = { m_frame->data[0] };
+ void *obuf[6] = { m_buffer2 };
+-#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 8, 0)
+- int istride[6] = { av_get_bits_per_sample_format(m_codec_ctx->sample_fmt) / 8 };
+-#else
+ int istride[6] = { av_get_bytes_per_sample(m_codec_ctx->sample_fmt) };
+-#endif
+ int ostride[6] = { 2 };
+- int len = buffer_size / istride[0];
++ int len = m_frame->nb_samples;
+ if (av_audio_convert(m_convert_ctx, obuf, ostride, ibuf, istride, len) < 0) {
+ break;
+ }
+ audio_buffer = (int16_t *)m_buffer2;
+- buffer_size = len * ostride[0];
+ }
+ else {
+- audio_buffer = (int16_t *)m_buffer1;
++ audio_buffer = (int16_t *)m_frame->data[0];
+ }
+ #else
+- audio_buffer = (int16_t *)m_buffer1;
++ audio_buffer = (int16_t *)m_frame->data[0];
+ #endif
+
+- int length = buffer_size / 2;
++ int length = m_frame->nb_samples;
+ if (max_length) {
+ length = std::min(remaining, length);
+ }
diff --git a/02-CodecID.patch b/02-CodecID.patch
new file mode 100644
index 0000000..995766d
--- /dev/null
+++ b/02-CodecID.patch
@@ -0,0 +1,34 @@
+Description: Replace removed macros
+ Rename CodecID to AVCodecID and replace AVCODEC_MAX_AUDIO_FRAME_SIZE
+ with its last value 192000.
+
+Author: Andreas Cadhalpun <Andreas.Cadhalpun(a)googlemail.com>
+Last-Update: <2014-05-13>
+
+--- acoustid-fingerprinter-0.6.orig/decoder.h
++++ acoustid-fingerprinter-0.6/decoder.h
+@@ -116,7 +116,7 @@ inline Decoder::Decoder(const std::strin
+ #endif
+ {
+ #ifdef HAVE_AV_AUDIO_CONVERT
+- m_buffer2 = (uint8_t *)av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE * 2 + 16);
++ m_buffer2 = (uint8_t *)av_malloc(192000 * 2 + 16);
+ #endif
+
+ #if NEW_AVFRAME_API
+--- acoustid-fingerprinter-0.6.orig/ffmpeg/audioconvert.h
++++ acoustid-fingerprinter-0.6/ffmpeg/audioconvert.h
+@@ -75,11 +75,11 @@ int avcodec_channel_layout_num_channels(
+ /**
+ * Guess the channel layout
+ * @param nb_channels
+- * @param codec_id Codec identifier, or CODEC_ID_NONE if unknown
++ * @param codec_id Codec identifier, or AV_CODEC_ID_NONE if unknown
+ * @param fmt_name Format name, or NULL if unknown
+ * @return Channel layout mask
+ */
+-uint64_t avcodec_guess_channel_layout(int nb_channels, enum CodecID codec_id, const char
*fmt_name);
++uint64_t avcodec_guess_channel_layout(int nb_channels, enum AVCodecID codec_id, const
char *fmt_name);
+
+ struct AVAudioConvert;
+ typedef struct AVAudioConvert AVAudioConvert;
diff --git a/03-pkg-config.patch b/03-pkg-config.patch
new file mode 100644
index 0000000..c4fa6ca
--- /dev/null
+++ b/03-pkg-config.patch
@@ -0,0 +1,48 @@
+Description: Use pkg-config to determine FFmpeg linker flags
+
+Author: Andreas Cadhalpun <Andreas.Cadhalpun(a)googlemail.com>
+Last-Update: <2014-07-27>
+
+--- acoustid-fingerprinter-0.6.orig/CMakeLists.txt
++++ acoustid-fingerprinter-0.6/CMakeLists.txt
+@@ -12,6 +12,7 @@ set(INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_
+ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
+
+ find_package(Qt4 COMPONENTS QtCore QtGui QtNetwork REQUIRED)
++find_package(PkgConfig REQUIRED)
+ find_package(FFmpeg REQUIRED)
+ find_package(Taglib REQUIRED)
+ find_package(Chromaprint REQUIRED)
+--- acoustid-fingerprinter-0.6.orig/cmake/modules/FindFFmpeg.cmake
++++ acoustid-fingerprinter-0.6/cmake/modules/FindFFmpeg.cmake
+@@ -47,29 +47,7 @@ MACRO(FFMPEG_FIND varname shortname head
+ DOC "Location of FFMPEG Headers"
+ )
+
+- FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
+- NAMES ${shortname}
+- PATHS
+- ${FFMPEG_ROOT}/lib
+- $ENV{FFMPEG_DIR}/lib
+- ~/Library/Frameworks
+- /Library/Frameworks
+- /usr/local/lib
+- /usr/local/lib64
+- /usr/lib
+- /usr/lib64
+- /sw/lib
+- /opt/local/lib
+- /opt/csw/lib
+- /opt/lib
+- /usr/freeware/lib64
+- NO_DEFAULT_PATH
+- DOC "Location of FFMPEG Libraries"
+- )
+- FIND_LIBRARY(FFMPEG_${varname}_LIBRARIES
+- NAMES ${shortname}
+- DOC "Location of FFMPEG Libraries"
+- )
++ pkg_check_modules(FFMPEG_${varname} lib${shortname})
+
+ IF (FFMPEG_${varname}_LIBRARIES AND FFMPEG_${varname}_INCLUDE_DIRS)
+ SET(FFMPEG_${varname}_FOUND 1)
diff --git a/04-typo-warning.patch b/04-typo-warning.patch
new file mode 100644
index 0000000..885782e
--- /dev/null
+++ b/04-typo-warning.patch
@@ -0,0 +1,20 @@
+Description: Fix typo in warning message
+ Patch found in version 0.6-4.
+Author: Petter Reinholdtsen <pere(a)hungry.com>
+Origin: debian
+Forwarded: not-needed
+Origin:
https://bitbucket.org/acoustid/acoustid-fingerprinter/commits/fb80fb843fd...
+Reviewed-By: Petter Reinholdtsen <pere(a)hungry.com>
+Last-Update: 2016-07-16
+
+--- acoustid-fingerprinter-0.6.orig/fingerprinter.cpp
++++ acoustid-fingerprinter-0.6/fingerprinter.cpp
+@@ -261,7 +261,7 @@ void Fingerprinter::onRequestFinished(QN
+ stop = true;
+ }
+ else {
+- qWarning() << "Submittion failed:" << errorMessage;
++ qWarning() << "Submission failed:" << errorMessage;
+ }
+ }
+ else if (error != QNetworkReply::NoError) {
diff --git a/05-g++-6-char-cast.patch b/05-g++-6-char-cast.patch
new file mode 100644
index 0000000..2d31d03
--- /dev/null
+++ b/05-g++-6-char-cast.patch
@@ -0,0 +1,26 @@
+Description: Fix build failure on gcc 6
+ Array initializers for a char array fail for constants > 128
+ on platforms where char is signed. Cast to fix it.
+Author: Petter Reinholdtsen <pere(a)debian.org>
+Bug-Debian:
https://bugs.debian.org/811732
+Forwarded: no
+Reviewed-By: Petter Reinholdtsen <pere(a)debian.org>
+Last-Update: 2016-07-16
+
+--- acoustid-fingerprinter-0.6.orig/gzip.cpp
++++ acoustid-fingerprinter-0.6/gzip.cpp
+@@ -23,12 +23,12 @@ inline unsigned long calculateCrc32(cons
+ QByteArray gzipCompress(const QByteArray &data)
+ {
+ const char header[10] = {
+- 0x1f, 0x8b, // ID1 + ID2
++ 0x1f, static_cast<char>(0x8b), // ID1 + ID2
+ 8, // Compression Method
+ 0, // Flags
+ 0, 0, 0, 0, // Modification Time
+ 2, // Extra Flags
+- 255, // Operating System
++ static_cast<char>(255), // Operating System
+ };
+
+ QByteArray compressedData = qCompress(data);
diff --git a/06-taglib.patch b/06-taglib.patch
new file mode 100644
index 0000000..efebc91
--- /dev/null
+++ b/06-taglib.patch
@@ -0,0 +1,41 @@
+From 681ef059e4bdb0a9b1a073d6cbb9bb54e993fef9 Mon Sep 17 00:00:00 2001
+From: Johannes Dewender <bitbucket(a)JonnyJD.net>
+Date: Tue, 8 Dec 2015 17:48:33 +0100
+Subject: [PATCH] fix cmake for taglib 1.10
+
+We have to use VERSION_LESS, rather than STRLESS.
+Otherwise we get this error message:
+- TagLib version too old: version searched :1.6, found 1.10
+---
+ cmake/modules/FindTaglib.cmake | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/cmake/modules/FindTaglib.cmake b/cmake/modules/FindTaglib.cmake
+index 76b83ac..5a985f9 100644
+--- a/cmake/modules/FindTaglib.cmake
++++ b/cmake/modules/FindTaglib.cmake
+@@ -29,10 +29,10 @@ if(TAGLIBCONFIG_EXECUTABLE)
+
+ exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE
OUTPUT_VARIABLE TAGLIB_VERSION)
+
+- if(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}")
++ if(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
+ message(STATUS "TagLib version too old: version searched
:${TAGLIB_MIN_VERSION}, found ${TAGLIB_VERSION}")
+ set(TAGLIB_FOUND FALSE)
+- else(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}")
++ else(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
+
+ exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE
OUTPUT_VARIABLE TAGLIB_LIBRARIES)
+
+@@ -42,7 +42,7 @@ if(TAGLIBCONFIG_EXECUTABLE)
+ set(TAGLIB_FOUND TRUE)
+ endif(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS)
+ string(REGEX REPLACE " *-I" ";" TAGLIB_INCLUDES
"${TAGLIB_CFLAGS}")
+- endif(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}")
++ endif(TAGLIB_VERSION VERSION_LESS "${TAGLIB_MIN_VERSION}")
+ mark_as_advanced(TAGLIB_CFLAGS TAGLIB_LIBRARIES TAGLIB_INCLUDES)
+
+ else(TAGLIBCONFIG_EXECUTABLE)
+--
+2.7.4.1.g5468f9e
+
diff --git a/acoustid-fingerprinter.spec b/acoustid-fingerprinter.spec
index 046bc63..8cd8cf0 100644
--- a/acoustid-fingerprinter.spec
+++ b/acoustid-fingerprinter.spec
@@ -1,13 +1,17 @@
Name: acoustid-fingerprinter
Version: 0.6
-Release: 11%{?dist}
+Release: 12%{?dist}
Summary: Music AcoustID fingerprinting application
-Group: System Environment/Libraries
License: GPLv2+
URL:
http://acoustid.org/fingerprinter
Source:
https://github.com/downloads/lalinsky/%{name}/%{name}-%{version}.tar.gz
-Patch0: acoustid-fingerprinter-0.6-ffmpeg.patch
+Patch0: 01-Fix-build-with-upcoming-Libav-10-release.patch
+Patch1: 02-CodecID.patch
+Patch2: 03-pkg-config.patch
+Patch3: 04-typo-warning.patch
+Patch4: 05-g++-6-char-cast.patch
+Patch5: 06-taglib.patch
BuildRequires: cmake
BuildRequires: qt4-devel
@@ -19,7 +23,6 @@ BuildRequires: libchromaprint-devel
Requires: hicolor-icon-theme
%description
-
Acoustid fingerprinter is a cross-platform GUI application that uses
Chromaprint to submit audio fingerprints from your music collection
to the Acoustid database. Only tagged audio files are submitted.
@@ -28,19 +31,16 @@ but it will submit fingerprints for any files that have tags such as
track title, artist name, album name, etc.
%prep
-%setup -q
-%patch0 -p1 -b .ffmpeg
-
+%autosetup -p1
%build
%cmake -DCMAKE_BUILD_TYPE=Debug
# removing the -O3 optimization flag for the release building type
sed -i "s/-O3 -DNDEBUG//g" CMakeCache.txt
-make %{?_smp_mflags}
-
+%make_build
%install
-make install DESTDIR=%{buildroot}
+%make_install
install -d -m755 %{buildroot}%{_datadir}/applications
@@ -54,26 +54,30 @@ install -p -D -m 0644 images/%{name}.svg
%{buildroot}%{_datadir}/icons/hicolor/
%post
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
-/usr/bin/update-mime-database %{_datadir}/mime &> /dev/null || :
%postun
if [ $1 -eq 0 ] ; then
/bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
-/usr/bin/update-mime-database %{_datadir}/mime &> /dev/null || :
%posttrans
/usr/bin/gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files
-%doc CHANGES.txt COPYING.txt
+%doc CHANGES.txt
+%license COPYING.txt
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%changelog
+* Sun Jun 18 2017 Leigh Scott <leigh123linux(a)googlemail.com> - 0.6-12
+- Fix build (patches from Debian)
+- Update scriptlets
+- Update spec fire
+
* Sat Mar 18 2017 RPM Fusion Release Engineering <kwizart(a)rpmfusion.org> - 0.6-11
- Rebuilt for
https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild