lightly tested with canberra-gtk-play.  my preferred wm
doesn't do "event sounds".

<rant>
it took at least as long to work out the autohell crap as it
did to do the rest, including testing.  an explicit
--disable-gtk-doc in CONFIGURE_ARGS would have saved me quite
some time.
</rant>

-- 
jake...@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org

Index: Makefile
===================================================================
RCS file: /home2/cvs/OpenBSD/ports/audio/libcanberra/Makefile,v
retrieving revision 1.4
diff -u -r1.4 Makefile
--- Makefile    14 Dec 2008 15:10:15 -0000      1.4
+++ Makefile    27 Dec 2008 03:03:21 -0000
@@ -3,7 +3,7 @@
 COMMENT=               implementation of the Freedesktop sound theme spec.
 
 DISTNAME=              libcanberra-0.10
-PKGNAME=               ${DISTNAME}p1
+PKGNAME=               ${DISTNAME}p2
 SHARED_LIBS +=  canberra             0.1      # .1.3
 SHARED_LIBS +=  canberra-gtk         0.0      # .0.4
 CATEGORIES=            audio devel
@@ -22,11 +22,15 @@
                Xi Xinerama Xrandr Xrender atk-1.0 c cairo expat fontconfig \
                freetype gio-2.0 glib-2.0 glitz gmodule-2.0 gobject-2.0 \
                gthread-2.0 m ogg pango-1.0 pangocairo-1.0 pangoft2-1.0 \
-               pcre pixman-1 png pthread xml2 z
+               pcre pixman-1 png pthread sndio xml2 z
 
 MODULES=               devel/gettext
 
-BUILD_DEPENDS=         ${RUN_DEPENDS}
+AUTOCONF_VERSION=      2.62
+AUTOMAKE_VERSION=      1.9
+BUILD_DEPENDS=         ${RUN_DEPENDS} \
+                       ${MODGNU_AUTOCONF_DEPENDS} \
+                       ${MODGNU_AUTOMAKE_DEPENDS}
 RUN_DEPENDS=           ::devel/gconf2
 LIB_DEPENDS=           vorbis,vorbisfile::audio/libvorbis \
                        ltdl::devel/libtool,-ltdl \
@@ -41,12 +45,24 @@
 CONFIGURE_ARGS+=       
--with-gconf-schema-file-dir=${LOCALBASE}/share/schemas/libcanberra \
                        --disable-schemas-install \
                        --localstatedir="/var" \
+                       --enable-sndio \
                        --enable-gstreamer \
-                       --enable-oss \
+                       --disable-oss \
                        --disable-alsa \
                        --disable-pulse \
                        --disable-tdb
 CONFIGURE_ENV+=         LDFLAGS="-L${LOCALBASE}/lib" \
                         CPPFLAGS="-I${LOCALBASE}/include"
+
+post-patch:
+       cp ${FILESDIR}/sndio.c ${WRKSRC}/src
+       cd ${WRKSRC} && env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+               AUTOMAKE_VERSION=${AUTOMAKE_VERSION} aclocal -I m4
+       cd ${WRKSRC} && env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+               AUTOMAKE_VERSION=${AUTOMAKE_VERSION} autoconf
+       cd ${WRKSRC} && env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+               AUTOMAKE_VERSION=${AUTOMAKE_VERSION} autoheader
+       cd ${WRKSRC} && env AUTOCONF_VERSION=${AUTOCONF_VERSION} \
+               AUTOMAKE_VERSION=${AUTOMAKE_VERSION} automake
 
 .include <bsd.port.mk>
Index: files/sndio.c
===================================================================
RCS file: files/sndio.c
diff -N files/sndio.c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ files/sndio.c       27 Dec 2008 03:03:21 -0000
@@ -0,0 +1,460 @@
+/*
+ * Copyright (c) 2008 Jacob Meuser <jake...@sdf.lonestar.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <sndio.h>
+#include <math.h>
+#include <unistd.h>
+
+#include <stdlib.h>
+#include <poll.h>
+#include <pthread.h>
+#include <semaphore.h>
+
+#include "canberra.h"
+#include "common.h"
+#include "driver.h"
+#include "llist.h"
+#include "read-sound-file.h"
+#include "sound-theme-spec.h"
+#include "malloc.h"
+
+#define BUFSIZE (4*1024)
+
+struct private;
+
+struct outstanding {
+    CA_LLIST_FIELDS(struct outstanding);
+    ca_bool_t dead;
+    uint32_t id;
+    ca_finish_callback_t callback;
+    void *userdata;
+    ca_sound_file *file;
+    struct sio_hdl *hdl;
+    struct sio_par par;
+    int pipe_fd[2];
+    ca_context *context;
+};
+
+struct private {
+    ca_theme_data *theme;
+    ca_mutex *outstanding_mutex;
+    ca_bool_t signal_semaphore;
+    sem_t semaphore;
+    ca_bool_t semaphore_allocated;
+    CA_LLIST_HEAD(struct outstanding, outstanding);
+};
+
+#define PRIVATE(c) ((struct private *) ((c)->private))
+
+static void outstanding_free(struct outstanding *o) {
+    ca_assert(o);
+
+    if (o->pipe_fd[1] >= 0)
+        close(o->pipe_fd[1]);
+
+    if (o->pipe_fd[0] >= 0)
+        close(o->pipe_fd[0]);
+
+    if (o->file)
+        ca_sound_file_close(o->file);
+
+    if (o->hdl != NULL) {
+        sio_close(o->hdl);
+        o->hdl = NULL;
+    }
+
+    ca_free(o);
+}
+
+int driver_open(ca_context *c) {
+    struct private *p;
+
+    ca_return_val_if_fail(c, CA_ERROR_INVALID);
+    ca_return_val_if_fail(!c->driver || ca_streq(c->driver, "sndio"),
+      CA_ERROR_NODRIVER);
+    ca_return_val_if_fail(!PRIVATE(c), CA_ERROR_STATE);
+
+    if (!(c->private = p = ca_new0(struct private, 1)))
+        return CA_ERROR_OOM;
+
+    if (!(p->outstanding_mutex = ca_mutex_new())) {
+        driver_destroy(c);
+        return CA_ERROR_OOM;
+    }
+
+    if (sem_init(&p->semaphore, 0, 0) < 0) {
+        driver_destroy(c);
+        return CA_ERROR_OOM;
+    }
+
+    p->semaphore_allocated = TRUE;
+
+    return CA_SUCCESS;
+}
+
+int driver_destroy(ca_context *c) {
+    struct private *p;
+    struct outstanding *out;
+
+    ca_return_val_if_fail(c, CA_ERROR_INVALID);
+    ca_return_val_if_fail(c->private, CA_ERROR_STATE);
+
+    p = PRIVATE(c);
+
+    if (p->outstanding_mutex) {
+        ca_mutex_lock(p->outstanding_mutex);
+
+        /* Tell all player threads to terminate */
+        for (out = p->outstanding; out; out = out->next) {
+
+            if (out->dead)
+                continue;
+
+            out->dead = TRUE;
+
+            if (out->callback)
+                out->callback(c, out->id, CA_ERROR_DESTROYED, out->userdata);
+
+            /* This will cause the thread to wakeup and terminate */
+            if (out->pipe_fd[1] >= 0) {
+                close(out->pipe_fd[1]);
+                out->pipe_fd[1] = -1;
+            }
+        }
+
+        if (p->semaphore_allocated) {
+            /* Now wait until all players are destroyed */
+            p->signal_semaphore = TRUE;
+            while (p->outstanding) {
+                ca_mutex_unlock(p->outstanding_mutex);
+                sem_wait(&p->semaphore);
+                ca_mutex_lock(p->outstanding_mutex);
+            }
+        }
+
+        ca_mutex_unlock(p->outstanding_mutex);
+        ca_mutex_free(p->outstanding_mutex);
+    }
+
+    if (p->theme)
+        ca_theme_data_free(p->theme);
+
+    if (p->semaphore_allocated)
+        sem_destroy(&p->semaphore);
+
+    ca_free(p);
+
+    c->private = NULL;
+
+    return CA_SUCCESS;
+}
+
+int driver_change_device(ca_context *c, char *device) {
+    ca_return_val_if_fail(c, CA_ERROR_INVALID);
+    ca_return_val_if_fail(c->private, CA_ERROR_STATE);
+
+    return CA_SUCCESS;
+}
+
+int driver_change_props(ca_context *c, ca_proplist *changed,
+  ca_proplist *merged) {
+    ca_return_val_if_fail(c, CA_ERROR_INVALID);
+    ca_return_val_if_fail(changed, CA_ERROR_INVALID);
+    ca_return_val_if_fail(merged, CA_ERROR_INVALID);
+
+    return CA_SUCCESS;
+}
+
+int driver_cache(ca_context *c, ca_proplist *proplist) {
+    ca_return_val_if_fail(c, CA_ERROR_INVALID);
+    ca_return_val_if_fail(proplist, CA_ERROR_INVALID);
+    return CA_ERROR_NOTSUPPORTED;
+}
+
+static int open_sndio(ca_context *c, struct outstanding *out) {
+    struct private *p;
+    struct sio_par testpar;
+    int ret;
+
+    ca_return_val_if_fail(c, CA_ERROR_INVALID);
+    ca_return_val_if_fail(c->private, CA_ERROR_STATE);
+    ca_return_val_if_fail(out, CA_ERROR_INVALID);
+
+    p = PRIVATE(c);
+
+    if ((out->hdl = sio_open(c->device, SIO_PLAY, 0)) == NULL)
+        return CA_ERROR_NOTAVAILABLE;
+
+    sio_initpar(&out->par);
+
+    switch (ca_sound_file_get_sample_type(out->file)) {
+        case CA_SAMPLE_U8:
+            out->par.sig = 0;
+            out->par.bits = 8;
+            break;
+        case CA_SAMPLE_S16NE:
+            out->par.sig = 1;
+            out->par.bits = 16;
+            out->par.le = SIO_LE_NATIVE;
+            break;
+        case CA_SAMPLE_S16RE:
+            out->par.sig = 1;
+            out->par.bits = 16;
+            out->par.le = !SIO_LE_NATIVE;
+            break;
+    }
+    out->par.pchan = ca_sound_file_get_nchannels(out->file);
+    out->par.rate = ca_sound_file_get_rate(out->file);
+
+    out->par.appbufsz = BUFSIZE / ((out->par.bits / NBBY) * out->par.pchan);
+
+    testpar = out->par;
+
+    if (!sio_setpar(out->hdl, &out->par)) {
+        ret = CA_ERROR_NOTSUPPORTED;
+        goto finish_error;
+    }
+
+    if (!sio_getpar(out->hdl, &out->par)) {
+        ret = CA_ERROR_NOTSUPPORTED;
+        goto finish_error;
+    }
+
+    if (testpar.bits != out->par.bits ||
+      testpar.sig != out->par.sig ||
+      testpar.le != out->par.le ||
+      testpar.pchan != out->par.pchan) {
+        ret = CA_ERROR_NOTSUPPORTED;
+        goto finish_error;
+    }
+
+    /* Check to make sure the configured rate is close enough to the
+     * requested rate. */
+    if (fabs((double) (out->par.rate - testpar.rate)) > testpar.rate * 0.05) {
+        ret = CA_ERROR_NOTSUPPORTED;
+        goto finish_error;
+    }
+
+    if (!sio_start(out->hdl)) {
+        ret = CA_ERROR_NOTAVAILABLE;
+        goto finish_error;
+    }
+
+    return CA_SUCCESS;
+
+finish_error:
+    if (out->hdl != NULL) {
+        sio_close(out->hdl);
+        out->hdl = NULL;
+    }
+    return ret;
+}
+
+static void* thread_func(void *userdata) {
+    struct outstanding *out = userdata;
+    int ret;
+    void *data, *d = NULL;
+    size_t fs, data_size;
+    size_t nbytes = 0;
+    struct pollfd pfd[1];
+    struct private *p;
+
+    p = PRIVATE(out->context);
+
+    pthread_detach(pthread_self());
+
+    fs = ca_sound_file_frame_size(out->file);
+    data_size = (BUFSIZE/fs)*fs;
+
+    if (!(data = ca_malloc(data_size))) {
+        ret = CA_ERROR_OOM;
+        goto finish;
+    }
+
+    pfd[0].fd = out->pipe_fd[0];
+    pfd[0].events = POLLIN;
+    pfd[0].revents = 0;
+
+    for (;;) {
+        ssize_t bytes_written;
+
+        if (out->dead)
+            break;
+
+        if (poll(pfd, 1, 0) < 0) {
+            ret = CA_ERROR_SYSTEM;
+            goto finish;
+        }
+
+        /* We have been asked to shut down */
+        if (pfd[0].revents)
+            break;
+
+        if (nbytes <= 0) {
+            nbytes = data_size;
+
+            if ((ret = ca_sound_file_read_arbitrary(out->file, data, &nbytes))
+              < 0) {
+                goto finish;
+            }
+
+            d = data;
+        }
+
+        if (nbytes <= 0)
+            break;
+
+        if ((bytes_written = sio_write(out->hdl, d, nbytes)) <= 0) {
+            ret = CA_ERROR_INVALID;
+            goto finish;
+        }
+
+        nbytes -= (size_t) bytes_written;
+        d = (uint8_t*) d + (size_t) bytes_written;
+    }
+
+    ret = CA_SUCCESS;
+
+finish:
+
+    ca_free(data);
+
+    if (!out->dead)
+        if (out->callback)
+            out->callback(out->context, out->id, ret, out->userdata);
+
+    ca_mutex_lock(p->outstanding_mutex);
+
+    CA_LLIST_REMOVE(struct outstanding, p->outstanding, out);
+
+    if (!p->outstanding && p->signal_semaphore)
+        sem_post(&p->semaphore);
+
+    if (out->hdl != NULL) {
+        sio_close(out->hdl);
+        out->hdl = NULL;
+    }
+
+    outstanding_free(out);
+
+    ca_mutex_unlock(p->outstanding_mutex);
+
+    return NULL;
+}
+
+int driver_play(ca_context *c, uint32_t id, ca_proplist *proplist,
+  ca_finish_callback_t cb, void *userdata) {
+    struct private *p;
+    struct outstanding *out = NULL;
+    int ret;
+    pthread_t thread;
+
+    ca_return_val_if_fail(c, CA_ERROR_INVALID);
+    ca_return_val_if_fail(proplist, CA_ERROR_INVALID);
+    ca_return_val_if_fail(!userdata || cb, CA_ERROR_INVALID);
+    ca_return_val_if_fail(c->private, CA_ERROR_STATE);
+
+    p = PRIVATE(c);
+
+    if (!(out = ca_new0(struct outstanding, 1))) {
+        ret = CA_ERROR_OOM;
+        goto finish;
+    }
+
+    out->context = c;
+    out->id = id;
+    out->callback = cb;
+    out->userdata = userdata;
+    out->pipe_fd[0] = out->pipe_fd[1] = -1;
+
+    if (pipe(out->pipe_fd) < 0) {
+        ret = CA_ERROR_SYSTEM;
+        goto finish;
+    }
+
+    if ((ret = ca_lookup_sound(&out->file, NULL, &p->theme, c->props,
+      proplist)) < 0)
+        goto finish;
+
+    if ((ret = open_sndio(c, out)) < 0)
+        goto finish;
+
+    /* OK, we're ready to go, so let's add this to our list */
+    ca_mutex_lock(p->outstanding_mutex);
+    CA_LLIST_PREPEND(struct outstanding, p->outstanding, out);
+    ca_mutex_unlock(p->outstanding_mutex);
+
+    if (pthread_create(&thread, NULL, thread_func, out) < 0) {
+        ret = CA_ERROR_OOM;
+
+        ca_mutex_lock(p->outstanding_mutex);
+        CA_LLIST_REMOVE(struct outstanding, p->outstanding, out);
+        ca_mutex_unlock(p->outstanding_mutex);
+
+        goto finish;
+    }
+
+    ret = CA_SUCCESS;
+
+finish:
+
+    /* We keep the outstanding struct around if we need clean up later to */
+    if (ret != CA_SUCCESS)
+        outstanding_free(out);
+
+    return ret;
+}
+
+int driver_cancel(ca_context *c, uint32_t id) {
+    struct private *p;
+    struct outstanding *out;
+
+    ca_return_val_if_fail(c, CA_ERROR_INVALID);
+    ca_return_val_if_fail(c->private, CA_ERROR_STATE);
+
+    p = PRIVATE(c);
+
+    ca_mutex_lock(p->outstanding_mutex);
+
+    for (out = p->outstanding; out; out = out->next) {
+
+        if (out->id != id)
+            continue;
+
+        if (out->dead)
+            continue;
+
+        out->dead = TRUE;
+
+        if (out->callback)
+            out->callback(c, out->id, CA_ERROR_CANCELED, out->userdata);
+
+        /* This will cause the thread to wakeup and terminate */
+        if (out->pipe_fd[1] >= 0) {
+            close(out->pipe_fd[1]);
+            out->pipe_fd[1] = -1;
+        }
+    }
+
+    ca_mutex_unlock(p->outstanding_mutex);
+
+    return CA_SUCCESS;
+}
Index: patches/patch-Makefile_am
===================================================================
RCS file: patches/patch-Makefile_am
diff -N patches/patch-Makefile_am
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-Makefile_am   27 Dec 2008 03:03:21 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- Makefile.am.orig   Fri Dec 26 16:32:45 2008
++++ Makefile.am        Fri Dec 26 16:32:45 2008
+@@ -19,7 +19,7 @@
+ dist_doc_DATA = README
+ 
+ EXTRA_DIST = bootstrap.sh autogen.sh LGPL libcanberra.schemas
+-SUBDIRS = src gtkdoc libltdl doc
++SUBDIRS = src gtkdoc doc
+ 
+ MAINTAINERCLEANFILES = README
+ noinst_DATA = README
Index: patches/patch-Makefile_in
===================================================================
RCS file: patches/patch-Makefile_in
diff -N patches/patch-Makefile_in
--- patches/patch-Makefile_in   24 Oct 2008 13:26:14 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-$OpenBSD: patch-Makefile_in,v 1.2 2008/10/24 13:26:14 jasper Exp $
-
-Don't build internal libltdl.
-
---- Makefile.in.orig   Mon Oct 20 13:28:49 2008
-+++ Makefile.in        Mon Oct 20 13:29:04 2008
-@@ -271,7 +271,7 @@ top_builddir = @top_builddir@
- top_srcdir = @top_srcdir@
- dist_doc_DATA = README
- EXTRA_DIST = bootstrap.sh autogen.sh LGPL libcanberra.schemas
--SUBDIRS = src gtkdoc libltdl doc
-+SUBDIRS = src gtkdoc doc
- MAINTAINERCLEANFILES = README
- noinst_DATA = README
- pkgconfigdir = $(libdir)/pkgconfig
Index: patches/patch-configure
===================================================================
RCS file: patches/patch-configure
diff -N patches/patch-configure
--- patches/patch-configure     24 Oct 2008 13:26:14 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,30 +0,0 @@
-$OpenBSD: patch-configure,v 1.2 2008/10/24 13:26:14 jasper Exp $
-
-Don't build internal libltdl.
-
---- configure.orig     Mon Oct 20 13:27:59 2008
-+++ configure  Mon Oct 20 13:28:34 2008
-@@ -878,7 +878,6 @@ USE_VERSION_SCRIPT_FALSE
- USE_VERSION_SCRIPT_TRUE
- OS_IS_WIN32_FALSE
- OS_IS_WIN32_TRUE
--subdirs
- LIBLTDL
- LTDLINCL
- LIBTOOL
-@@ -1054,7 +1053,6 @@ TDB_CFLAGS
- TDB_LIBS
- VORBIS_CFLAGS
- VORBIS_LIBS'
--ac_subdirs_all='libltdl'
- 
- # Initialize some variables set by options.
- ac_init_help=
-@@ -21171,7 +21169,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtool'
- 
- 
- 
--subdirs="$subdirs libltdl"
- 
- 
- #### Determine build environment ####
Index: patches/patch-configure_ac
===================================================================
RCS file: patches/patch-configure_ac
diff -N patches/patch-configure_ac
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-configure_ac  27 Dec 2008 03:03:21 -0000
@@ -0,0 +1,171 @@
+$OpenBSD$
+--- configure.ac.orig  Fri Dec 26 14:54:31 2008
++++ configure.ac       Fri Dec 26 15:05:18 2008
+@@ -70,7 +70,7 @@ AC_LIBTOOL_WIN32_DLL
+ AC_PROG_LIBTOOL
+ AC_SUBST(LTDLINCL)
+ AC_SUBST(LIBLTDL)
+-AC_CONFIG_SUBDIRS(libltdl)
++dnl AC_CONFIG_SUBDIRS(libltdl)
+ 
+ #### Determine build environment ####
+ 
+@@ -233,6 +233,36 @@ else
+     HAVE_OSS=0
+ fi
+ 
++### SNDIO support (optional) ###
++
++AC_ARG_ENABLE([sndio],
++    AC_HELP_STRING([--disable-sndio], [Disable optional sndio support]),
++        [
++            case "${enableval}" in
++                yes) sndio=yes ;;
++                no) sndio=no ;;
++                *) AC_MSG_ERROR(bad value ${enableval} for --disable-sndio) ;;
++            esac
++        ],
++        [sndio=auto])
++
++if test "x${sndio}" != xno ; then
++    AC_CHECK_HEADERS(sndio.h)
++    if test "${ac_cv_header_sndio_h}" = "yes"; then
++      HAVE_SNDIO=1
++        AC_DEFINE([HAVE_SNDIO], 1, [Have sndio?])
++        SNDIO_LIBS='-lsndio'
++    else
++      HAVE_SNDIO=0
++        if test "x$sndio" = xyes ; then
++            AC_MSG_ERROR([*** sndio not found ***])
++        fi
++    fi
++else
++    HAVE_SNDIO=0
++fi
++AC_SUBST(SNDIO_LIBS)
++
+ ### PulseAudio (optional) ####
+ 
+ AC_ARG_ENABLE([pulse],
+@@ -454,6 +484,7 @@ BUILTIN_DSO=0
+ BUILTIN_PULSE=0
+ BUILTIN_ALSA=0
+ BUILTIN_OSS=0
++BUILTIN_SNDIO=0
+ BUILTIN_GSTREAMER=0
+ BUILTIN_NULL=0
+ 
+@@ -466,6 +497,7 @@ case "x$with_builtin" in
+         BUILTIN_PULSE=1
+         HAVE_ALSA=0
+       HAVE_OSS=0
++      HAVE_SNDIO=0
+       HAVE_GSTREAMER=0
+         HAVE_NULL=0
+      ;;
+@@ -477,6 +509,7 @@ case "x$with_builtin" in
+ 
+         BUILTIN_ALSA=1
+       HAVE_OSS=0
++      HAVE_SNDIO=0
+         HAVE_PULSE=0
+       HAVE_GSTREAMER=0
+         HAVE_NULL=0
+@@ -490,6 +523,7 @@ case "x$with_builtin" in
+         BUILTIN_GSTREAMER=1
+         HAVE_ALSA=0
+       HAVE_OSS=0
++      HAVE_SNDIO=0
+         HAVE_PULSE=0
+         HAVE_NULL=0
+      ;;
+@@ -506,6 +540,19 @@ case "x$with_builtin" in
+       HAVE_NULL=0
+      ;;
+ 
++     xsndio)
++        if test "x$HAV_SNDIO" != x1 ; then
++              AC_MSG_ERROR([*** sndio selected for builtin driver, but not 
enabled. ***])
++      fi
++
++      BUILTIN_SNDIO=1
++      HAVE_ALSA=0
++      HAVE_OSS=0
++      HAVE_PULSE=0
++      HAVE_GSTREAMER=0
++      HAVE_NULL=0
++     ;;
++
+      xnull)
+         if test "x$HAVE_NULL" != x1 ; then
+                 AC_MSG_ERROR([*** Null output selected for builtin driver, 
but not enabled. ***])
+@@ -515,6 +562,7 @@ case "x$with_builtin" in
+         HAVE_PULSE=0
+         HAVE_ALSA=0
+       HAVE_OSS=0
++      HAVE_SNDIO=0
+       HAVE_GSTREAMER=0
+      ;;
+ 
+@@ -528,7 +576,7 @@ case "x$with_builtin" in
+         AC_MSG_ERROR([*** Unknown driver $with_builtin selected for builtin 
***])
+ esac
+ 
+-if test "x$HAVE_PULSE" != x1 -a "x$HAVE_ALSA" != x1 -a "x$HAVE_OSS" != x1 -a 
"x$HAVE_GSTREAMER" != x1 -a "x$HAVE_NULL" != x1 ; then
++if test "x$HAVE_PULSE" != x1 -a "x$HAVE_ALSA" != x1 -a "x$HAVE_OSS" != x1 -a 
"x$HAVE_SNDIO" != x1 -a "x$HAVE_GSTREAMER" != x1 -a "x$HAVE_NULL" != x1 ; then
+    AC_MSG_ERROR([*** No backend enabled. ***])
+ fi
+ 
+@@ -536,23 +584,27 @@ AC_SUBST(HAVE_DSO)
+ AC_SUBST(HAVE_PULSE)
+ AC_SUBST(HAVE_ALSA)
+ AC_SUBST(HAVE_OSS)
++AC_SUBST(HAVE_SNDIO)
+ AC_SUBST(HAVE_GSTREAMER)
+ AC_SUBST(HAVE_NULL)
+ AC_SUBST(BUILTIN_DSO)
+ AC_SUBST(BUILTIN_PULSE)
+ AC_SUBST(BUILTIN_ALSA)
+ AC_SUBST(BUILTIN_OSS)
++AC_SUBST(BUILTIN_SNDIO)
+ AC_SUBST(BUILTIN_GSTREAMER)
+ AC_SUBST(BUILTIN_NULL)
+ AM_CONDITIONAL([HAVE_PULSE], [test "x$HAVE_PULSE" = x1])
+ AM_CONDITIONAL([HAVE_ALSA], [test "x$HAVE_ALSA" = x1])
+ AM_CONDITIONAL([HAVE_OSS], [test "x$HAVE_OSS" = x1])
++AM_CONDITIONAL([HAVE_SNDIO], [test "x$HAVE_SNDIO" = x1])
+ AM_CONDITIONAL([HAVE_GSTREAMER], [test "x$HAVE_GSTREAMER" = x1])
+ AM_CONDITIONAL([HAVE_NULL], [test "x$HAVE_NULL" = x1])
+ AM_CONDITIONAL([BUILTIN_DSO], [test "x$BUILTIN_DSO" = x1])
+ AM_CONDITIONAL([BUILTIN_PULSE], [test "x$BUILTIN_PULSE" = x1])
+ AM_CONDITIONAL([BUILTIN_ALSA], [test "x$BUILTIN_ALSA" = x1])
+ AM_CONDITIONAL([BUILTIN_OSS], [test "x$BUILTIN_OSS" = x1])
++AM_CONDITIONAL([BUILTIN_SNDIO], [test "x$BUILTIN_SNDIO" = x1])
+ AM_CONDITIONAL([BUILTIN_GSTREAMER], [test "x$BUILTIN_GSTREAMER" = x1])
+ AM_CONDITIONAL([BUILTIN_NULL], [test "x$BUILTIN_NULL" = x1])
+ 
+@@ -606,6 +658,15 @@ if test "x$BUILTIN_OSS" = "x1" ; then
+     ENABLE_BUILTIN_OSS=yes
+ fi
+ 
++ENABLE_SNDIO=no
++if test "x$HAVE_SNDIO" = "x1" ; then
++    ENABLE_SNDIO=yes
++fi
++ENABLE_BUILTIN_SNDIO=no
++if test "x$BUILTIN_SNDIO" = "x1" ; then
++    ENABLE_BUILTIN_SNDIO=yes
++fi
++
+ ENABLE_GSTREAMER=no
+ if test "x$HAVE_GSTREAMER" = "x1" ; then
+    ENABLE_GSTREAMER=yes
+@@ -656,6 +717,8 @@ echo "
+     Builtin ALSA:           ${ENABLE_BUILTIN_ALSA}
+     Enable OSS:             ${ENABLE_OSS}
+     Builtin OSS:            ${ENABLE_BUILTIN_OSS}
++    Enable SNDIO:           ${ENABLE_SNDIO}
++    Builtin SNDIO:          ${ENABLE_BUILTIN_SNDIO}
+     Enable GStreamer:       ${ENABLE_GSTREAMER}
+     Builtin GStreamer:      ${ENABLE_BUILTIN_GSTREAMER}
+     Enable Null Output:     ${ENABLE_NULL}
Index: patches/patch-gtk-doc_make
===================================================================
RCS file: patches/patch-gtk-doc_make
diff -N patches/patch-gtk-doc_make
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-gtk-doc_make  27 Dec 2008 03:03:21 -0000
@@ -0,0 +1,57 @@
+$OpenBSD$
+--- gtk-doc.make.orig  Wed Aug 13 10:54:07 2008
++++ gtk-doc.make       Fri Dec 26 16:30:26 2008
+@@ -4,13 +4,13 @@
+ # Everything below here is generic #
+ ####################################
+ 
+-if GTK_DOC_USE_LIBTOOL
+-GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(INCLUDES) $(AM_CPPFLAGS) 
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
++#if GTK_DOC_USE_LIBTOOL
++GTKDOC_CC = $(LIBTOOL) --mode=compile $(CC) $(AM_CPPFLAGS) $(CPPFLAGS) 
$(AM_CFLAGS) $(CFLAGS)
+ GTKDOC_LD = $(LIBTOOL) --mode=link $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) 
$(LDFLAGS)
+-else
+-GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) 
$(CFLAGS)
+-GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
+-endif
++#else
++#GTKDOC_CC = $(CC) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) 
$(CFLAGS)
++#GTKDOC_LD = $(CC) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS)
++#endif
+ 
+ # We set GPATH here; this gives us semantics for GNU make
+ # which are more like other make's VPATH, when it comes to
+@@ -45,11 +45,11 @@ REPORT_FILES = \
+ 
+ CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS)
+ 
+-if ENABLE_GTK_DOC
+-all-local: html-build.stamp
+-else
++#if ENABLE_GTK_DOC
++#all-local: html-build.stamp
++#else
+ all-local:
+-endif
++#endif
+ 
+ docs: html-build.stamp
+ 
+@@ -134,13 +134,13 @@ uninstall-local:
+ #
+ # Require gtk-doc when making dist
+ #
+-if ENABLE_GTK_DOC
++#if ENABLE_GTK_DOC
++#dist-check-gtkdoc:
++#else
+ dist-check-gtkdoc:
+-else
+-dist-check-gtkdoc:
+       @echo "*** gtk-doc must be installed and enabled in order to make dist"
+       @false
+-endif
++#endif
+ 
+ dist-hook: dist-check-gtkdoc dist-hook-local
+       mkdir $(distdir)/html
Index: patches/patch-src_Makefile_am
===================================================================
RCS file: patches/patch-src_Makefile_am
diff -N patches/patch-src_Makefile_am
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_Makefile_am       27 Dec 2008 03:03:21 -0000
@@ -0,0 +1,40 @@
+$OpenBSD$
+--- src/Makefile.am.orig       Fri Dec 26 14:40:20 2008
++++ src/Makefile.am    Fri Dec 26 15:06:49 2008
+@@ -207,6 +207,36 @@ libcanberra_oss_la_LDFLAGS = \
+ endif
+ endif
+ 
++if HAVE_SNDIO
++if BUILTIN_SNDIO
++
++libcanberra_la_SOURCES += \
++      sndio.c
++libcanberra_la_LIBADD += \
++      $(SNDIO_LIBS)
++
++else
++
++plugin_LTLIBRARIES += \
++      libcanberra-sndio.la
++
++libcanberra_sndio_la_SOURCES = \
++      sndio.c
++libcanberra_sndio_la_CFLAGS = \
++       -Ddriver_open=sndio_driver_open \
++       -Ddriver_destroy=sndio_driver_destroy \
++       -Ddriver_change_device=sndio_driver_change_device \
++       -Ddriver_change_props=sndio_driver_change_props \
++       -Ddriver_play=sndio_driver_play \
++       -Ddriver_cancel=sndio_driver_cancel \
++       -Ddriver_cache=sndio_driver_cache
++libcanberra_sndio_la_LIBADD = \
++      libcanberra.la $(SNDIO_LIBS)
++libcanberra_sndio_la_LDFLAGS = \
++      -avoid-version -module -export-dynamic
++endif
++endif
++
+ if HAVE_GSTREAMER
+ if BUILTIN_GSTREAMER
+ 
Index: patches/patch-src_driver-order_c
===================================================================
RCS file: 
/home2/cvs/OpenBSD/ports/audio/libcanberra/patches/patch-src_driver-order_c,v
retrieving revision 1.1
diff -u -r1.1 patch-src_driver-order_c
--- patches/patch-src_driver-order_c    14 Dec 2008 15:10:15 -0000      1.1
+++ patches/patch-src_driver-order_c    27 Dec 2008 03:03:21 -0000
@@ -1,7 +1,16 @@
 $OpenBSD: patch-src_driver-order_c,v 1.1 2008/12/14 15:10:15 ajacoutot Exp $
---- src/driver-order.c.orig    Sun Dec 14 15:02:39 2008
-+++ src/driver-order.c Sun Dec 14 15:02:56 2008
-@@ -34,11 +34,11 @@ const char* const ca_driver_order[] = {
+--- src/driver-order.c.orig    Wed Aug 27 15:24:53 2008
++++ src/driver-order.c Fri Dec 26 16:38:44 2008
+@@ -28,17 +28,20 @@
+ #include "driver-order.h"
+ 
+ const char* const ca_driver_order[] = {
++#ifdef HAVE_SNDIO
++    "sndio",
++#endif
+ #ifdef HAVE_PULSE
+     "pulse",
+ #endif
  #ifdef HAVE_ALSA
      "alsa",
  #endif
Index: pkg/PFRAG.shared
===================================================================
RCS file: /home2/cvs/OpenBSD/ports/audio/libcanberra/pkg/PFRAG.shared,v
retrieving revision 1.2
diff -u -r1.2 PFRAG.shared
--- pkg/PFRAG.shared    19 Nov 2008 08:06:03 -0000      1.2
+++ pkg/PFRAG.shared    27 Dec 2008 03:03:21 -0000
@@ -5,4 +5,4 @@
 lib/libcanberra/libcanberra-gstreamer.so
 lib/libcanberra/libcanberra-multi.so
 lib/libcanberra/libcanberra-null.so
-lib/libcanberra/libcanberra-oss.so
+lib/libcanberra/libcanberra-sndio.so
Index: pkg/PLIST
===================================================================
RCS file: /home2/cvs/OpenBSD/ports/audio/libcanberra/pkg/PLIST,v
retrieving revision 1.4
diff -u -r1.4 PLIST
--- pkg/PLIST   14 Dec 2008 15:10:15 -0000      1.4
+++ pkg/PLIST   27 Dec 2008 03:03:21 -0000
@@ -18,8 +18,8 @@
 lib/libcanberra/libcanberra-multi.la
 lib/libcanberra/libcanberra-null.a
 lib/libcanberra/libcanberra-null.la
-lib/libcanberra/libcanberra-oss.a
-lib/libcanberra/libcanberra-oss.la
+lib/libcanberra/libcanberra-sndio.a
+lib/libcanberra/libcanberra-sndio.la
 lib/pkgconfig/libcanberra-gtk.pc
 lib/pkgconfig/libcanberra.pc
 share/doc/libcanberra/

Reply via email to