diff --git a/libsndfile-1.1.0-cefd7b59.patch b/libsndfile-1.1.0-cefd7b59.patch new file mode 100644 index 0000000..c3fab48 --- /dev/null +++ b/libsndfile-1.1.0-cefd7b59.patch @@ -0,0 +1,75 @@ +From cefd7b59df628eca240af3c136d66137c8e94888 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= +Date: Thu, 8 Sep 2022 10:49:36 +0200 +Subject: [PATCH] tests: Use fuzzy comparison in test-suite +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Using exact comparison ("a == b") when comparing expected with computed +test data fails the test-suite on many architectures (including, but not +limited to armhf and arm64). + +Instead, use epsilon(for now, FLT_EPSILON and DBL_EPSILON) to compare +floating point numbers for equality. + + +Closes: https://github.com/libsndfile/libsndfile/issues/866 + +Signed-off-by: IOhannes m zmölnig +--- + tests/utils.tpl | 27 +++++++++++++++++++++++++-- + 1 file changed, 25 insertions(+), 2 deletions(-) + +diff --git a/tests/utils.tpl b/tests/utils.tpl +index c68e3a26e..0d1cd8bb9 100644 +--- a/tests/utils.tpl ++++ b/tests/utils.tpl +@@ -193,6 +193,7 @@ sf_count_t file_length_fd (int fd) ; + #include + #include + #include ++#include + #include + #include + +@@ -215,6 +216,28 @@ sf_count_t file_length_fd (int fd) ; + #define O_BINARY 0 + #endif + ++ ++/* ++** Compare for equality, with epsilon ++*/ ++static inline int ++equals_short (const short a, const short b) ++{ return (a == b); ++} /* equals_short */ ++static inline int ++equals_int (const int a, const int b) ++{ return (a == b); ++} /* equals_int */ ++static inline int ++equals_float (const float a, const float b) ++{ return (fabsf(a - b) <= FLT_EPSILON); ++} /* equals_float */ ++static inline int ++equals_double (const double a, const double b) ++{ return (fabs(a - b) <= DBL_EPSILON); ++} /* equals_double */ ++ ++ + [+ FOR float_type +] + void + gen_windowed_sine_[+ (get "name") +] ([+ (get "name") +] *data, int len, double maximum) +@@ -752,8 +775,8 @@ compare_[+ (get "io_element") +]_or_die (const [+ (get "io_element") +] *expecte + unsigned k ; + + for (k = 0 ; k < count ; k++) +- if (expected [k] != actual [k]) +- { printf ("\n\nLine %d : Error at index %d, got " [+ (get "format_str") +] ", should be " [+ (get "format_str") +] ".\n\n", line_num, k, actual [k], expected [k]) ; ++ if (!equals_[+ (get "io_element") +](expected [k], actual [k])) ++ { printf ("\n\nLine %d : Error at index %d, got " [+ (get "format_str") +] ", should be " [+ (get "format_str") +] "(delta=" [+ (get "format_str") +] " ).\n\n", line_num, k, actual [k], expected [k], actual [k] - expected [k]) ; + exit (1) ; + } ; + diff --git a/libsndfile.spec b/libsndfile.spec index 07d8012..783dfda 100644 --- a/libsndfile.spec +++ b/libsndfile.spec @@ -1,11 +1,13 @@ Summary: Library for reading and writing sound files Name: libsndfile Version: 1.1.0 -Release: 3%{?dist} +Release: 4%{?dist} License: LGPLv2+ and GPLv2+ and BSD URL: http://libsndfile.github.io/libsndfile/ Source0: https://github.com/libsndfile/libsndfile/releases/download/%{version}/libsndfile-%{version}.tar.xz Patch0: libsndfile-1.0.25-system-gsm.patch +Patch1: libsndfile-1.1.0-cefd7b59.patch +BuildRequires: autogen BuildRequires: gcc-c++ BuildRequires: alsa-lib-devel BuildRequires: flac-devel @@ -19,9 +21,8 @@ BuildRequires: libtool BuildRequires: make BuildRequires: python3 BuildRequires: opus-devel -# enable later, now it fails on some archs #https://github.com/libsndfile/libsndfile/issues/860 -#BuildRequires: lame-devel -#BuildRequires: mpg123-devel +BuildRequires: lame-devel +BuildRequires: mpg123-devel %description @@ -57,6 +58,7 @@ This package contains command line utilities for libsndfile. %prep %setup -q %patch0 -p1 -b .system-gsm +%patch1 -p1 -b .cefd7b59 rm -r src/GSM610 %build @@ -66,9 +68,8 @@ autoreconf -I M4 -fiv # for system-gsm patch --enable-sqlite \ --enable-alsa \ --enable-largefile \ + --enable-mpeg \ --disable-static -# enable later, now it fails on some archs #https://github.com/libsndfile/libsndfile/issues/860 -# --enable-mpeg \ # Get rid of rpath sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool @@ -152,6 +153,9 @@ LD_LIBRARY_PATH=$PWD/src/.libs make check %changelog +* Sat Sep 10 2022 Michal Hlavinka - 1.1.0-4 +- enable MP3 support + * Wed Aug 03 2022 Michal Hlavinka - 1.1.0-3 - new MPEG support does not compile on some archs, do not enable it yet