pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

sox_ng: add start of a package, doesn't get very far



Module Name:	pkgsrc-wip
Committed By:	Thomas Klausner <wiz%NetBSD.org@localhost>
Pushed By:	wiz
Date:		Tue Jun 24 17:49:38 2025 +0200
Changeset:	cb952f5d06fd743492c25da40d41fda6ed94ea9e

Modified Files:
	Makefile
Added Files:
	sox_ng/DESCR
	sox_ng/Makefile
	sox_ng/PLIST
	sox_ng/TODO
	sox_ng/buildlink3.mk
	sox_ng/distinfo
	sox_ng/options.mk
	sox_ng/patches/patch-src_oss.c
	sox_ng/patches/patch-src_sox__ng.c
	sox_ng/patches/patch-src_sunaudio.c

Log Message:
sox_ng: add start of a package, doesn't get very far

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=cb952f5d06fd743492c25da40d41fda6ed94ea9e

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                            |  1 +
 sox_ng/DESCR                        | 15 +++++++++++++++
 sox_ng/Makefile                     | 34 ++++++++++++++++++++++++++++++++++
 sox_ng/PLIST                        | 15 +++++++++++++++
 sox_ng/TODO                         |  1 +
 sox_ng/buildlink3.mk                | 13 +++++++++++++
 sox_ng/distinfo                     |  8 ++++++++
 sox_ng/options.mk                   | 19 +++++++++++++++++++
 sox_ng/patches/patch-src_oss.c      | 15 +++++++++++++++
 sox_ng/patches/patch-src_sox__ng.c  | 34 ++++++++++++++++++++++++++++++++++
 sox_ng/patches/patch-src_sunaudio.c | 37 +++++++++++++++++++++++++++++++++++++
 11 files changed, 192 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index f4f9304022..acf0bd847a 100644
--- a/Makefile
+++ b/Makefile
@@ -5416,6 +5416,7 @@ SUBDIR+=	sonic-visualiser
 SUBDIR+=	sophia
 SUBDIR+=	soplex
 SUBDIR+=	soqt
+SUBDIR+=	sox_ng
 SUBDIR+=	spacefm
 SUBDIR+=	spai
 SUBDIR+=	spamassassin-cvs
diff --git a/sox_ng/DESCR b/sox_ng/DESCR
new file mode 100644
index 0000000000..fcd1b2e890
--- /dev/null
+++ b/sox_ng/DESCR
@@ -0,0 +1,15 @@
+sox translates sound samples between different file formats,
+and performs various sound effects.
+
+This release understands "raw" files in various binary formats,
+raw textual data,
+Sound Blaster .VOC files, IRCAM SoundFile files, SUN Sparcstation
+.au files, mutant DEC .au files, Apple/SGI AIFF files,
+CD-R (music CD format), Macintosh HCOM files, Sounder files,
+NeXT .snd files, SUN ADPCM (compressed) .au files,
+and Soundtool (DOS) files.
+
+The sound effects include changing the sample rate, adding echo
+delay lines, applying low-, high, and band-pass filtering,
+reversing a sample in order to search for backmasked messages,
+and the infamous Fender Vibro effect.
diff --git a/sox_ng/Makefile b/sox_ng/Makefile
new file mode 100644
index 0000000000..9716e41957
--- /dev/null
+++ b/sox_ng/Makefile
@@ -0,0 +1,34 @@
+# $NetBSD: Makefile,v 1.73 2025/02/12 06:44:29 ryoon Exp $
+
+DISTNAME=	sox_ng-14.6.0
+CATEGORIES=	audio
+MASTER_SITES=	https://codeberg.org/sox_ng/sox_ng/releases/download/${DISTNAME}/
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://codeberg.org/sox_ng/sox_ng
+COMMENT=	SOund eXchange - universal sound sample translator
+LICENSE=	gnu-lgpl-v2.1 AND gnu-gpl-v2
+
+USE_LANGUAGES=		c c++
+USE_TOOLS+=		pkg-config
+
+PKGCONFIG_OVERRIDE+=	sox.pc.in
+
+SUBST_CLASSES+=		gsm
+SUBST_FILES.gsm=	configure src/gsm.c src/wav.c CMakeLists.txt
+SUBST_SED.gsm=		-e "s!gsm/gsm.h!gsm.h!"
+SUBST_STAGE.gsm=	pre-configure
+
+.include "options.mk"
+
+.include "../../devel/cmake/build.mk"
+.include "../../audio/flac/buildlink3.mk"
+.include "../../audio/gsm/buildlink3.mk"
+.include "../../audio/libmad/buildlink3.mk"
+.include "../../audio/libsamplerate/buildlink3.mk"
+.include "../../audio/libsndfile/buildlink3.mk"
+.include "../../audio/libvorbis/buildlink3.mk"
+.include "../../devel/zlib/buildlink3.mk"
+.include "../../graphics/png/buildlink3.mk"
+.include "../../sysutils/file/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/sox_ng/PLIST b/sox_ng/PLIST
new file mode 100644
index 0000000000..0d028f973c
--- /dev/null
+++ b/sox_ng/PLIST
@@ -0,0 +1,15 @@
+@comment $NetBSD: PLIST,v 1.7 2012/07/04 09:27:37 adam Exp $
+bin/play
+bin/rec
+bin/sox
+bin/soxi
+include/sox.h
+lib/libsox.la
+lib/pkgconfig/sox.pc
+man/man1/play.1
+man/man1/rec.1
+man/man1/sox.1
+man/man1/soxi.1
+man/man3/libsox.3
+man/man7/soxeffect.7
+man/man7/soxformat.7
diff --git a/sox_ng/TODO b/sox_ng/TODO
new file mode 100644
index 0000000000..77002d1f49
--- /dev/null
+++ b/sox_ng/TODO
@@ -0,0 +1 @@
+Doesn't finish cmake's configure step yet.
diff --git a/sox_ng/buildlink3.mk b/sox_ng/buildlink3.mk
new file mode 100644
index 0000000000..921766e3c9
--- /dev/null
+++ b/sox_ng/buildlink3.mk
@@ -0,0 +1,13 @@
+# $NetBSD: buildlink3.mk,v 1.3 2010/10/19 16:34:18 abs Exp $
+
+BUILDLINK_TREE+=	sox
+
+.if !defined(SOX_BUILDLINK3_MK)
+SOX_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.sox+=	sox>=14.3.1
+BUILDLINK_ABI_DEPENDS.sox+=	sox>=14.3.1
+BUILDLINK_PKGSRCDIR.sox?=	../../audio/sox
+.endif # SOX_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-sox
diff --git a/sox_ng/distinfo b/sox_ng/distinfo
new file mode 100644
index 0000000000..6b0bc5b4f9
--- /dev/null
+++ b/sox_ng/distinfo
@@ -0,0 +1,8 @@
+$NetBSD: distinfo,v 1.31 2022/04/24 09:39:46 nia Exp $
+
+BLAKE2s (sox_ng-14.6.0.tar.gz) = 1ae2d51dd786ca02fb37085f5b6c2593f7cae7f7f5398780803d19787cbf8f4d
+SHA512 (sox_ng-14.6.0.tar.gz) = 9248c3f3271462d78803389ed181deb0b507dc86d5825f858d9f3eca4e6f834570c0f536c08eb0893e6275cd67c562211c8afc3b5de0163649fa36be499eb6da
+Size (sox_ng-14.6.0.tar.gz) = 1860399 bytes
+SHA1 (patch-src_oss.c) = f4665b500a5e6a996768e415145e751d9ff9886c
+SHA1 (patch-src_sox__ng.c) = 1dc7ddacbb1a7de683b3af981cc0d08e31888bae
+SHA1 (patch-src_sunaudio.c) = dd624099df32f67948becd647eded4d69c7c1c34
diff --git a/sox_ng/options.mk b/sox_ng/options.mk
new file mode 100644
index 0000000000..0d9855eff5
--- /dev/null
+++ b/sox_ng/options.mk
@@ -0,0 +1,19 @@
+# $NetBSD: options.mk,v 1.6 2017/01/07 21:30:26 maya Exp $
+
+PKG_OPTIONS_VAR=	PKG_OPTIONS.sox
+PKG_SUPPORTED_OPTIONS=	lame oss
+# lame has LICENSE= issues and thus should not be SUGGESTED.
+PKG_SUGGESTED_OPTIONS=
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Mlame)
+# This is an option due to LICENSE= issues.
+.include "../../audio/lame/buildlink3.mk"
+.endif
+
+.if !empty(PKG_OPTIONS:Moss)
+LDFLAGS+=		-lossaudio
+.include "../../mk/oss.buildlink3.mk"
+.else
+CONFIGURE_ARGS+=	--without-oss
+.endif
diff --git a/sox_ng/patches/patch-src_oss.c b/sox_ng/patches/patch-src_oss.c
new file mode 100644
index 0000000000..0e284b1960
--- /dev/null
+++ b/sox_ng/patches/patch-src_oss.c
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Fix segfault when playing (PR pkg/49929).
+
+--- src/oss.c.orig	2025-05-26 15:24:07.000000000 +0000
++++ src/oss.c
+@@ -367,7 +367,7 @@ static size_t osswrite(
+         size_t cbStride;
+         int cbWritten;
+ 
+-        cStride = cInput;
++        cStride = cInputRemaining;
+         if (cStride > pPriv->cOutput) {
+             cStride = pPriv->cOutput;
+         }
diff --git a/sox_ng/patches/patch-src_sox__ng.c b/sox_ng/patches/patch-src_sox__ng.c
new file mode 100644
index 0000000000..50685a3f64
--- /dev/null
+++ b/sox_ng/patches/patch-src_sox__ng.c
@@ -0,0 +1,34 @@
+$NetBSD$
+
+PR pkg/56800 hitting v or V during sox's play command causes a
+segfault
+
+https://sourceforge.net/p/sox/code/ci/4b17639fb7591153dbd3e234eea21b1a2a29fcfa/
+from more than 10 years ago changed the sun audio driver for the 14.4 release
+to not use stdio (among others) while adjust_volume() in sox.c still used
+fileno under the assumption that stdio was being used in the audio driver.
+
+output_muted is not defined on NetBSD.
+
+--- src/sox_ng.c.orig	2025-06-10 06:22:30.000000000 +0000
++++ src/sox_ng.c
+@@ -1325,7 +1325,8 @@ static void adjust_volume(int delta)
+ #elif defined(HAVE_AUDIOIO_H)
+ static void adjust_volume(int delta)
+ {
+-  int vol1 = 0, vol2 = 0, fd = fileno((FILE*)ofile->ft->fp);
++  int vol1 = 0, vol2 = 0, fd;
++  fd = ofile->ft->fp != NULL ? *((int *)ofile->ft->fp) : -1;
+   fprintf(stderr, "Audioio volume\n");
+   if (lsx_adjust_softvol(delta) == SOX_SUCCESS) return;
+   if (fd >= 0) {
+@@ -1335,7 +1336,9 @@ static void adjust_volume(int delta)
+       vol2 = range_limit(vol1 + delta, 0, 100);
+       AUDIO_INITINFO(&audio_info);
+       audio_info.play.gain = (vol2 * AUDIO_MAX_GAIN + 50) / 100;
++#if defined(__sun)
+       audio_info.output_muted = 0;
++#endif
+       lsx_debug("%04x %04x", vol1, vol2);
+       if (vol1 != vol2 && ioctl(fd, AUDIO_SETINFO, &audio_info) < 0)
+         vol2 = vol1;
diff --git a/sox_ng/patches/patch-src_sunaudio.c b/sox_ng/patches/patch-src_sunaudio.c
new file mode 100644
index 0000000000..47324d3556
--- /dev/null
+++ b/sox_ng/patches/patch-src_sunaudio.c
@@ -0,0 +1,37 @@
+$NetBSD$
+
+- Make the now unused (in the audio driver's case) void *fp member of the
+  sox_format_t structure a pointer to the filedescriptor of the audio
+  device in the driver and reference it in adjust_volume() with an
+  additional check for NULL. (PR pkg/56800)
+
+- Fix segfault when playing (PR pkg/49929).
+
+--- src/sunaudio.c.orig	2025-05-26 15:24:07.000000000 +0000
++++ src/sunaudio.c
+@@ -334,6 +334,8 @@ static int sunstartwrite(sox_format_t * 
+     pPriv->cOutput = sox_globals.bufsiz >> pPriv->sample_shift;
+     pPriv->pOutput = lsx_malloc((size_t)pPriv->cOutput << pPriv->sample_shift);
+ 
++    ft->fp = &pPriv->device;
++
+     return (SOX_SUCCESS);
+ }
+ 
+@@ -346,6 +348,7 @@ static int sunstop(sox_format_t* ft)
+     if (pPriv->pOutput) {
+         free(pPriv->pOutput);
+     }
++    ft->fp = NULL;
+     return SOX_SUCCESS;
+ }
+ 
+@@ -441,7 +444,7 @@ static size_t sunwrite(
+         size_t cbStride;
+         int cbWritten;
+ 
+-        cStride = cInput;
++        cStride = cInputRemaining;
+         if (cStride > pPriv->cOutput) {
+             cStride = pPriv->cOutput;
+         }


Home | Main Index | Thread Index | Old Index