Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Dec 2007 19:45:04 +0100
From:      "Pietro Cerutti" <gahr@gahr.ch>
To:        "FreeBSD gnats submit" <FreeBSD-gnats-submit@FreeBSD.org>
Subject:   ports/118467: [patch] audio/sphinx unbreak fix build with GCC 4.2
Message-ID:  <1196966704.78295@gahrtop.localhost>
Resent-Message-ID: <200712061850.lB6Io1Px031535@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         118467
>Category:       ports
>Synopsis:       [patch] audio/sphinx unbreak fix build with GCC 4.2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 06 18:50:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     Pietro Cerutti
>Release:        FreeBSD 8.0-CURRENT i386
>Organization:
>Environment:


System: FreeBSD 8.0-CURRENT #15: Thu Dec  6 12:47:48 CET 2007
    root@gahrtop.localhost:/usr/obj/usr/src/sys/MSI1034



>Description:


The following patch:

- fixes some new GCC 4.2 errors
- fixes objversion 
- cleans almost all warnings


>How-To-Repeat:


cd /usr/ports/audio/sphinx && make


>Fix:


--- _sphinx.diff begins here ---
--- Makefile.orig	2007-12-06 17:56:41.000000000 +0100
+++ Makefile	2007-12-06 19:33:08.000000000 +0100
@@ -17,19 +17,22 @@
 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 @@
 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>
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-examples_clicore.c	2007-12-06 18:36:53.000000000 +0100
@@ -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);
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-examples_srvcore.c	2007-12-06 18:36:17.000000000 +0100
@@ -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;
+     }
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-libsphinx2-include_pconf.h	2007-12-06 18:24:35.000000000 +0100
@@ -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
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-libsphinx2_blk_cdcn_norm.c	2007-12-06 19:24:16.000000000 +0100
@@ -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 */
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-libsphinx2_cdcn_norm.c	2007-12-06 19:26:45.000000000 +0100
@@ -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;
+ 
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-libsphinx2_eht_quit.c	2007-12-06 18:22:35.000000000 +0100
@@ -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
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-libsphinx2_err.c	2007-12-06 18:23:46.000000000 +0100
@@ -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
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-libsphinx2_linklist.c	2007-12-06 18:27:21.000000000 +0100
@@ -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;
+ 	}
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-libsphinx2_prime.c	2007-12-06 18:28:06.000000000 +0100
@@ -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
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-libsphinx2_r_agc_noise.c	2007-12-06 18:29:08.000000000 +0100
@@ -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"
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-libsphinx2_sc_vq.c	2007-12-06 18:38:55.000000000 +0100
@@ -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>
+ 
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-libsphinx2_search.c	2007-12-06 18:33:45.000000000 +0100
@@ -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 ();
--- /dev/null	2007-12-06 19:33:00.000000000 +0100
+++ files/patch-src-libsphinx2fe_fe_sigproc.c	2007-12-06 18:34:54.000000000 +0100
@@ -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
--- files/patch-src_libsphinx2_cdcn_update.c.orig	2004-09-20 08:47:47.000000000 +0200
+++ files/patch-src_libsphinx2_cdcn_update.c	2007-12-06 19:40:35.000000000 +0100
@@ -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
+      */
--- _sphinx.diff ends here ---



>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1196966704.78295>