From gahr@gahr.ch  Thu Dec  6 18:46:21 2007
Return-Path: <gahr@gahr.ch>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 143A116A417
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  6 Dec 2007 18:46:21 +0000 (UTC)
	(envelope-from gahr@gahr.ch)
Received: from cpanel03.rubas-s03.net (cpanel03.rubas-s03.net [195.182.222.73])
	by mx1.freebsd.org (Postfix) with ESMTP id 885E313C46B
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  6 Dec 2007 18:46:20 +0000 (UTC)
	(envelope-from gahr@gahr.ch)
Received: from [80.218.191.236] (helo=gahrtop.localhost)
	by cpanel03.rubas-s03.net with esmtpa (Exim 4.68)
	(envelope-from <gahr@gahr.ch>)
	id 1J0Ljn-0002uI-4Q
	for FreeBSD-gnats-submit@freebsd.org; Thu, 06 Dec 2007 19:46:19 +0100
Received: from gahrtop.localhost (localhost [127.0.0.1])
	by gahrtop.localhost (Postfix) with ESMTP id E80307306B
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  6 Dec 2007 19:45:04 +0100 (CET)
Message-Id: <1196966704.78295@gahrtop.localhost>
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: [patch] audio/sphinx unbreak fix build with GCC 4.2
X-Send-Pr-Version: gtk-send-pr 0.4.8 
X-GNATS-Notify:

>Number:         118467
>Category:       ports
>Synopsis:       [patch] audio/sphinx unbreak fix build with GCC 4.2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    miwi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 06 18:50:01 UTC 2007
>Closed-Date:    Mon Dec 10 22:37:31 UTC 2007
>Last-Modified:  Mon Dec 10 22:37:31 UTC 2007
>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:
Responsible-Changed-From-To: freebsd-ports-bugs->miwi 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Thu Dec 6 18:50:08 UTC 2007 
Responsible-Changed-Why:  
miwi@ wants his PRs (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118467 

From: Pietro Cerutti <gahr@gahr.ch>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/118467: [patch] audio/sphinx unbreak fix build with GCC
 4.2
Date: Fri, 07 Dec 2007 02:23:18 +0100

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --------------enig047FAE9FC5408FF360A94E64
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: quoted-printable
 
 Someone between my host and GNATS eat the ^M in
 files/patch-src-libsphinx2fe_fe_sigproc.c..
 
 Here's the patch w/ ^M's...
 
 http://www.gahr.ch/FreeBSD/patches/118467_sphinx.diff
 
 --=20
 Pietro Cerutti
 
 PGP Public Key:
 http://gahr.ch/pgp
 
 
 --------------enig047FAE9FC5408FF360A94E64
 Content-Type: application/pgp-signature; name="signature.asc"
 Content-Description: OpenPGP digital signature
 Content-Disposition: attachment; filename="signature.asc"
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.7 (FreeBSD)
 
 iD8DBQFHWKCMwMJqmJVx944RCjALAKDiL9ZQtlkC4i+JmnmxTFU2X3teaACfSO6T
 LW5d8WUsLoRq5YP6TD56dVU=
 =yAw6
 -----END PGP SIGNATURE-----
 
 --------------enig047FAE9FC5408FF360A94E64--

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/118467: commit references a PR
Date: Mon, 10 Dec 2007 22:29:54 +0000 (UTC)

 miwi        2007-12-10 22:29:47 UTC
 
   FreeBSD ports repository
 
   Modified files:
     audio/sphinx         Makefile 
     audio/sphinx/files   patch-src_libsphinx2_cdcn_update.c 
   Added files:
     audio/sphinx/files   patch-src-examples_clicore.c 
                          patch-src-examples_srvcore.c 
                          patch-src-libsphinx2-include_pconf.h 
                          patch-src-libsphinx2_blk_cdcn_norm.c 
                          patch-src-libsphinx2_cdcn_norm.c 
                          patch-src-libsphinx2_eht_quit.c 
                          patch-src-libsphinx2_err.c 
                          patch-src-libsphinx2_linklist.c 
                          patch-src-libsphinx2_prime.c 
                          patch-src-libsphinx2_r_agc_noise.c 
                          patch-src-libsphinx2_sc_vq.c 
                          patch-src-libsphinx2_search.c 
                          patch-src-libsphinx2fe_fe_sigproc.c 
   Log:
   - Fix build with gcc 4.2
   
   PR:             118467
   Submitted by:   Pietro Cerutti <gahr@gahr.ch>
   Approved by:    portmgr (erwin)
   
   Revision  Changes    Path
   1.22      +9 -12     ports/audio/sphinx/Makefile
   1.1       +11 -0     ports/audio/sphinx/files/patch-src-examples_clicore.c (new)
   1.1       +11 -0     ports/audio/sphinx/files/patch-src-examples_srvcore.c (new)
   1.1       +8 -0      ports/audio/sphinx/files/patch-src-libsphinx2-include_pconf.h (new)
   1.1       +37 -0     ports/audio/sphinx/files/patch-src-libsphinx2_blk_cdcn_norm.c (new)
   1.1       +27 -0     ports/audio/sphinx/files/patch-src-libsphinx2_cdcn_norm.c (new)
   1.1       +10 -0     ports/audio/sphinx/files/patch-src-libsphinx2_eht_quit.c (new)
   1.1       +10 -0     ports/audio/sphinx/files/patch-src-libsphinx2_err.c (new)
   1.1       +19 -0     ports/audio/sphinx/files/patch-src-libsphinx2_linklist.c (new)
   1.1       +9 -0      ports/audio/sphinx/files/patch-src-libsphinx2_prime.c (new)
   1.1       +10 -0     ports/audio/sphinx/files/patch-src-libsphinx2_r_agc_noise.c (new)
   1.1       +10 -0     ports/audio/sphinx/files/patch-src-libsphinx2_sc_vq.c (new)
   1.1       +28 -0     ports/audio/sphinx/files/patch-src-libsphinx2_search.c (new)
   1.1       +11 -0     ports/audio/sphinx/files/patch-src-libsphinx2fe_fe_sigproc.c (new)
   1.2       +25 -9     ports/audio/sphinx/files/patch-src_libsphinx2_cdcn_update.c
 _______________________________________________
 cvs-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/cvs-all
 To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: open->closed 
State-Changed-By: miwi 
State-Changed-When: Mon Dec 10 22:37:31 UTC 2007 
State-Changed-Why:  
Committed. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=118467 
>Unformatted:
