commit:     a1e6a1e46d905e7bf728bb8ecfed0f342f460ae6
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 17 03:56:38 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Mar 17 03:56:38 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a1e6a1e4

media-libs/libfishsound: fix modern C issue

Closes: https://bugs.gentoo.org/883393
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/libfishsound-1.0.0-c99.patch             | 65 ++++++++++++++++++++++
 .../libfishsound/libfishsound-1.0.0-r2.ebuild      | 52 +++++++++++++++++
 2 files changed, 117 insertions(+)

diff --git a/media-libs/libfishsound/files/libfishsound-1.0.0-c99.patch 
b/media-libs/libfishsound/files/libfishsound-1.0.0-c99.patch
new file mode 100644
index 000000000000..d010eb75ac0b
--- /dev/null
+++ b/media-libs/libfishsound/files/libfishsound-1.0.0-c99.patch
@@ -0,0 +1,65 @@
+https://bugs.gentoo.org/883393
+https://gitlab.xiph.org/xiph/libfishsound/-/merge_requests/1
+
+From 8eb391d772cb3c3dbfb68b2216e095af705b0229 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Martin=20Stegh=C3=B6fer?= <mar...@steghoefer.eu>
+Date: Wed, 22 Oct 2014 22:03:15 +0200
+Subject: [PATCH] Fix incompatible flac callback types.
+
+Bug-Debian: https://bugs.debian.org/766394
+
+Starting from libflac 1.1.3 the flac API uses "size_t" as parameter type for 
the number of bytes in all callback functions.
+--- a/src/libfishsound/flac.c
++++ b/src/libfishsound/flac.c
+@@ -56,6 +56,13 @@
+ 
+ #define BITS_PER_SAMPLE 24
+ 
++#if defined(HAVE_FLAC_1_1_3)
++#  define flac_callback_bytes_type size_t
++#else
++#  define flac_callback_bytes_type unsigned int
++#endif
++
++
+ typedef struct _FishSoundFlacInfo {
+   FLAC__StreamDecoder *fsd;
+   FLAC__StreamEncoder *fse;
+@@ -106,7 +113,7 @@ fs_flac_command (FishSound * fsound, int command, void * 
data, int datasize)
+ #if FS_DECODE
+ static FLAC__StreamDecoderReadStatus
+ fs_flac_read_callback(const FLAC__StreamDecoder *decoder,
+-                      FLAC__byte buffer[], unsigned int *bytes,
++                      FLAC__byte buffer[], flac_callback_bytes_type *bytes,
+                       void *client_data)
+ {
+   FishSound* fsound = (FishSound*)client_data;
+@@ -121,7 +128,7 @@ fs_flac_read_callback(const FLAC__StreamDecoder *decoder,
+   }
+ 
+   memcpy(buffer, fi->buffer, fi->bufferlength);
+-  *bytes = (unsigned int)fi->bufferlength;
++  *bytes = (flac_callback_bytes_type)fi->bufferlength;
+   fi->bufferlength = 0;
+   return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+ }
+@@ -346,7 +353,7 @@ dec_err:
+ #if FS_ENCODE
+ static FLAC__StreamEncoderWriteStatus
+ fs_flac_enc_write_callback(const FLAC__StreamEncoder *encoder,
+-                           const FLAC__byte buffer[], unsigned bytes,
++                           const FLAC__byte buffer[], 
flac_callback_bytes_type bytes,
+                            unsigned samples, unsigned current_frame,
+                            void *client_data)
+ {
+@@ -354,7 +361,7 @@ fs_flac_enc_write_callback(const FLAC__StreamEncoder 
*encoder,
+   FishSoundFlacInfo *fi = fsound->codec_data;
+ 
+   debug_printf(1, "IN");
+-  debug_printf(1, "bytes: %d, samples: %d", bytes, samples);
++  debug_printf(1, "bytes: %lld, samples: %d", (long long) bytes, samples);
+ 
+   if (fsound->callback.encoded) {
+     FishSoundEncoded encoded = (FishSoundEncoded) fsound->callback.encoded;
+-- 
+GitLab

diff --git a/media-libs/libfishsound/libfishsound-1.0.0-r2.ebuild 
b/media-libs/libfishsound/libfishsound-1.0.0-r2.ebuild
new file mode 100644
index 000000000000..174d912e442b
--- /dev/null
+++ b/media-libs/libfishsound/libfishsound-1.0.0-r2.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="Simple programming interface to decode and encode audio with 
vorbis or speex"
+HOMEPAGE="https://www.xiph.org/fishsound/";
+SRC_URI="https://downloads.xiph.org/releases/libfishsound/${P}.tar.gz";
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="flac speex"
+
+RDEPEND="
+       media-libs/libogg
+       media-libs/libvorbis
+       flac? ( media-libs/flac:= )
+       speex? ( media-libs/speex )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+# bug #395153
+RESTRICT="test"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-pc.patch
+       "${FILESDIR}"/${PN}-1.0.0-c99.patch
+)
+
+src_prepare() {
+       default
+       sed -i \
+               -e 's:doxygen:doxygen-dummy:' \
+               configure || die
+}
+
+src_configure() {
+       local myconf="--disable-static"
+       use flac || myconf="${myconf} --disable-flac"
+       use speex || myconf="${myconf} --disable-speex"
+
+       econf ${myconf}
+}
+
+src_install() {
+       emake DESTDIR="${D}" \
+               docdir="${D}/usr/share/doc/${PF}" install
+       dodoc AUTHORS ChangeLog README
+       find "${ED}" -name '*.la' -delete || die
+}

Reply via email to