Hi,
- update to 0.6
- implement sndio backend and get rid of ossaudio
comments? ok?
Eric
Index: Makefile
===================================================================
RCS file: /cvs/ports/audio/cmu-sphinxbase/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile 16 Jul 2009 09:05:32 -0000 1.2
+++ Makefile 21 Apr 2010 14:16:06 -0000
@@ -2,12 +2,12 @@
COMMENT= common libraries for the CMU speech recognition engines
-VERSION= 0.4.1
+VERSION= 0.6
DISTNAME= sphinxbase-${VERSION}
-PKGNAME= cmu-sphinxbase-${VERSION}p0
+PKGNAME= cmu-sphinxbase-${VERSION}
CATEGORIES= audio
-SHARED_LIBS= sphinxbase 0.0 \
- sphinxad 0.0
+SHARED_LIBS= sphinxbase 1.0 \
+ sphinxad 1.0
HOMEPAGE= http://cmusphinx.sourceforge.net/
@@ -21,7 +21,7 @@
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=cmusphinx/}
-WANTLIB= blas c g2c m ossaudio pthread
+WANTLIB= blas c g2c m pthread sndio
MODULES= converters/libiconv
@@ -33,6 +33,9 @@
CONFIGURE_ARGS= --without-python
CONFIGURE_ENV= CPPFLAGS=-I${LOCALBASE}/include \
LDFLAGS=-L${LOCALBASE}/lib \
- LIBS="-lblas -lm -lg2c -lossaudio"
+ LIBS="-lblas -lm -lg2c -lsndio"
+
+pre-build:
+ @cp ${FILESDIR}/ad_sndio.c ${WRKSRC}/src/libsphinxad/
.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/audio/cmu-sphinxbase/distinfo,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 distinfo
--- distinfo 7 Jun 2009 07:23:37 -0000 1.1.1.1
+++ distinfo 21 Apr 2010 14:16:06 -0000
@@ -1,5 +1,5 @@
-MD5 (sphinxbase-0.4.1.tar.gz) = s7NKTeEEDgxUwmmMjtSqRA==
-RMD160 (sphinxbase-0.4.1.tar.gz) = eD4Y3TlaOPC3RQXp7rMpT8CnapI=
-SHA1 (sphinxbase-0.4.1.tar.gz) = LLyOyAfloEUMV0puN7N+p5kJb/I=
-SHA256 (sphinxbase-0.4.1.tar.gz) = NmgFqRNCmGh69l7uUD3d+FyLX+g+840j7AUuDqWYy5E=
-SIZE (sphinxbase-0.4.1.tar.gz) = 2126416
+MD5 (sphinxbase-0.6.tar.gz) = X4mVCWZSW19ppqs2s7gX3Q==
+RMD160 (sphinxbase-0.6.tar.gz) = hu+y1S2s3TPmS/vvGK8ILLKQisQ=
+SHA1 (sphinxbase-0.6.tar.gz) = iS1nheKYSE0V2Ic+G68iI2T+o0g=
+SHA256 (sphinxbase-0.6.tar.gz) = KTgywxDVzIHtjs9C1wLGdlE2yzOKA2qvhPR+Ekv3Lfw=
+SIZE (sphinxbase-0.6.tar.gz) = 2872665
Index: files/ad_sndio.c
===================================================================
RCS file: files/ad_sndio.c
diff -N files/ad_sndio.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ files/ad_sndio.c 21 Apr 2010 14:16:06 -0000
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2010 Eric Faurot <[email protected]>
+ *
+ * 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.
+ */
+#include <sndio.h>
+#include <stdio.h>
+#include <config.h>
+
+#include "prim_type.h"
+#include "ad.h"
+
+#define bPS 16
+#define BPS 2
+
+ad_rec_t *
+ad_open_dev(const char *dev, int32 rate)
+{
+ struct sio_hdl *hdl;
+ struct sio_par param;
+
+ hdl = sio_open(dev, SIO_REC, 1);
+ if (hdl == NULL) {
+ fprintf(stderr, "ad_open_dev: sio_open(%s) failed\n");
+ return NULL;
+ }
+
+ sio_initpar(¶m);
+ param.bits = bPS;
+ param.bps = BPS;
+ param.sig = 1;
+ param.le = 1;
+ param.rchan = 1;
+ param.rate = rate;
+ if (sio_setpar(&hdl, ¶m)) {
+ fprintf(stderr, "ad_open_dev: sio_setpar() failed\n");
+ sio_close(hdl);
+ return NULL;
+ }
+ if (sio_getpar(&hdl, ¶m)) {
+ fprintf(stderr, "ad_open_dev: sio_getpar() failed\n");
+ sio_close(hdl);
+ return NULL;
+ }
+ if (param.bits != bPS ||
+ param.bps != BPS ||
+ param.sig != 1 ||
+ param.le != 1 ||
+ param.rchan != 1 ||
+ param.rate != rate) {
+ fprintf(stderr, "ad_open_dev: can't set specified params\n");
+ sio_close(hdl);
+ return NULL;
+ }
+
+ return (ad_rec_t*)hdl;
+}
+
+ad_rec_t *
+ad_open_sps(int32 rate)
+{
+ return ad_open_dev(NULL, rate);
+}
+
+ad_rec_t *
+ad_open(void)
+{
+ return ad_open_sps(DEFAULT_SAMPLES_PER_SEC);
+}
+
+int32
+ad_start_rec(ad_rec_t *r)
+{
+ struct sio_hdl *hdl = (struct sio_hdl*)r;
+
+ if (sio_start(hdl))
+ return AD_ERR_GEN;
+
+ return (0);
+}
+
+int32
+ad_stop_rec(ad_rec_t *r)
+{
+ struct sio_hdl *hdl = (struct sio_hdl*)r;
+
+ if (sio_stop(hdl))
+ return AD_ERR_GEN;
+
+ return (0);
+}
+
+
+int32
+ad_read(ad_rec_t *r, int16 *buf, int32 max)
+{
+ size_t n;
+ struct sio_hdl *hdl = (struct sio_hdl*)r;
+
+ n = sio_read(hdl, buf, max * BPS);
+ return (n / 2);
+}
+
+int32
+ad_close(ad_rec_t *r)
+{
+ struct sio_hdl *hdl = (struct sio_hdl*)r;
+
+ sio_close(hdl);
+ return (0);
+}
Index: patches/patch-configure
===================================================================
RCS file: /cvs/ports/audio/cmu-sphinxbase/patches/patch-configure,v
retrieving revision 1.1
diff -u -r1.1 patch-configure
--- patches/patch-configure 16 Jul 2009 09:05:32 -0000 1.1
+++ patches/patch-configure 21 Apr 2010 14:16:06 -0000
@@ -1,24 +1,24 @@
$OpenBSD: patch-configure,v 1.1 2009/07/16 09:05:32 ajacoutot Exp $
---- configure.orig Mon Jul 13 13:25:48 2009
-+++ configure Mon Jul 13 13:25:57 2009
-@@ -8589,13 +8589,13 @@ fi
- done
+--- configure.orig Thu Mar 18 21:49:35 2010
++++ configure Wed Apr 21 14:24:52 2010
+@@ -7240,13 +7240,13 @@ fi
+ done
--{ echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5
--echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; }
-+{ echo "$as_me:$LINENO: checking for pthread_create in -pthread" >&5
-+echo $ECHO_N "checking for pthread_create in -pthread... $ECHO_C" >&6; }
- if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in
-lpthread" >&5
+-$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
++ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in
-pthread" >&5
++$as_echo_n "checking for pthread_create in -pthread... " >&6; }
+ if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
+LIBS="-pthread $LIBS"
- cat >conftest.$ac_ext <<_ACEOF
- /* confdefs.h. */
- _ACEOF
-@@ -8655,7 +8655,7 @@ if test $ac_cv_lib_pthread_pthread_create = yes; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h. */
+
+@@ -7281,7 +7281,7 @@ if test "x$ac_cv_lib_pthread_pthread_create" = x""yes;
#define HAVE_LIBPTHREAD 1
_ACEOF
@@ -27,3 +27,23 @@
fi
+@@ -7432,11 +7432,18 @@ fi
+
+ ;;
+ # FIXME: isn't this the same OSS as on Linux?
+- *-*-freebsd*|*-*-netbsd*|*-*-openbsd*)
++ *-*-freebsd*|*-*-netbsd*)
+ ad_files="ad_oss_bsd.lo"
+ ad_backend="AD_BACKEND_OSS_BSD"
+
+ $as_echo "#define AD_BACKEND_OSS_BSD /**/" >>confdefs.h
++
++ ;;
++ *-*-openbsd*)
++ ad_files="ad_sndio.lo"
++ ad_backend="AD_BACKEND_SNDIO"
++
++$as_echo "#define AD_BACKEND_SNDIO /**/" >>confdefs.h
+
+ ;;
+ *-*-sunos4*)
Index: patches/patch-src_libsphinxad_ad_oss_bsd_c
===================================================================
RCS file: patches/patch-src_libsphinxad_ad_oss_bsd_c
diff -N patches/patch-src_libsphinxad_ad_oss_bsd_c
--- patches/patch-src_libsphinxad_ad_oss_bsd_c 7 Jun 2009 07:23:37 -0000
1.1.1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-$OpenBSD: patch-src_libsphinxad_ad_oss_bsd_c,v 1.1.1.1 2009/06/07 07:23:37
eric Exp $
---- src/libsphinxad/ad_oss_bsd.c.orig Mon Jun 1 20:01:13 2009
-+++ src/libsphinxad/ad_oss_bsd.c Mon Jun 1 20:01:34 2009
-@@ -64,7 +64,7 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
--#include <sys/soundcard.h>
-+#include <soundcard.h>
- #include <sys/ioctl.h>
- #include <errno.h>
- #include <unistd.h>
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/audio/cmu-sphinxbase/pkg/PLIST,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 PLIST
--- pkg/PLIST 7 Jun 2009 07:23:37 -0000 1.1.1.1
+++ pkg/PLIST 21 Apr 2010 14:16:06 -0000
@@ -5,6 +5,7 @@
@bin bin/sphinx_cont_fileseg
@bin bin/sphinx_fe
@bin bin/sphinx_jsgf2fsg
+...@bin bin/sphinx_lm_convert
@bin bin/sphinx_lm_eval
bin/sphinx_lm_sort
@bin bin/sphinx_pitch
@@ -31,6 +32,7 @@
include/sphinxbase/glist.h
include/sphinxbase/hash_table.h
include/sphinxbase/heap.h
+include/sphinxbase/huff_code.h
include/sphinxbase/info.h
include/sphinxbase/jsgf.h
include/sphinxbase/libutil.h