this will add libsndio backend to libao, and make it the default. The following ports use it:
mpg321, vorbis-tools, tremor-tools, mpd I've changed diffs against ./configure and .in files to apply to the corresponding .ac and .am files, and switched the port to use autoconf and automake. Is this the correct approach? One remark about mpd: since it runs as user _mpd, if you're using aucat, you'll have to change the permissions of /tmp/aucat.sock, this will be fixed in aucat soon, though. -- Alexandre Index: Makefile =================================================================== RCS file: /cvs/ports/audio/libao/Makefile,v retrieving revision 1.41 diff -u -p -r1.41 Makefile --- Makefile 11 Dec 2007 22:02:11 -0000 1.41 +++ Makefile 28 Oct 2008 09:42:31 -0000 @@ -6,7 +6,7 @@ COMMENT-esd= ESounD module for portable VERSION= 0.8.8 DISTNAME= libao-${VERSION} -PKGNAME-main= libao-${VERSION}p0 +PKGNAME-main= libao-${VERSION}p1 PKGNAME-arts= libao-arts-${VERSION} PKGNAME-esd= libao-esd-${VERSION} CATEGORIES= audio @@ -36,7 +36,10 @@ MULTI_PACKAGES+=-esd USE_LIBTOOL= Yes SEPARATE_BUILD= simple -CONFIGURE_STYLE=gnu +AUTOCONF_VERSION = 2.61 +AUTOMAKE_VERSION = 1.9 +CONFIGURE_STYLE= no-autoheader automake autoconf + CONFIGURE_ARGS= ${CONFIGURE_SHARED} --enable-static .if ${FLAVOR:L:Mno_arts} CONFIGURE_ARGS+=--disable-arts @@ -53,7 +56,7 @@ MODULES= devel/gettext LIB_DEPENDS-main= RUN_DEPENDS-main= -WANTLIB-main= pthread +WANTLIB-main= pthread sndio LIB_DEPENDS-arts= ${MODGETTEXT_LIB_DEPENDS} \ artsc::x11/kde/arts3 @@ -64,6 +67,16 @@ WANTLIB-arts= glib-2.0 gmodule-2.0 gthr LIB_DEPENDS-esd= esd.>=2::audio/esound RUN_DEPENDS-esd= :libao-${VERSION}:audio/libao WANTLIB-esd= audiofile m pthread + +post-patch: + cp -r ${FILESDIR}/libsndio ${WRKSRC}/src/plugins + cd ${WRKSRC}; AUTOCONF_VERSION=${AUTOCONF_VERSION} \ + AUTOMAKE_VERSION=${AUTOMAKE_VERSION} aclocal + +pre-configure: + cd ${WRKSRC}; AUTOCONF_VERSION=${AUTOCONF_VERSION} \ + AUTOMAKE_VERSION=${AUTOMAKE_VERSION} automake \ + --foreign --add-missing --copy pre-build: @perl -i -pe 's:/etc/libao.conf:${SYSCONFDIR}/libao.conf:g' \ Index: files/libsndio/Makefile.am =================================================================== RCS file: files/libsndio/Makefile.am diff -N files/libsndio/Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/libsndio/Makefile.am 28 Oct 2008 09:42:31 -0000 @@ -0,0 +1,26 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS = foreign + +if HAVE_LIBSNDIO_AUDIO + +libsndioltlibs = libsndio.la +libsndiosources = ao_libsndio.c + +else + +libsndioltlibs = +libsndiosources = + +endif + +INCLUDES = -I$(top_builddir)/include/ao -I$(top_srcdir)/include + +libdir = $(plugindir) +lib_LTLIBRARIES = $(libsndioltlibs) + +libsndio_la_LDFLAGS = @PLUGIN_LDFLAGS@ +libsndio_la_LIBADD = -lsndio +libsndio_la_SOURCES = $(libsndiosources) + +EXTRA_DIST = ao_libsndio.c Index: files/libsndio/ao_libsndio.c =================================================================== RCS file: files/libsndio/ao_libsndio.c diff -N files/libsndio/ao_libsndio.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ files/libsndio/ao_libsndio.c 28 Oct 2008 09:42:31 -0000 @@ -0,0 +1,112 @@ +/* + * + * ao_libsndio.c libsndio + * + * Copyright (C) Alexandre Ratchov - 2008 + * + * libao is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * libao is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ +#include <sndio.h> +#include <ao/ao.h> +#include <ao/plugin.h> + +ao_info ao_libsndio_info = { + AO_TYPE_LIVE, + "libsndio audio output", + "libsndio", + "Alexandre Ratchov <[EMAIL PROTECTED]>", + "output using libsndio", + AO_FMT_NATIVE, + 30, + NULL, /* no options */ + 0 /* zero options */ +}; + +int ao_plugin_test() +{ + struct sio_hdl *hdl; + + hdl = sio_open(NULL, SIO_PLAY, 0); + if (hdl == NULL) + return 0; + sio_close(hdl); + return 1; +} + +ao_info *ao_plugin_driver_info(void) +{ + return &ao_libsndio_info; +} + +int ao_plugin_device_init(ao_device *device) +{ + struct sio_hdl *hdl; + + hdl = sio_open(NULL, SIO_PLAY, 0); + if (hdl == NULL) + return 0; + device->internal = hdl; + return 1; +} + +int ao_plugin_set_option(ao_device *device, const char *key, const char *value) +{ + return 1; +} + +int ao_plugin_open(ao_device *device, ao_sample_format *format) +{ + struct sio_hdl *hdl = (struct sio_hdl *)device->internal; + struct sio_par par; + + sio_initpar(&par); + par.sig = 1; + par.le = SIO_LE_NATIVE; + par.bits = format->bits; + par.rate = format->rate; + par.pchan = format->channels; + if (!sio_setpar(hdl, &par)) + return 0; + device->driver_byte_format = AO_FMT_NATIVE; + if (!sio_start(hdl)) + return 0; + return 1; +} + +int ao_plugin_play(ao_device *device, const char *output_samples, uint_32 num_bytes) +{ + struct sio_hdl *hdl = (struct sio_hdl *)device->internal; + + if (!sio_write(hdl, output_samples, num_bytes)) + return 0; + return 1; +} + +int ao_plugin_close(ao_device *device) +{ + struct sio_hdl *hdl = (struct sio_hdl *)device->internal; + + if (!sio_stop(hdl)) + return 0; + return 1; +} + +void ao_plugin_device_clear(ao_device *device) +{ + struct sio_hdl *hdl = (struct sio_hdl *)device->internal; + + sio_close(hdl); +} Index: patches/patch-configure =================================================================== RCS file: patches/patch-configure diff -N patches/patch-configure --- patches/patch-configure 12 Jul 2007 21:10:15 -0000 1.9 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,25 +0,0 @@ -$OpenBSD: patch-configure,v 1.9 2007/07/12 21:10:15 naddy Exp $ ---- configure.orig Thu May 24 12:51:52 2007 -+++ configure Wed Jul 11 21:58:16 2007 -@@ -20076,7 +20076,7 @@ if test -z "$GCC"; then - *) - PLUGIN_LDFLAGS="-export-dynamic -avoid-version" - DEBUG="-g" -- CFLAGS="-O" -+ CFLAGS="" - PROFILE="-g -p" ;; - esac - else -@@ -20099,9 +20099,9 @@ else - PROFILE="-g -pg -D__NO_MATH_INLINES -fsigned-char -Ddlsym=dlsym_auto_underscore" ;; - *) - PLUGIN_LDFLAGS="-export-dynamic -avoid-version" -- DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char" -- CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char" -- PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;; -+ DEBUG="-g -Wall -fsigned-char" -+ CFLAGS="-fsigned-char" -+ PROFILE="-g -pg -fsigned-char" ;; - esac - fi - CFLAGS="$CFLAGS $cflags_save" 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 28 Oct 2008 09:42:31 -0000 @@ -0,0 +1,33 @@ +--- configure.ac.orig Thu May 24 12:51:05 2007 ++++ configure.ac Tue Oct 28 08:46:33 2008 +@@ -90,9 +90,9 @@ else + PROFILE="-g -pg -D__NO_MATH_INLINES -fsigned-char -Ddlsym=dlsym_auto_underscore" ;; + *) + PLUGIN_LDFLAGS="-export-dynamic -avoid-version" +- DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char" +- CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char" +- PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;; ++ DEBUG="-g -Wall -fsigned-char" ++ CFLAGS="-O -fsigned-char" ++ PROFILE="-O -g -pg -fsigned-char" ;; + esac + fi + CFLAGS="$CFLAGS $cflags_save" +@@ -300,6 +300,11 @@ dnl Check for Sun audio + AC_CHECK_HEADERS(sys/audioio.h) + AM_CONDITIONAL(HAVE_SUN_AUDIO,test "${ac_cv_header_sys_audioio_h}" = yes) + ++dnl Check for libsndio audio ++ ++AC_CHECK_HEADERS(sndio.h) ++AM_CONDITIONAL(HAVE_LIBSNDIO_AUDIO,test "${ac_cv_header_sndio_h}" = yes) ++ + dnl Check for AIX audio + + case $host in +@@ -415,4 +420,4 @@ dnl Plugins get special LDFLAGS + AC_SUBST(PLUGIN_LDFLAGS) + + +-AC_OUTPUT(Makefile src/Makefile doc/Makefile include/Makefile include/ao/Makefile include/ao/os_types.h src/plugins/Makefile src/plugins/esd/Makefile src/plugins/oss/Makefile src/plugins/alsa/Makefile src/plugins/alsa09/Makefile src/plugins/sun/Makefile src/plugins/irix/Makefile src/plugins/arts/Makefile src/plugins/macosx/Makefile src/plugins/nas/Makefile src/plugins/pulse/Makefile ao.pc) ++AC_OUTPUT(Makefile src/Makefile doc/Makefile include/Makefile include/ao/Makefile include/ao/os_types.h src/plugins/Makefile src/plugins/esd/Makefile src/plugins/oss/Makefile src/plugins/alsa/Makefile src/plugins/alsa09/Makefile src/plugins/sun/Makefile src/plugins/irix/Makefile src/plugins/arts/Makefile src/plugins/macosx/Makefile src/plugins/nas/Makefile src/plugins/pulse/Makefile src/plugins/libsndio/Makefile ao.pc) Index: patches/patch-doc_Makefile_am =================================================================== RCS file: patches/patch-doc_Makefile_am diff -N patches/patch-doc_Makefile_am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-doc_Makefile_am 28 Oct 2008 09:42:31 -0000 @@ -0,0 +1,11 @@ +--- doc/Makefile.am.old Mon Sep 29 17:50:24 2008 ++++ doc/Makefile.am Mon Sep 29 17:50:37 2008 +@@ -2,7 +2,7 @@ + + AUTOMAKE_OPTIONS = foreign + +-docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION) ++docdir = $(datadir)/doc/$(PACKAGE) + + # We list all of these as opposed to using a wildcard so that + # building outside the source directory works. Index: patches/patch-doc_Makefile_in =================================================================== RCS file: patches/patch-doc_Makefile_in diff -N patches/patch-doc_Makefile_in --- patches/patch-doc_Makefile_in 12 Jul 2007 21:10:15 -0000 1.7 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -$OpenBSD: patch-doc_Makefile_in,v 1.7 2007/07/12 21:10:15 naddy Exp $ ---- doc/Makefile.in.orig Wed Jul 11 21:56:58 2007 -+++ doc/Makefile.in Wed Jul 11 21:57:09 2007 -@@ -161,7 +161,7 @@ build_vendor = @build_vendor@ - builddir = @builddir@ - datadir = @datadir@ - datarootdir = @datarootdir@ --docdir = $(datadir)/doc/$(PACKAGE)-$(VERSION) -+docdir = $(datadir)/doc/$(PACKAGE) - dvidir = @dvidir@ - exec_prefix = @exec_prefix@ - host = @host@ Index: patches/patch-src_plugins_Makefile_am =================================================================== RCS file: patches/patch-src_plugins_Makefile_am diff -N patches/patch-src_plugins_Makefile_am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_plugins_Makefile_am 28 Oct 2008 09:42:31 -0000 @@ -0,0 +1,9 @@ +--- src/plugins/Makefile.am.orig Thu May 24 11:19:07 2007 ++++ src/plugins/Makefile.am Mon Sep 29 22:12:54 2008 +@@ -1,4 +1,5 @@ + ## Process this file with automake to produce Makefile.in + + AUTOMAKE_OPTIONS = foreign +-SUBDIRS = oss esd arts alsa alsa09 sun irix macosx nas pulse ++SUBDIRS = oss esd arts alsa alsa09 sun irix macosx nas pulse libsndio ++AM_LIBTOOL_FLAGS = --tag=disable-static Index: patches/patch-src_plugins_Makefile_in =================================================================== RCS file: patches/patch-src_plugins_Makefile_in diff -N patches/patch-src_plugins_Makefile_in --- patches/patch-src_plugins_Makefile_in 12 Jul 2007 21:10:15 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,12 +0,0 @@ -$OpenBSD: patch-src_plugins_Makefile_in,v 1.3 2007/07/12 21:10:15 naddy Exp $ ---- src/plugins/Makefile.in.orig Thu Jul 12 21:05:42 2007 -+++ src/plugins/Makefile.in Thu Jul 12 21:06:21 2007 -@@ -259,7 +259,7 @@ $(RECURSIVE_TARGETS): - else \ - local_target="$$target"; \ - fi; \ -- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ -+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) LIBTOOL="$(LIBTOOL) --tag=disable-static" $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ Index: pkg/DESCR-main =================================================================== RCS file: /cvs/ports/audio/libao/pkg/DESCR-main,v retrieving revision 1.1 diff -u -p -r1.1 DESCR-main --- pkg/DESCR-main 24 Nov 2006 16:22:21 -0000 1.1 +++ pkg/DESCR-main 28 Oct 2008 09:42:31 -0000 @@ -6,3 +6,4 @@ it currently supports: * AU files * WAV files * sun (OpenBSD's native sound system) + * libsndio (OpenBSD native sound system) Index: pkg/PFRAG.shared-main =================================================================== RCS file: /cvs/ports/audio/libao/pkg/PFRAG.shared-main,v retrieving revision 1.2 diff -u -p -r1.2 PFRAG.shared-main --- pkg/PFRAG.shared-main 12 Jul 2007 21:10:15 -0000 1.2 +++ pkg/PFRAG.shared-main 28 Oct 2008 09:42:31 -0000 @@ -1,6 +1,7 @@ @comment $OpenBSD: PFRAG.shared-main,v 1.2 2007/07/12 21:10:15 naddy Exp $ lib/ao/ lib/ao/plugins-2/ +lib/ao/plugins-2/libsndio.so @comment lib/ao/plugins-2/libsun.la lib/ao/plugins-2/libsun.so @lib lib/libao.so.${LIBao_VERSION} Index: pkg/PLIST-main =================================================================== RCS file: /cvs/ports/audio/libao/pkg/PLIST-main,v retrieving revision 1.1 diff -u -p -r1.1 PLIST-main --- pkg/PLIST-main 24 Nov 2006 16:22:21 -0000 1.1 +++ pkg/PLIST-main 28 Oct 2008 09:42:31 -0000 @@ -7,6 +7,10 @@ include/ao/ include/ao/ao.h include/ao/os_types.h include/ao/plugin.h +lib/ao/plugins-2/libesd.a +lib/ao/plugins-2/libsndio.a +lib/ao/plugins-2/libsndio.la +lib/ao/plugins-2/libsun.a lib/libao.a lib/libao.la lib/pkgconfig/