libsndfile: fix sndfile-play tool on netbsd

This commit is contained in:
nia 2021-09-09 12:14:42 +00:00
parent 31650238de
commit f73dc07a18
4 changed files with 63 additions and 32 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.87 2021/09/09 12:03:09 nia Exp $
# $NetBSD: Makefile,v 1.88 2021/09/09 12:14:42 nia Exp $
DISTNAME= libsndfile-1.0.31
PKGREVISION= 1
PKGREVISION= 2
CATEGORIES= audio
MASTER_SITES= ${MASTER_SITE_GITHUB:=libsndfile/}
GITHUB_PROJECT= libsndfile

View file

@ -1,8 +1,9 @@
$NetBSD: distinfo,v 1.50 2021/09/09 12:03:09 nia Exp $
$NetBSD: distinfo,v 1.51 2021/09/09 12:14:42 nia Exp $
SHA1 (libsndfile-1.0.31.tar.bz2) = f16a88e7223baef7c4497536dc1b55b56811debc
RMD160 (libsndfile-1.0.31.tar.bz2) = ae3fc5bbcb10a034f3edc1240acacd9f1ec349a7
SHA512 (libsndfile-1.0.31.tar.bz2) = 62202092e5cac6346fd3c0a977380e9bf888fc59d08c9c9707dc254a8ef6ed6356da2ab0430bb970c7b06ba5bb1dafa5d7b0fe13898834c1fe4acb16f409f0e1
Size (libsndfile-1.0.31.tar.bz2) = 875335 bytes
SHA1 (patch-CVE-2021-3246) = 08620e24b8a41afd7c164781bf6088028ffc97ed
SHA1 (patch-programs_sndfile-play.c) = 974cf854b9ae4e8be631583edb3da5e41791d9a7
SHA1 (patch-src_wavlike.c) = b2524c62d8dad9959ff7a50c412b0e85bf433f47

View file

@ -1,43 +1,30 @@
# $NetBSD: options.mk,v 1.10 2019/11/02 21:09:14 rillig Exp $
# $NetBSD: options.mk,v 1.11 2021/09/09 12:14:42 nia Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.libsndfile
.include "../../mk/bsd.prefs.mk"
.if ${OPSYS} == "Linux"
PKG_SUPPORTED_OPTIONS= alsa octave
PKG_SUGGESTED_OPTIONS= alsa
.else
PKG_SUPPORTED_OPTIONS= octave
PKG_OPTIONS_OPTIONAL_GROUPS= output
PKG_OPTIONS_GROUP.output= oss sun
SNDFILE_OUTPUT.NetBSD= sun
SNDFILE_OUTPUT.OpenBSD= sun
SNDFILE_OUTPUT.SunOS= sun
.include "../../mk/bsd.fast.prefs.mk"
.if !defined(SNDFILE_OUTPUT.${OPSYS})
CHECK_BUILTIN.oss:= yes
. include "../../mk/oss.builtin.mk"
CHECK_BUILTIN.oss:= no
. if defined(IS_BUILTIN.oss) && !empty(IS_BUILTIN.oss:M[yY][eE][sS])
SNDFILE_OUTPUT.${OPSYS}?= oss
. endif
.endif
PKG_SUGGESTED_OPTIONS= ${SNDFILE_OUTPUT.${OPSYS}}
.include "../../mk/bsd.options.mk"
.if !empty(PKG_OPTIONS:Malsa)
CONFIGURE_ARGS+= --enable-alsa
.include "../../audio/alsa-lib/buildlink3.mk"
.else
CONFIGURE_ARGS+= --disable-alsa
.endif
.if !empty(PKG_OPTIONS:Moctave)
USE_LANGUAGES= c c++ fortran
USE_TOOLS+= gmake
CONFIGURE_ARGS+= --enable-octave
.include "../../math/octave/buildlink3.mk"
.else
CONFIGURE_ARGS+= --disable-octave
.endif
.if !empty(PKG_OPTIONS:Moss)
.include "../../mk/oss.buildlink3.mk"
OSS_DEFS= -DDEV_DSP=\"${DEVOSSAUDIO:Q}\" -DUSE_OSS=1
MAKE_ENV+= AM_CFLAGS=${OSS_DEFS:Q}
.elif !empty(PKG_OPTIONS:Msun)
DEVSUNAUDIO?= /dev/audio
SUN_DEFS= -DUSE_SUN -DDEV_SUN=\"${DEVSUNAUDIO:Q}\"
MAKE_ENV+= AM_CFLAGS=${SUN_DEFS:Q}
.endif

View file

@ -0,0 +1,43 @@
$NetBSD: patch-programs_sndfile-play.c,v 1.3 2021/09/09 12:14:42 nia Exp $
Add support for NetBSD sun-like audio devices.
Do not change mixing parameters in the sun code.
--- programs/sndfile-play.c.orig 2020-10-04 10:00:49.000000000 +0000
+++ programs/sndfile-play.c
@@ -64,7 +64,7 @@
#elif HAVE_SNDIO_H
#include <sndio.h>
-#elif (defined (sun) && defined (unix))
+#elif (defined (sun) && defined (unix)) || defined(__NetBSD__)
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/audioio.h>
@@ -727,7 +727,7 @@ sndio_play (int argc, char *argv [])
** Solaris.
*/
-#if (defined (sun) && defined (unix)) /* ie Solaris */
+#if (defined (sun) && defined (unix)) || defined(__NetBSD__) /* ie Solaris */
static void
solaris_play (int argc, char *argv [])
@@ -764,8 +764,6 @@ solaris_play (int argc, char *argv [])
audio_info.play.channels = sfinfo.channels ;
audio_info.play.precision = 16 ;
audio_info.play.encoding = AUDIO_ENCODING_LINEAR ;
- audio_info.play.gain = AUDIO_MAX_GAIN ;
- audio_info.play.balance = AUDIO_MID_BALANCE ;
if ((error = ioctl (audio_fd, AUDIO_SETINFO, &audio_info)))
{ perror ("ioctl (AUDIO_SETINFO) failed") ;
@@ -845,7 +843,7 @@ main (int argc, char *argv [])
opensoundsys_play (argc, argv) ;
#elif HAVE_SNDIO_H
sndio_play (argc, argv) ;
-#elif (defined (sun) && defined (unix))
+#elif (defined (sun) && defined (unix)) || defined(__NetBSD__)
solaris_play (argc, argv) ;
#elif (OS_IS_WIN32 == 1)
win32_play (argc, argv) ;