Add a 'sun' option and update patch-ac to support native audio output

on NetBSD, OpenBSD, and Solaris.  This option takes precedence (by default)
over OSS in the NetBSD/OpenBSD case.

Bump rev.
This commit is contained in:
bjs 2008-04-07 15:36:19 +00:00
parent c6570a224f
commit 2c542ea743
4 changed files with 53 additions and 15 deletions

View file

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.44 2008/01/07 17:34:37 drochner Exp $
# $NetBSD: Makefile,v 1.45 2008/04/07 15:36:19 bjs Exp $
DISTNAME= libsndfile-1.0.17
PKGREVISION= 2
PKGREVISION= 3
CATEGORIES= audio
MASTER_SITES= http://www.mega-nerd.com/libsndfile/
@ -27,9 +27,10 @@ CONFIGURE_ENV+= ac_cv_c_struct_hack=yes
# Avoid an ICE in gcc2 on sparc64
CONFIGURE_ENV+= F77=${FALSE:Q}
.include "options.mk"
.include "../../mk/bsd.prefs.mk"
.include "options.mk"
.if ${OPSYS} == "Darwin"
BUILDLINK_PASSTHRU_DIRS+= /Developer
.endif

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.23 2008/01/07 17:34:37 drochner Exp $
$NetBSD: distinfo,v 1.24 2008/04/07 15:36:19 bjs Exp $
SHA1 (libsndfile-1.0.17+flac-1.1.3.patch.bz2) = 10e0d19dfc8cf2a6bf499e0fa0d1ab17dca4c519
RMD160 (libsndfile-1.0.17+flac-1.1.3.patch.bz2) = fc6e6f03069c1ad8ee43f600f6ac2aa6e97bb1f5
@ -8,7 +8,7 @@ RMD160 (libsndfile-1.0.17.tar.gz) = ae93822a4c587dcdd7c70d043d2a38ed2fe3a188
Size (libsndfile-1.0.17.tar.gz) = 819456 bytes
SHA1 (patch-aa) = a3bb33cc28c10c9aa23a0b066339a512dbd7b0e2
SHA1 (patch-ab) = 007a93229bc8cbcb1b27e6223e8c10e8a2e3c6eb
SHA1 (patch-ac) = 7d49a0da2dfa9470d188873133526e8ad851c9a7
SHA1 (patch-ac) = ee4b99239e21fe1104bcec4b5579fe2b1039619c
SHA1 (patch-ad) = b730de6bb0716bece5f83c3100f9fc0f8eb2ae7d
SHA1 (patch-ae) = 628700514d3d2e6e12abb182c697311a233c1bd9
SHA1 (patch-af) = 9ac0dd446a2f24c2d39e20063489a3b778fcda36

View file

@ -1,7 +1,15 @@
# $NetBSD: options.mk,v 1.3 2006/03/09 21:04:40 jlam Exp $
# $NetBSD: options.mk,v 1.4 2008/04/07 15:36:19 bjs Exp $
PKG_OPTIONS_VAR= PKG_OPTIONS.libsndfile
PKG_SUPPORTED_OPTIONS= oss
PKG_OPTIONS_OPTIONAL_GROUPS= output
PKG_OPTIONS_GROUP.output= oss sun
SNDFILE_OUTPUT.${OPSYS}?= oss
SNDFILE_OUTPUT.NetBSD= sun
SNDFILE_OUTPUT.OpenBSD= sun
SNDFILE_OUTPUT.Solaris= sun
PKG_SUGGESTED_OPTIONS= ${SNDFILE_OUTPUT.${OPSYS}}
.include "../../mk/bsd.options.mk"
@ -9,4 +17,8 @@ PKG_SUPPORTED_OPTIONS= oss
.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

@ -1,6 +1,6 @@
$NetBSD: patch-ac,v 1.8 2006/09/01 06:02:23 adam Exp $
$NetBSD: patch-ac,v 1.9 2008/04/07 15:36:19 bjs Exp $
--- examples/sndfile-play.c.orig 2006-08-31 11:22:07.000000000 +0200
--- examples/sndfile-play.c.orig 2006-08-31 05:22:07.000000000 -0400
+++ examples/sndfile-play.c
@@ -34,16 +34,21 @@
#include <sys/time.h>
@ -22,7 +22,7 @@ $NetBSD: patch-ac,v 1.8 2006/09/01 06:02:23 adam Exp $
-#elif (defined (sun) && defined (unix))
+#elif (defined (sun) && defined (unix)) || \
+ (defined (__NetBSD__) && !defined(USE_OSS))
+ defined (USE_SUN)
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/audioio.h>
@ -44,17 +44,42 @@ $NetBSD: patch-ac,v 1.8 2006/09/01 06:02:23 adam Exp $
(fd = open ("/dev/sound/dsp", O_WRONLY, 0)) == -1)
{ perror ("linux_open_dsp_device : open ") ;
exit (1) ;
@@ -819,7 +824,8 @@ win32_play (int argc, char *argv [])
@@ -819,7 +824,12 @@ win32_play (int argc, char *argv [])
** Solaris.
*/
-#if (defined (sun) && defined (unix)) /* ie Solaris */
+#if (defined (sun) && defined (unix)) || \
+ (defined (__NetBSD__) && !defined(USE_OSS))
+ defined (USE_SUN)
+
+#ifndef SUN_DEV
+#define SUN_DEV "/dev/audio"
+#endif
static void
solaris_play (int argc, char *argv [])
@@ -926,7 +932,7 @@ main (int argc, char *argv [])
@@ -844,8 +854,8 @@ solaris_play (int argc, char *argv [])
} ;
/* open the audio device - write only, non-blocking */
- if ((audio_fd = open ("/dev/audio", O_WRONLY | O_NONBLOCK)) < 0)
- { perror ("open (/dev/audio) failed") ;
+ if ((audio_fd = open (SUN_DEV, O_WRONLY | O_NONBLOCK)) < 0)
+ { perror ("open ("SUN_DEV") failed") ;
return ;
} ;
@@ -858,6 +868,9 @@ solaris_play (int argc, char *argv [])
audio_info.play.encoding = AUDIO_ENCODING_LINEAR ;
audio_info.play.gain = AUDIO_MAX_GAIN ;
audio_info.play.balance = AUDIO_MID_BALANCE ;
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+ audio_info.mode = AUMODE_PLAY | AUMODE_PLAY_ALL;
+#endif
if ((error = ioctl (audio_fd, AUDIO_SETINFO, &audio_info)))
{ perror ("ioctl (AUDIO_SETINFO) failed") ;
@@ -926,7 +939,7 @@ main (int argc, char *argv [])
return 1 ;
} ;
@ -63,13 +88,13 @@ $NetBSD: patch-ac,v 1.8 2006/09/01 06:02:23 adam Exp $
#if HAVE_ALSA_ASOUNDLIB_H
if (access ("/proc/asound/cards", R_OK) == 0)
alsa_play (argc, argv) ;
@@ -935,7 +941,8 @@ main (int argc, char *argv [])
@@ -935,7 +948,8 @@ main (int argc, char *argv [])
linux_play (argc, argv) ;
#elif (defined (__MACH__) && defined (__APPLE__))
macosx_play (argc, argv) ;
-#elif (defined (sun) && defined (unix))
+#elif (defined (sun) && defined (unix)) || \
+ (defined (__NetBSD__) && !defined(USE_OSS))
+ defined (USE_SUN)
solaris_play (argc, argv) ;
#elif (OS_IS_WIN32 == 1)
win32_play (argc, argv) ;