Skip site navigation (1)Skip section navigation (2)
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:   ports/118254: [patch] games/gnubg unbreak fix build with GCC 4.2 + adopt maintainship
Message-ID:  <1196032704.14013@gahrtop.localhost>
Resent-Message-ID: <200711252320.lAPNK1Gq091438@freefall.freebsd.org>

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

>Number:         118254
>Category:       ports
>Synopsis:       [patch] games/gnubg unbreak fix build with GCC 4.2 + adopt maintainship
>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:   Sun Nov 25 23:20:01 UTC 2007
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



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