git: 0075dcd7f970 - main - audio/sox: Update to latest commit (20210509)

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Sun, 06 Nov 2022 10:48:47 UTC
The branch main has been updated by diizzy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0075dcd7f970fd00fa97532afd6fabed95661f0f

commit 0075dcd7f970fd00fa97532afd6fabed95661f0f
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2022-11-06 09:29:02 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2022-11-06 10:46:52 +0000

    audio/sox: Update to latest commit (20210509)
    
    Since development seems to progress very slowly just follow other distros
    and update to latest commit. We're using Gentoo's distfile as source since
    there's no way to download arbitrary git hashes in tar/zip format without
    using a browser and there's no need for us to roll our own.
    
    This fixes following CVEs:
    CVE-2019-13590
    CVE-2019-8357
    CVE-2019-8356
    CVE-2019-8355
    CVE-2019-8354
    CVE-2017-18189
    CVE-2017-15642
    CVE-2017-15372
    CVE-2017-15371
    CVE-2017-15370
    CVE-2017-11359
    CVE-2017-11358
    CVE-2017-11332
    
    Reference:
    https://github.com/doremir/sox/commit/d05aba55a86177f7a3d395c7a03c5c4e280b31fb
    
    PR:             267128
    Reviewed by:    Dan Nelson <dnelson@allantgroup.com> (maintainer)
---
 audio/sox/Makefile                 | 35 ++++++++++++-----------------------
 audio/sox/distinfo                 |  7 +++----
 audio/sox/files/patch-src_oss.c    | 17 -----------------
 audio/sox/files/patch-src_output.c | 14 ++++++++++++++
 audio/sox/pkg-plist                |  1 -
 5 files changed, 29 insertions(+), 45 deletions(-)

diff --git a/audio/sox/Makefile b/audio/sox/Makefile
index ed6a22e03f72..bdf11551d501 100644
--- a/audio/sox/Makefile
+++ b/audio/sox/Makefile
@@ -1,11 +1,8 @@
 PORTNAME=	sox
-PORTVERSION=	14.4.2
-PORTREVISION=	7
+DISTVERSION=	14.4.2.20210509
 CATEGORIES=	audio
-MASTER_SITES=	SF
-
-PATCHFILES=	0001-Remove-pure-attribute-from-functions-with-side-effec.patch:-p1
-PATCH_SITES=	https://sourceforge.net/p/sox/patches/104/attachment/
+MASTER_SITES=	https://dev.gentoo.org/~fordfrog/distfiles/
+DISTNAME=	sox-code-42b3557e13e0fe01a83465b672d89faddbe65f49
 
 MAINTAINER=	dnelson@allantgroup.com
 COMMENT=	SOund eXchange - universal sound sample translator
@@ -14,34 +11,30 @@ WWW=		http://sox.sourceforge.net/
 LICENSE=	LGPL21 GPLv2
 LICENSE_COMB=	dual
 
+BUILD_DEPENDS=	autoconf-archive>=0:devel/autoconf-archive
 LIB_DEPENDS=	libltdl.so:devel/libltdl
 
 CONFLICTS=	play
 
+USES=		autoreconf cpe libtool localbase:ldflags pkgconfig zip
 GNU_CONFIGURE=	yes
-USES=		autoreconf cpe libtool localbase:ldflags pkgconfig
 USE_LDCONFIG=	yes
 
+WRKSRC=		${WRKDIR}/${DISTNAME}
+
 OPTIONS_DEFINE=	AMRNB AMRWB FLAC GSM ID3TAG LADSPA LAME MAD OPUS PNG \
 		SNDFILE TWOLAME VORBIS WAVPACK
-OPTIONS_DEFAULT=	AO FLAC GSM ID3TAG MAD OPUS OSS PNG SNDFILE VORBIS
+OPTIONS_DEFAULT=	AO FLAC GSM ID3TAG LAME MAD OPUS OSS PNG SNDFILE VORBIS
 OPTIONS_GROUP=	SOUND
 OPTIONS_GROUP_SOUND=	ALSA AO OSS PULSEAUDIO SNDIO
-# Default LAME to off for packages so we don't end up RESTRICTED
-.if !defined(PACKAGE_BUILDING)
-OPTIONS_DEFAULT+=	LAME
-.endif
 
 AMRNB_DESC=	AMR Speech Codec (Narrowband)
 AMRWB_DESC=	AMR Speech Codec (Wideband)
-GSM_DESC=	Use libgsm from ports (else use bundled lib)
 PNG_DESC=	PNG spectrogram creation
 
-LDFLAGS+=	-lpthread
-CONFIGURE_ARGS+=	--with-pkgconfigdir="${PREFIX}/libdata/pkgconfig"
-CONFIGURE_ARGS+=	--with-distro="${CONFIGURE_TARGET} ${PKGNAME}"
-CONFIGURE_ARGS+=	--with-gsm
-CONFIGURE_ARGS+=	--disable-stack-protector
+CONFIGURE_ARGS=	--with-pkgconfigdir="${PREFIX}/libdata/pkgconfig" \
+		--with-distro="${CONFIGURE_TARGET} ${PKGNAME}" \
+		--disable-stack-protector --disable-static
 
 ALSA_CONFIGURE_WITH=	alsa
 ALSA_LIB_DEPENDS=	libasound.so:audio/alsa-lib
@@ -86,6 +79,7 @@ PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
 SNDIO_CONFIGURE_WITH=	sndio
 SNDIO_LIB_DEPENDS=	libsndio.so:audio/sndio
 
+GSM_CONFIGURE_WITH=	gsm libgsm
 GSM_LIB_DEPENDS=	libgsm.so:audio/gsm
 
 ID3TAG_CONFIGURE_WITH=	id3tag
@@ -100,11 +94,6 @@ TWOLAME_LIB_DEPENDS=	libtwolame.so:audio/twolame
 OPUS_CONFIGURE_WITH=	opus
 OPUS_LIB_DEPENDS=	libopusfile.so:audio/opusfile
 
-# We cannot ask for gsm to be enabled without it trying to use external gsm,
-# so force the autoconf checks to fail
-GSM_CONFIGURE_ENV_OFF=	ac_cv_header_gsm_h=no ac_cv_header_gsm_gsm_h=no \
-		ac_cv_lib_gsm_gsm_create=no
-
 INSTALL_TARGET=		install-strip
 
 .include <bsd.port.mk>
diff --git a/audio/sox/distinfo b/audio/sox/distinfo
index 7a9148a855f0..a795cc426689 100644
--- a/audio/sox/distinfo
+++ b/audio/sox/distinfo
@@ -1,4 +1,3 @@
-SHA256 (sox-14.4.2.tar.gz) = b45f598643ffbd8e363ff24d61166ccec4836fea6d3888881b8df53e3bb55f6c
-SIZE (sox-14.4.2.tar.gz) = 1134299
-SHA256 (0001-Remove-pure-attribute-from-functions-with-side-effec.patch) = c267442c506e674b8cba800c0a3425904d91b69f25c0cf5bcb8f31445361c0a0
-SIZE (0001-Remove-pure-attribute-from-functions-with-side-effec.patch) = 1273
+TIMESTAMP = 1665916081
+SHA256 (sox-code-42b3557e13e0fe01a83465b672d89faddbe65f49.zip) = bfe00d1530cd69431d16511ddc83b266889187fd2cad0cd7d2c2c140ab3c4009
+SIZE (sox-code-42b3557e13e0fe01a83465b672d89faddbe65f49.zip) = 942551
diff --git a/audio/sox/files/patch-src_oss.c b/audio/sox/files/patch-src_oss.c
deleted file mode 100644
index 8538e8689214..000000000000
--- a/audio/sox/files/patch-src_oss.c
+++ /dev/null
@@ -1,17 +0,0 @@
-$NetBSD: patch-src_oss.c,v 1.1 2015/05/25 19:06:24 bsiegert Exp $
-
-Fix segfault when playing (PR pkg/49929).
-
-http://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=49929
-
---- src/oss.c.orig	2014-10-06 02:02:30 UTC
-+++ src/oss.c
-@@ -369,7 +369,7 @@ static size_t osswrite(
-         size_t cbStride;
-         int cbWritten;
- 
--        cStride = cInput;
-+        cStride = cInputRemaining;
-         if (cStride > pPriv->cOutput) {
-             cStride = pPriv->cOutput;
-         }
diff --git a/audio/sox/files/patch-src_output.c b/audio/sox/files/patch-src_output.c
new file mode 100644
index 000000000000..6075a47aaec4
--- /dev/null
+++ b/audio/sox/files/patch-src_output.c
@@ -0,0 +1,14 @@
+--- src/output.c.orig	2021-05-09 20:19:07 UTC
++++ src/output.c
+@@ -31,6 +31,11 @@ static int flow(sox_effect_t *effp, sox_sample_t const
+     sox_sample_t * obuf, size_t * isamp, size_t * osamp)
+ {
+   priv_t * p = (priv_t *)effp->priv;
++  /* Abort if there are no samples to write */
++  if (*isamp == 0) {
++    *osamp = 0;
++    return SOX_SUCCESS;
++  }
+   /* Write out *isamp samples */
+   size_t len = sox_write(p->file, ibuf, *isamp);
+ 
diff --git a/audio/sox/pkg-plist b/audio/sox/pkg-plist
index ffc43964e4e5..e45ad5650069 100644
--- a/audio/sox/pkg-plist
+++ b/audio/sox/pkg-plist
@@ -3,7 +3,6 @@ bin/rec
 bin/sox
 bin/soxi
 include/sox.h
-lib/libsox.a
 lib/libsox.so
 lib/libsox.so.3
 lib/libsox.so.3.0.0