diff --git a/audio/openal/Makefile b/audio/openal/Makefile index bf7bf9b4afd..7dc8a82c0e8 100644 --- a/audio/openal/Makefile +++ b/audio/openal/Makefile @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile,v 1.11 2009/10/14 14:27:34 naddy Exp $ +# $OpenBSD: Makefile,v 1.12 2009/12/16 20:00:41 naddy Exp $ COMMENT= cross-platform 3D audio API DISTNAME= openal-0.0.8 -PKGNAME= ${DISTNAME}p3 +PKGNAME= ${DISTNAME}p4 CATEGORIES= audio SHARED_LIBS += openal 1.0 # .0.0 @@ -21,11 +21,29 @@ MASTER_SITES= http://openbsd.dead-parrot.de/distfiles/ USE_GMAKE= Yes USE_LIBTOOL= Yes -CONFIGURE_STYLE=gnu +AUTOCONF_VERSION=2.59 +AUTOMAKE_VERSION=1.9 +CONFIGURE_STYLE=autoconf automake CONFIGURE_ARGS= --disable-vorbis \ --disable-arts \ --disable-mp3 \ --disable-esd \ --disable-sdl +MODGNU_CONFIG_GUESS_DIRS=${WRKSRC}/admin/autotools + +post-extract: + @cp ${FILESDIR}/alc_backend_sndio.c ${WRKSRC}/src/backends/ + +AUTO_ENV= AUTOCONF_VERSION=${AUTOCONF_VERSION} \ + AUTOMAKE_VERSION=${AUTOMAKE_VERSION} + +post-patch: + @echo "Running aclocal-${AUTOMAKE_VERSION} in ${WRKSRC}" + @cd ${WRKSRC}; ${AUTO_ENV} aclocal -I admin/autotools/m4 + +pre-configure: + @echo "Running automake-${AUTOMAKE_VERSION} in ${WRKSRC}" + @cd ${WRKSRC}; ${AUTO_ENV} automake --foreign + .include diff --git a/audio/openal/files/alc_backend_sndio.c b/audio/openal/files/alc_backend_sndio.c new file mode 100644 index 00000000000..de1b5d792dd --- /dev/null +++ b/audio/openal/files/alc_backend_sndio.c @@ -0,0 +1,127 @@ +/* -*- mode: C; tab-width:8; c-basic-offset:8 -*- + * vi:set ts=8: + * + * Sndio backend for OpenAL + * + */ +#include "al_siteconfig.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "al_main.h" +#include "al_debug.h" + +#include "backends/alc_backend.h" + +void * +alcBackendOpenNative_ (ALC_OpenMode mode) +{ + return mode == ALC_OPEN_INPUT_ ? + sio_open(NULL, SIO_REC, 0) : sio_open(NULL, SIO_PLAY, 0); +} + +ALboolean +alcBackendSetAttributesNative_ (ALC_OpenMode mode, void *handle, + ALuint *bufsiz, ALenum *fmt, ALuint *speed) +{ + struct sio_par par; + unsigned chan; + + sio_initpar(&par); + par.bits = _alGetBitsFromFormat(*fmt); + par.sig = par.bits == 8 ? 0 : 1; + par.le = SIO_LE_NATIVE; + chan = _alGetChannelsFromFormat(*fmt); + if (mode == ALC_OPEN_INPUT_) + par.rchan = chan; + else + par.pchan = chan; + par.rate = *speed; + + par.appbufsz = *bufsiz / SIO_BPS(par.bits) / chan; + + if (!sio_setpar(handle, &par) || !sio_getpar(handle, &par) || + !sio_start(handle)) { + sio_close(handle); + return AL_FALSE; + } + + if (!(par.bits == 16 && par.sig) && !(par.bits == 8 && !par.sig)) { + sio_close(handle); + return AL_FALSE; + } + chan = mode == ALC_OPEN_INPUT_ ? par.rchan : par.pchan; + switch (chan) { + case 1: + *fmt = par.bits == 16 ? AL_FORMAT_MONO16 : AL_FORMAT_MONO8; + break; + case 2: + *fmt = par.bits == 16 ? AL_FORMAT_STEREO16 : AL_FORMAT_STEREO8; + break; + case 4: + *fmt = par.bits == 16 ? AL_FORMAT_QUAD16_LOKI : + AL_FORMAT_QUAD8_LOKI; + break; + default: + sio_close(handle); + return AL_FALSE; + } + + *bufsiz = par.appbufsz * par.bps * chan; + *speed = par.rate; + + return AL_TRUE; +} + +void +native_blitbuffer (void *handle, void *dataptr, int bytes_to_write) +{ + sio_write(handle, dataptr, bytes_to_write); +} + +void +release_native (void *handle) +{ + sio_close(handle); +} + +void +pause_native (void *handle) +{ + sio_stop(handle); +} + +void +resume_native (void *handle) +{ + sio_start(handle); +} + +ALsizei +capture_native (void *handle, void *capture_buffer, int bufsiz) +{ + return sio_read(handle, capture_buffer, bufsiz); +} + +ALfloat +get_nativechannel (UNUSED(void *handle), UNUSED(ALuint channel)) +{ + return 0.0; +} + +int +set_nativechannel (UNUSED(void *handle), UNUSED(ALuint channel), + UNUSED(ALfloat volume)) +{ + return 0; +} diff --git a/audio/openal/patches/patch-admin_pkgconfig_openal-config_in b/audio/openal/patches/patch-admin_pkgconfig_openal-config_in index 108f97622b5..fe4f95eaf67 100644 --- a/audio/openal/patches/patch-admin_pkgconfig_openal-config_in +++ b/audio/openal/patches/patch-admin_pkgconfig_openal-config_in @@ -1,15 +1,15 @@ -$OpenBSD: patch-admin_pkgconfig_openal-config_in,v 1.1 2009/10/10 22:51:48 sthen Exp $ ---- admin/pkgconfig/openal-config.in.orig Fri Oct 9 22:54:00 2009 -+++ admin/pkgconfig/openal-config.in Fri Oct 9 22:54:16 2009 +$OpenBSD: patch-admin_pkgconfig_openal-config_in,v 1.2 2009/12/16 20:00:41 naddy Exp $ +--- admin/pkgconfig/openal-config.in.orig Sat Feb 11 10:36:55 2006 ++++ admin/pkgconfig/openal-config.in Thu Oct 15 15:11:54 2009 @@ -9,9 +9,9 @@ PACKAGE_VERSION="@PACKAGE_VERSION@" # PTHREAD_CFLAGS="@PTHREAD_CFLAGS@" # PTHREAD_LIBS="@PTHREAD_LIBS@" -openal_dynamic_ldflags="-lopenal" -+openal_dynamic_ldflags="-lopenal -lossaudio" ++openal_dynamic_ldflags="-lopenal -lsndio" # TODO: configure should provide the following... -openal_static_ldflags="-lopenal" -+openal_static_ldflags="-lopenal -lossaudio" ++openal_static_ldflags="-lopenal -lsndio" prefix_set=no echo_prefix=no diff --git a/audio/openal/patches/patch-admin_pkgconfig_openal_pc_in b/audio/openal/patches/patch-admin_pkgconfig_openal_pc_in index 80af924ef63..2c08e590fe6 100644 --- a/audio/openal/patches/patch-admin_pkgconfig_openal_pc_in +++ b/audio/openal/patches/patch-admin_pkgconfig_openal_pc_in @@ -1,6 +1,6 @@ -$OpenBSD: patch-admin_pkgconfig_openal_pc_in,v 1.2 2009/10/10 22:51:48 sthen Exp $ ---- admin/pkgconfig/openal.pc.in.orig Sat Feb 11 04:36:55 2006 -+++ admin/pkgconfig/openal.pc.in Fri Oct 9 20:29:07 2009 +$OpenBSD: patch-admin_pkgconfig_openal_pc_in,v 1.3 2009/12/16 20:00:41 naddy Exp $ +--- admin/pkgconfig/openal.pc.in.orig Sat Feb 11 10:36:55 2006 ++++ admin/pkgconfig/openal.pc.in Thu Oct 15 15:12:25 2009 @@ -5,8 +5,8 @@ includedir=@includedir@ Name: OpenAL @@ -9,6 +9,6 @@ $OpenBSD: patch-admin_pkgconfig_openal_pc_in,v 1.2 2009/10/10 22:51:48 sthen Exp +Requires: Version: @PACKAGE_VERSION@ -Libs: -L${libdir} -lopenal -+Libs: -L${libdir} -lopenal -lossaudio ++Libs: -L${libdir} -lopenal -lsndio Cflags: -I${includedir} diff --git a/audio/openal/patches/patch-configure b/audio/openal/patches/patch-configure deleted file mode 100644 index e3133195a83..00000000000 --- a/audio/openal/patches/patch-configure +++ /dev/null @@ -1,12 +0,0 @@ -$OpenBSD: patch-configure,v 1.1 2006/10/30 23:31:37 steven Exp $ ---- configure.orig Sat Oct 21 11:10:20 2006 -+++ configure Sat Oct 21 11:10:37 2006 -@@ -22428,7 +22428,7 @@ _ACEOF - esac - - case "$target" in -- *i386* | *i486* | *i586* | *i686* | *x86_64*) -+ *i386* | *i486* | *i586* | *i686* ) - openal_x86_support_yn=yes - - echo "$as_me:$LINENO: checking for MMX support" >&5 diff --git a/audio/openal/patches/patch-configure_ac b/audio/openal/patches/patch-configure_ac new file mode 100644 index 00000000000..1e85d77ac71 --- /dev/null +++ b/audio/openal/patches/patch-configure_ac @@ -0,0 +1,76 @@ +$OpenBSD: patch-configure_ac,v 1.1 2009/12/16 20:00:41 naddy Exp $ +--- configure.ac.orig Sat Feb 11 10:36:55 2006 ++++ configure.ac Thu Oct 15 15:00:10 2009 +@@ -365,7 +365,7 @@ esac + + dnl Special objs for architectures + case "$target" in +- *i386* | *i486* | *i586* | *i686* | *x86_64*) ++ *i386* | *i486* | *i586* | *i686* ) + openal_x86_support_yn=yes + + AC_MSG_CHECKING([for MMX support]) +@@ -637,7 +637,7 @@ OPENAL_ENABLE([aRts backend], [openal_backend_arts_sup + + # check for native BSD/OSS backend ############################################# + +-# ToDo: Hmmm, OpenBSD/FreeBSD are using OSS, too, just like Linux. Perhaps some ++# ToDo: Hmmm, FreeBSD is using OSS, too, just like Linux. Perhaps some + # re-use is possible? + + AC_ARG_ENABLE([bsd], +@@ -648,6 +648,10 @@ if test "x$enable_bsd" = xno; then + openal_backend_bsd_support=disabled + else + case "$target" in ++ *openbsd*) openal_backend_bsd_support=none ++ if test "x$enable_bsd" = xyes; then ++ AC_MSG_WARN([--enabled-bsd ignored in favor of sndio.]) ++ fi ;; + *bsd*) openal_backend_bsd_support=static ;; + *) openal_backend_bsd_support=none + if test "x$enable_bsd" = xyes; then +@@ -941,6 +945,43 @@ fi + + OPENAL_ENABLE([native Solaris backend], [openal_backend_solaris_support], + [USE_BACKEND_NATIVE_SOLARIS], [USEBACKENDNATIVESOLARIS]) ++ ++# check for native sndio backend ############################################### ++ ++AC_ARG_ENABLE([sndio], ++[AS_HELP_STRING([--enable-sndio], ++ [enable native sndio backend @<:@default=auto@:>@])]) ++ ++if test "x$enable_sndio" = xno; then ++ openal_backend_sndio_support=disabled ++else ++ AC_CHECK_HEADER([sndio.h], ++ [openal_libs_sndio="-lsndio" ++ openal_saved_LIBS=$LIBS ++ LIBS="$openal_libs_sndio $LIBS" ++ AC_CACHE_CHECK([for sio_open], [openal_cv_func_sio_open], ++ [AC_LINK_IFELSE([AC_LANG_CALL([], [sio_open])], ++ [openal_cv_func_sio_open=yes], ++ [openal_cv_func_sio_open=no])]) ++ if test "x$openal_cv_func_sio_open" = xyes; then ++ openal_backend_sndio_support=static ++ LIBS="$openal_libs_sndio $LIBS" ++ else ++ openal_backend_sndio_support=none ++ LIBS=$openal_saved_LIBS ++ if test "x$enable_sndio" = xyes; then ++ AC_MSG_WARN([--enable-sndio ignored because the sndio library could not be found.]) ++ fi ++ fi], ++ [openal_backend_sndio_support=none ++ if test "x$enable_sndio" = xyes; then ++ AC_MSG_WARN([--enable-sndio ignored because the sndio header could not be found.]) ++ fi], ++ [AC_INCLUDES_DEFAULT([])]) ++fi ++ ++OPENAL_ENABLE([native sndio backend], [openal_backend_sndio_support], ++ [USE_BACKEND_NATIVE_SNDIO], [USEBACKENDNATIVESNDIO]) + + # check for WAVE backend ####################################################### + diff --git a/audio/openal/patches/patch-src_Makefile_am b/audio/openal/patches/patch-src_Makefile_am new file mode 100644 index 00000000000..4a0ccf18548 --- /dev/null +++ b/audio/openal/patches/patch-src_Makefile_am @@ -0,0 +1,15 @@ +$OpenBSD: patch-src_Makefile_am,v 1.1 2009/12/16 20:00:41 naddy Exp $ +--- src/Makefile.am.orig Thu Jan 19 21:58:50 2006 ++++ src/Makefile.am Thu Oct 15 14:47:15 2009 +@@ -119,6 +119,11 @@ libopenal_la_SOURCES += \ + backends/alc_backend_solaris.c + endif + ++if USEBACKENDNATIVESNDIO ++libopenal_la_SOURCES += \ ++ backends/alc_backend_sndio.c ++endif ++ + if USEBACKENDWAVEOUT + libopenal_la_SOURCES += \ + backends/alc_backend_wave.c diff --git a/audio/openal/patches/patch-src_backends_alc_backend_bsd_c b/audio/openal/patches/patch-src_backends_alc_backend_bsd_c deleted file mode 100644 index e42f55850c7..00000000000 --- a/audio/openal/patches/patch-src_backends_alc_backend_bsd_c +++ /dev/null @@ -1,51 +0,0 @@ -$OpenBSD: patch-src_backends_alc_backend_bsd_c,v 1.1 2006/10/30 23:31:37 steven Exp $ ---- src/backends/alc_backend_bsd.c.orig Thu Jan 5 16:11:20 2006 -+++ src/backends/alc_backend_bsd.c Thu Oct 26 21:51:24 2006 -@@ -10,14 +10,16 @@ - #include "al_siteconfig.h" - - #include -+#include - #include - #include --#include -+#include - #include - #include - #include - #include - #include -+#include - #include - #include - #include -@@ -112,7 +114,7 @@ static int AL2BSDFMT(int fmt) - * - */ - static void *grab_write_native(void) { -- const char *dsppath = "/dev/dsp"; -+ const char *dsppath = "/dev/audio"; - int divisor = _alSpot(_AL_DEF_BUFSIZ) | (2<<16); - - dsp_fd = open(dsppath, O_WRONLY | O_NONBLOCK); -@@ -146,9 +148,11 @@ int grab_mixerfd(void) { - mixer_fd = open("/dev/mixer", O_WRONLY | O_NONBLOCK); - - if(mixer_fd > 0) { -+#if 0 - if(fcntl(mixer_fd, F_SETFL, ~O_NONBLOCK) == -1) { - perror("fcntl"); - } -+#endif - - return mixer_fd; - } else { -@@ -210,7 +214,7 @@ void release_native(void *handle) { - - handle_fd = *(int *) handle; - -- if(ioctl(handle_fd, SNDCTL_DSP_RESET) < 0) { -+ if(ioctl(handle_fd, SNDCTL_DSP_RESET, NULL) < 0) { - #ifdef DEBUG_MAXIMUS - fprintf(stderr, "Couldn't reset dsp\n"); - #endif