1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-20 00:21:35 +00:00

- Fix build with gcc 4.2

PR:		118467
Submitted by:	Pietro Cerutti <gahr@gahr.ch>
Approved by:	portmgr (erwin)
This commit is contained in:
Martin Wilke 2007-12-10 22:29:47 +00:00
parent 5e8cd93f02
commit 72e8535d7a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=202932
15 changed files with 235 additions and 21 deletions

View File

@ -17,19 +17,22 @@ MAINTAINER= ports@FreeBSD.org
COMMENT= Speech recognition system
DEST= ${WRKSRC}/src/libsphinx2/
GNU_CONFIGURE= yes
USE_LDCONFIG= yes
PKGMESSAGE= ${WRKDIR}/pkg-message
USE_GMAKE= yes
USE_AUTOTOOLS=libtool:15
# contains i386 sound code
ONLY_FOR_ARCHS= i386
post-patch:
.for ii in CM_funcs.c hash.c linklist.c list.c salloc.c
${MV} ${DEST}${ii} ${DEST}${ii}.orig
${SED} -e "s:<malloc.h>:<stdlib.h>:g" < ${DEST}${ii}.orig > ${DEST}${ii}
.endfor
@${REINPLACE_CMD} -e 's:<malloc.h>:<stdlib.h>:g' \
${WRKSRC}/src/libsphinx2/CM_funcs.c \
${WRKSRC}/src/libsphinx2/hash.c \
${WRKSRC}/src/libsphinx2/list.c \
${WRKSRC}/src/libsphinx2/salloc.c
@${REINPLACE_CMD} -e 's|echo aout|echo elf|g' \
${WRKSRC}/configure
post-build:
${ECHO_CMD} "*** WARNING ***" > ${PKGMESSAGE}
@ -40,10 +43,4 @@ post-build:
pre-install:
${CAT} ${PKGMESSAGE}
.include <bsd.port.pre.mk>
.if ${OSVERSION} >= 700042
BROKEN= Does not compile with GCC 4.2
.endif
.include <bsd.port.post.mk>
.include <bsd.port.mk>

View File

@ -0,0 +1,11 @@
--- src/examples/clicore.c.orig 2007-12-06 18:36:24.000000000 +0100
+++ src/examples/clicore.c 2007-12-06 18:36:39.000000000 +0100
@@ -323,7 +323,7 @@
memcpy (&addr.sin_addr, hp->h_addr, hp->h_length);
addr.sin_port = htons((u_short) port);
- if (connect (conn_sd, &addr, sizeof(addr)) == 0)
+ if (connect (conn_sd, (struct sockaddr *)&addr, sizeof(addr)) == 0)
break;
print_errno ("connect");
cli_close (conn_sd);

View File

@ -0,0 +1,11 @@
--- src/examples/srvcore.c.orig 2007-12-06 18:35:25.000000000 +0100
+++ src/examples/srvcore.c 2007-12-06 18:35:56.000000000 +0100
@@ -381,7 +381,7 @@
ERRLOG((stderr, "%s(%d): Listening at port %d\n", __FILE__, __LINE__, bindport));
- if ((conn_sd = accept (listen_sd, &address, &address_len)) == INVALID_SOCKET) {
+ if ((conn_sd = accept (listen_sd, (struct sockaddr *)&address, &address_len)) == INVALID_SOCKET) {
print_errno ("conn_accept");
return INVALID_SOCKET;
}

View File

@ -0,0 +1,8 @@
--- src/libsphinx2/include/pconf.h.orig 2007-12-06 18:24:09.000000000 +0100
+++ src/libsphinx2/include/pconf.h 2007-12-06 18:24:20.000000000 +0100
@@ -124,4 +124,4 @@
char * (*GetDefault)(char const *, char const *), char last);
void pusage(char *prog, Config_t *cp);
-#endif _PCONF_
+#endif

View File

@ -0,0 +1,37 @@
--- src/libsphinx2/blk_cdcn_norm.c.orig 2007-12-06 19:23:43.000000000 +0100
+++ src/libsphinx2/blk_cdcn_norm.c 2007-12-06 19:23:25.000000000 +0100
@@ -36,6 +36,18 @@
#include <math.h>
#include "cdcn.h"
+static void
+block_actual_cdcn_norm(float variance[][NUM_COEFF+1], /* Speech cepstral variances of modes */
+ float *prob, /* Ratio of a-prori mode probs. to mod variance */
+ float *tilt, /* Spectral tilt cepstrum */
+ float *noise, /* Noise estimate */
+ float means[][NUM_COEFF+1], /* The cepstrum codebook */
+ float corrbook[][NUM_COEFF+1], /* The correction factor's codebook */
+ int num_codes, /* Number of codewords in codebook */
+ float z[][NUM_COEFF+1], /* The input cepstrum */
+ int num_frames); /* Number of frames in utterance */
+
+
/************************************************************************
* Dummy routine to convert from suitcase to sane varibles
***************************************************************************/
@@ -46,7 +58,6 @@
{
/* Multidimensional arrays in C suck, so we have to
forward-declare-hack this. */
- static void block_actual_cdcn_norm();
float *variance, *prob, *tilt, *noise, *codebook, *corrbook;
int num_codes;
@@ -88,7 +99,6 @@
* Coded by Alex Acero (acero@s), November 1989
*
*************************************************************************/
-
static void
block_actual_cdcn_norm(float variance[][NUM_COEFF+1], /* Speech cepstral variances of modes */
float *prob, /* Ratio of a-prori mode probs. to mod variance */

View File

@ -0,0 +1,27 @@
--- src/libsphinx2/cdcn_norm.c.orig 2007-12-06 19:24:33.000000000 +0100
+++ src/libsphinx2/cdcn_norm.c 2007-12-06 19:26:24.000000000 +0100
@@ -35,6 +35,15 @@
*/
#include <math.h>
#include "cdcn.h"
+static void
+actual_cdcn_norm(float variance[][NUM_COEFF+1], /* Speech cepstral variances of modes */
+ float *prob, /* Ratio of a-prori mode probs. to mod variance */
+ float *tilt, /* Spectral tilt cepstrum */
+ float *noise, /* Noise estimate */
+ float means[][NUM_COEFF+1], /* The cepstrum codebook */
+ float corrbook[][NUM_COEFF+1], /* The correction factor's codebook */
+ int num_codes, /* Number of codewords in codebook */
+ float z[NUM_COEFF+1]); /* The input cepstrum */
/************************************************************************
* Dummy routine to convert from suitcase to sane varibles
@@ -43,8 +52,6 @@
void cdcn_norm (float z[NUM_COEFF+1], /* The input cepstrum */
CDCN_type *cdcn_variables)
{
- /* Multidimensional arrays, yuck. */
- static void actual_cdcn_norm();
float *variance, *prob, *tilt, *noise, *codebook, *corrbook;
int num_codes;

View File

@ -0,0 +1,10 @@
--- src/libsphinx2/eht_quit.c.orig 2007-12-06 18:21:53.000000000 +0100
+++ src/libsphinx2/eht_quit.c 2007-12-06 18:22:13.000000000 +0100
@@ -85,6 +85,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <stdarg.h>
void

View File

@ -0,0 +1,10 @@
--- src/libsphinx2/err.c.orig 2007-12-06 18:22:49.000000000 +0100
+++ src/libsphinx2/err.c 2007-12-06 18:23:27.000000000 +0100
@@ -49,6 +49,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#if ((! WIN32) && (! _SGI_SOURCE))
#include <sys/errno.h>
#else

View File

@ -0,0 +1,19 @@
--- src/libsphinx2/linklist.c.orig 2007-12-06 18:25:48.000000000 +0100
+++ src/libsphinx2/linklist.c 2007-12-06 18:27:00.000000000 +0100
@@ -81,7 +81,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include <malloc.h>
#include "s2types.h"
@@ -132,7 +131,7 @@
cpp = list[i].freelist = (void **) malloc (list[i].n_malloc * elem_size);
cp = (void *) cpp;
for (j = list[i].n_malloc-1; j > 0; --j) {
- (char*)cp += elem_size;
+ cp += elem_size;
*cpp = cp;
cpp = (void **)cp;
}

View File

@ -0,0 +1,9 @@
--- src/libsphinx2/prime.c.orig 2007-12-06 18:27:41.000000000 +0100
+++ src/libsphinx2/prime.c 2007-12-06 18:27:51.000000000 +0100
@@ -75,5 +75,4 @@
}
}
-#endif MAIN
-
+#endif

View File

@ -0,0 +1,10 @@
--- src/libsphinx2/r_agc_noise.c.orig 2007-12-06 18:28:21.000000000 +0100
+++ src/libsphinx2/r_agc_noise.c 2007-12-06 18:28:49.000000000 +0100
@@ -34,6 +34,7 @@
*
*/
#include <stdio.h>
+#include <string.h>
#include "s2types.h"
#include "c.h"

View File

@ -0,0 +1,10 @@
--- src/libsphinx2/sc_vq.c.orig 2007-12-06 18:38:16.000000000 +0100
+++ src/libsphinx2/sc_vq.c 2007-12-06 18:38:36.000000000 +0100
@@ -64,6 +64,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <assert.h>
#include <limits.h>

View File

@ -0,0 +1,28 @@
--- src/libsphinx2/search.c.orig 2007-12-06 18:29:23.000000000 +0100
+++ src/libsphinx2/search.c 2007-12-06 18:33:21.000000000 +0100
@@ -2236,6 +2236,9 @@
lm_next_frame ();
}
+static void compute_phone_perplexity( void );
+static search_hyp_t *fwdtree_pscr_path ( void );
+
void
search_finish_fwd (void)
{
@@ -2245,7 +2248,6 @@
CHAN_T *hmm, /* *thmm,*/ **acl;
/* int32 bp, bestbp, bestscore; */
/* int32 l_scr; */
- static void compute_phone_perplexity( void );
if ((CurrentFrame > 0) && (topsen_window > 1)) {
/* Wind up remaining frames */
@@ -2306,7 +2308,6 @@
/* Get pscr-score for fwdtree recognition */
{
search_hyp_t *pscrpath;
- static search_hyp_t *fwdtree_pscr_path ( void );
if (query_phone_conf ()) {
pscrpath = fwdtree_pscr_path ();

View File

@ -0,0 +1,11 @@
--- src/libsphinx2fe/fe_sigproc.c.orig 2007-12-06 18:34:10.000000000 +0100
+++ src/libsphinx2fe/fe_sigproc.c 2007-12-06 18:34:25.000000000 +0100
@@ -43,7 +43,7 @@
#ifndef M_PI
#define M_PI (3.14159265358979323846)
-#endif M_PI
+#endif
#define FORWARD_FFT 1
#define INVERSE_FFT -1

View File

@ -1,13 +1,29 @@
--- src/libsphinx2/cdcn_update.c.orig Fri Sep 17 14:17:51 2004
+++ src/libsphinx2/cdcn_update.c Fri Sep 17 14:26:32 2004
@@ -57,8 +57,8 @@
--- src/libsphinx2/cdcn_update.c.orig 2001-12-13 22:11:20.000000000 +0100
+++ src/libsphinx2/cdcn_update.c 2007-12-06 19:40:02.000000000 +0100
@@ -47,6 +47,11 @@
* Modified by Uday Jain, June 95
*
*************************************************************************/
+static float initialize (float [][NUM_COEFF+1], int, float *, float *, float,
+ float [][NUM_COEFF+1], float *, float [][NUM_COEFF+1], int);
+static void correction(float *, float *, float *, float *, int);
+static float max_q (float *, float *, float *, float *, float *,
+ float *, int, float *, int);
float
cdcn_update (float *z, /* The observed cepstrum vectors */
@@ -56,13 +61,7 @@
float distortion;
float *noise, *tilt, *codebook, *prob, *variance, *corrbook;
int num_codes;
/* Multidimensional arrays, gar gar gar */
- /* Multidimensional arrays, gar gar gar */
- static float initialize (float *, int, float *, float *, float,
- float *, float *, float *, int);
+ static float initialize (float [][NUM_COEFF+1], int, float *, float *, float,
+ float [][NUM_COEFF+1], float *, float [][NUM_COEFF+1], int);
static void correction(float *, float *, float *, float *, int);
static float max_q (float *, float *, float *, float *, float *,
float *, int, float *, int);
- static void correction(float *, float *, float *, float *, int);
- static float max_q (float *, float *, float *, float *, float *,
- float *, int, float *, int);
-
+
/*
* If error, dont bother
*/