From gahr@gahr.ch  Sun Nov 25 23:19:32 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 29D5516A419
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 25 Nov 2007 23:19:32 +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 B280513C44B
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 25 Nov 2007 23:19:31 +0000 (UTC)
	(envelope-from gahr@gahr.ch)
Received: from 80-218-191-236.dclient.hispeed.ch ([80.218.191.236] helo=gahrtop.localhost)
	by cpanel03.rubas-s03.net with esmtpa (Exim 4.63)
	(envelope-from <gahr@gahr.ch>)
	id 1IwQl7-0001Kj-Co
	for FreeBSD-gnats-submit@freebsd.org; Mon, 26 Nov 2007 00:19:29 +0100
Received: from gahrtop.localhost (localhost [127.0.0.1])
	by gahrtop.localhost (Postfix) with ESMTP id 9DA1273085
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 26 Nov 2007 00:18:24 +0100 (CET)
Message-Id: <1196032704.14013@gahrtop.localhost>
Date: Mon, 26 Nov 2007 00:18:24 +0100
From: "Pietro Cerutti" <gahr@gahr.ch>
To: "FreeBSD gnats submit" <FreeBSD-gnats-submit@freebsd.org>
Subject: [patch] games/gnubg unbreak fix build with GCC 4.2 + adopt maintainship
X-Send-Pr-Version: gtk-send-pr 0.4.8 
X-GNATS-Notify:

>Number:         118254
>Category:       ports
>Synopsis:       [patch] games/gnubg unbreak fix build with GCC 4.2 + adopt maintainship
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    miwi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Nov 25 23:20:01 UTC 2007
>Closed-Date:    Tue Nov 27 22:48:50 UTC 2007
>Last-Modified:  Tue Nov 27 22:50:03 UTC 2007
>Originator:     Pietro Cerutti
>Release:        FreeBSD 8.0-CURRENT i386
>Organization:
>Environment:


System: FreeBSD 8.0-CURRENT #12: Tue Nov 20 17:46:40 CET 2007
    root@gahrtop.localhost:/usr/obj/usr/src/sys/MSI1034



>Description:


The following patch:
- fixes the build with GCC 4.2
- removes warnings
- gives maintainship to me


>How-To-Repeat:


cd /usr/ports/games/gnubg && make


>Fix:


--- _gnubg.diff begins here ---
--- Makefile.orig	2007-11-25 23:45:45.000000000 +0100
+++ Makefile	2007-11-25 23:46:00.000000000 +0100
@@ -17,7 +17,7 @@
 DIST_SUBDIR=	${PORTNAME}
 EXTRACT_ONLY=	${DISTNAME}.tar.gz
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	gahr@gahr.ch
 COMMENT=	GNU Backgammon
 
 LIB_DEPENDS=	gdbm.3:${PORTSDIR}/databases/gdbm \
@@ -69,10 +69,6 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} >= 700042
-BROKEN=		Broken with gcc 4.2
-.endif
-
 .if ${ARCH} == "sparc64"
 BROKEN=		does not compile on sparc64
 .endif
--- /dev/null	2007-11-25 23:33:19.000000000 +0100
+++ files/patch-eval.c	2007-11-25 23:02:29.000000000 +0100
@@ -0,0 +1,11 @@
+--- eval.c.orig	2007-11-25 23:01:11.000000000 +0100
++++ eval.c	2007-11-25 23:02:20.000000000 +0100
+@@ -798,7 +798,7 @@
+ 	    if( !fstat( h, &st ) &&
+ 		( p = mmap( NULL, st.st_size, PROT_READ | PROT_WRITE,
+ 			    MAP_PRIVATE, h, 0 ) ) ) {
+-		( (float *) p ) += 2; /* skip magic number and version */
++		p += 2; /* skip magic number and version */
+ 		fReadWeights =
+ 		    ( p = NeuralNetCreateDirect( &nnContact, p ) ) &&
+ 		    ( p = NeuralNetCreateDirect( &nnRace, p ) ) &&
--- /dev/null	2007-11-25 23:33:19.000000000 +0100
+++ files/patch-htmlimages.c	2007-11-25 23:07:48.000000000 +0100
@@ -0,0 +1,10 @@
+--- htmlimages.c.orig	2007-11-25 23:07:11.000000000 +0100
++++ htmlimages.c	2007-11-25 23:07:24.000000000 +0100
+@@ -30,6 +30,7 @@
+ #endif
+ 
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+ 
+ #if HAVE_SYS_TYPES_H
--- /dev/null	2007-11-25 23:33:19.000000000 +0100
+++ files/patch-lib_neuralnet.c	2007-11-25 23:00:49.000000000 +0100
@@ -0,0 +1,46 @@
+--- lib/neuralnet.c.orig	2007-11-25 22:55:20.000000000 +0100
++++ lib/neuralnet.c	2007-11-25 23:00:22.000000000 +0100
+@@ -384,15 +384,17 @@
+ 
+     return 0;
+ }
+-extern void *NeuralNetCreateDirect( neuralnet *pnn, void *p ) {
++extern void *NeuralNetCreateDirect( neuralnet *pnn, void *v_p ) {
++   int *p = v_p;
++   float *fp = v_p;
+  
+    pnn->cInput = *( ( (int *) p )++ );
+    pnn->cHidden = *( ( (int *) p )++ );
+    pnn->cOutput = *( ( (int *) p )++ );
+    pnn->nTrained = *( ( (int *) p )++ );
+    pnn->fDirect = TRUE;
+-   pnn->rBetaHidden = *( ( (float *) p )++ );
+-   pnn->rBetaOutput = *( ( (float *) p )++ );
++   pnn->rBetaHidden = *( ( fp )++ );
++   pnn->rBetaOutput = *( ( fp )++ );
+  
+    if( pnn->cInput < 1 || pnn->cHidden < 1 || pnn->cOutput < 1 ||
+      pnn->nTrained < 0 || pnn->rBetaHidden <= 0.0 ||
+@@ -402,14 +404,14 @@
+      return NULL;
+    }
+  
+-   pnn->arHiddenWeight = p;
+-   ( (float *) p ) += pnn->cInput * pnn->cHidden;
+-   pnn->arOutputWeight = p;
+-   ( (float *) p ) += pnn->cHidden * pnn->cOutput;
+-   pnn->arHiddenThreshold = p;
+-   ( (float *) p ) += pnn->cHidden;
+-   pnn->arOutputThreshold = p;
+-   ( (float *) p ) += pnn->cOutput;
++   pnn->arHiddenWeight = fp;
++   fp += pnn->cInput * pnn->cHidden;
++   pnn->arOutputWeight = fp;
++   fp += pnn->cHidden * pnn->cOutput;
++   pnn->arHiddenThreshold = fp;
++   fp += pnn->cHidden;
++   pnn->arOutputThreshold = fp;
++   fp += pnn->cOutput;
+ 
+    pnn->savedBase = malloc( pnn->cHidden * sizeof( float ) ); 
+    pnn->savedIBase = malloc( pnn->cInput * sizeof( float ) ); 
--- /dev/null	2007-11-25 23:33:19.000000000 +0100
+++ files/patch-rollout.h	2007-11-25 23:06:15.000000000 +0100
@@ -0,0 +1,11 @@
+--- rollout.h.orig	2007-11-25 23:05:53.000000000 +0100
++++ rollout.h	2007-11-25 23:06:00.000000000 +0100
+@@ -59,8 +59,6 @@
+ 
+ } rolloutstat;
+ 
+-extern int nSkip;
+-
+ typedef void
+ (rolloutprogressfunc) ( float arOutput[][ NUM_ROLLOUT_OUTPUTS ],
+                         float arStdDev[][ NUM_ROLLOUT_OUTPUTS ],

--- _gnubg.diff ends here ---



>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->miwi 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sun Nov 25 23:20:05 UTC 2007 
Responsible-Changed-Why:  
miwi@ wants his PRs (via the GNATS Auto Assign Tool) 

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

From: Pietro Cerutti <gahr@gahr.ch>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/118254: [patch] games/gnubg unbreak fix build with GCC
 4.2 + adopt maintainship
Date: Mon, 26 Nov 2007 12:39:43 +0100

 This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
 --------------enig1C6EE653F8F5E752BAC8193B
 Content-Type: text/plain; charset=UTF-8
 Content-Transfer-Encoding: quoted-printable
 
 The patch also fixes build on sparc64:
 
 http://www.gahr.ch/FreeBSD/patches/118254_gnubg.diff
 
 --=20
 Pietro Cerutti
 
 PGP Public Key:
 http://gahr.ch/pgp
 
 
 --------------enig1C6EE653F8F5E752BAC8193B
 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)
 
 iD8DBQFHSrCDwMJqmJVx944RChrGAJ9cPAynYAcjaavhZnm5swK8/Ct5WACcChKD
 ZlTcyPVmwrU6zTK4vad5Oag=
 =moBK
 -----END PGP SIGNATURE-----
 
 --------------enig1C6EE653F8F5E752BAC8193B--
State-Changed-From-To: open->closed 
State-Changed-By: miwi 
State-Changed-When: Tue Nov 27 22:48:50 UTC 2007 
State-Changed-Why:  
Committed. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/118254: commit references a PR
Date: Tue, 27 Nov 2007 22:49:09 +0000 (UTC)

 miwi        2007-11-27 22:49:06 UTC
 
   FreeBSD ports repository
 
   Modified files:
     games/gnubg          Makefile 
   Added files:
     games/gnubg/files    patch-eval.c patch-htmlimages.c 
                          patch-lib_neuralnet.c patch-rollout.h 
   Log:
   - Fixes the build with GCC 4.2
   - Removes warnings
   - Pass maintainship to submitter
   
   PR:             118254
   Submitted by:   Pietro Cerutti <gahr@gahr.ch>
   Approved by:    portmgr (pav)
   
   Revision  Changes    Path
   1.18      +2 -12     ports/games/gnubg/Makefile
   1.1       +11 -0     ports/games/gnubg/files/patch-eval.c (new)
   1.3       +10 -0     ports/games/gnubg/files/patch-htmlimages.c (new)
   1.1       +46 -0     ports/games/gnubg/files/patch-lib_neuralnet.c (new)
   1.1       +11 -0     ports/games/gnubg/files/patch-rollout.h (new)
 _______________________________________________
 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"
 
>Unformatted:
