From gahr@gahr.ch  Thu Nov 29 23:08:15 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 D6B4E16A41B
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 29 Nov 2007 23:08:15 +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 62A3B13C448
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 29 Nov 2007 23:08:15 +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 1IxsV8-0003Qa-BL
	for FreeBSD-gnats-submit@freebsd.org; Fri, 30 Nov 2007 00:08:58 +0100
Received: from gahrtop.localhost (localhost [127.0.0.1])
	by gahrtop.localhost (Postfix) with ESMTP id 94F6F73063
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 30 Nov 2007 00:07:02 +0100 (CET)
Message-Id: <1196377622.41182@gahrtop.localhost>
Date: Fri, 30 Nov 2007 00:07:02 +0100
From: "Pietro Cerutti" <gahr@gahr.ch>
To: "FreeBSD gnats submit" <FreeBSD-gnats-submit@freebsd.org>
Subject: [patch] games/deal fix build + adopt maintainship -- test for ia64 needed!
X-Send-Pr-Version: gtk-send-pr 0.4.8 
X-GNATS-Notify:

>Number:         118340
>Category:       ports
>Synopsis:       [patch] games/deal fix build + adopt maintainship -- test for ia64 needed!
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    miwi
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 29 23:10:01 UTC 2007
>Closed-Date:    Fri Nov 30 12:35:53 UTC 2007
>Last-Modified:  Fri Nov 30 12:40:01 UTC 2007
>Originator:     Pietro Cerutti
>Release:        FreeBSD 8.0-CURRENT i386
>Organization:
>Environment:


System: FreeBSD 8.0-CURRENT #13: Sun Nov 25 22:03:04 CET 2007
    root@gahrtop.localhost:/usr/obj/usr/src/sys/MSI1034



>Description:


The following patch:

- fixes the build process through the port's Makefile
- fixes some code (type mismatches, undefined behaviour, obsolescent features, ...)
- adoptes maintainship

CFT!
I think it should build on ia64, but I can't test it myself! Any feedback is welcome!


>How-To-Repeat:





>Fix:


--- _deal.diff begins here ---
--- Makefile.orig	2007-11-29 23:30:25.000000000 +0100
+++ Makefile	2007-11-29 23:56:04.000000000 +0100
@@ -10,16 +10,16 @@
 CATEGORIES=	games
 MASTER_SITES=	http://catb.org/~esr/deal/
 
-MAINTAINER=	ports@FreeBSD.org
+MAINTAINER=	gahr@gahr.ch
 COMMENT=	A calculator for card-draw probabilities
 
-ALL_TARGET=	deal
-
 MAN1=		deal.1
 PLIST_FILES=	bin/deal
 
-pre-build:
-	${REINPLACE_CMD} -e "s@-g@${CFLAGS}@g" ${WRKSRC}/Makefile
+CFLAGS+=	-lm
+
+do-build:
+	cd ${WRKSRC} && ${CC} ${CFLAGS} -o deal deal.c
 
 do-install:
 	${INSTALL_PROGRAM} ${WRKSRC}/deal ${PREFIX}/bin
@@ -27,10 +27,6 @@
 
 .include <bsd.port.pre.mk>
 
-.if ${OSVERSION} >= 700029
-BROKEN=		Does not compile
-.endif
-
 .if ${ARCH} == "ia64"
 BROKEN=		Does not compile on ia64
 .endif
--- files/patch-deal.c.orig	2007-11-29 23:55:39.000000000 +0100
+++ files/patch-deal.c	2007-11-30 00:00:34.000000000 +0100
@@ -1,14 +1,17 @@
---- deal.c.orig	Fri Sep 27 00:31:22 1996
-+++ deal.c	Fri Dec 15 01:00:03 2006
-@@ -35,6 +35,7 @@
+--- deal.c.orig	1996-09-27 00:31:22.000000000 +0200
++++ deal.c	2007-11-30 00:00:29.000000000 +0100
+@@ -35,8 +35,10 @@
   * rounds to zero.
   */
  #include <stdio.h>
 +#include <stdlib.h>
  #include <math.h>
  #include <signal.h>
++#include <unistd.h>
  
-@@ -49,6 +50,7 @@
+ #define BASE_DEFAULT	7	/* # cards in initial deal */
+ #define TURNS_DEFAULT	20	/* show this many turns if total is greater */
+@@ -49,6 +51,7 @@
  static int verbose = FALSE;
  
  static double log_a_choose_b(int a, int b);
@@ -16,7 +19,14 @@
  
  static void hypercatch(int sig)
  {
-@@ -80,7 +82,6 @@
+@@ -74,13 +77,12 @@
+     exit(0);
+ }
+ 
+-main(argc, argv)
++int main(argc, argv)
+ int argc;
+ char **argv;
  {
      extern char	*optarg;	/* set by getopt */
      extern int	optind;		/* set by getopt */
@@ -24,3 +34,64 @@
  
      int status, special, total, columns, i, j;
      int base = BASE_DEFAULT;
+@@ -97,11 +99,11 @@
+ 	switch (status)
+ 	{
+ 	case 'b':
+-	    base = atoi(optarg);
++	    base = (int)strtol(optarg, (char **)NULL, 10);
+ 	    break;
+ 
+ 	case 'c':
+-	    columns = atoi(optarg);
++	    columns = (int)strtol(optarg, (char **)NULL, 10);
+ 	    break;
+ 
+ 	case 'G':
+@@ -142,7 +144,7 @@
+     }	
+ 
+     if (gammatest) {
+-	double p = lgamma(atoi(argv[optind]));
++	double p = lgamma(strtod(argv[optind], (char **)NULL));
+ 
+ 	(void) printf("lgamma(%d) = %f\n", atoi(argv[optind]), p);
+ 	exit(0);
+@@ -212,7 +214,7 @@
+ 	(void) printf("\n");
+ 	(void) printf("-----+");
+ 	for (j = 0; j < columns; j++)
+-	    (void) printf(wide ? "----" : "---", j);
++	    (void) printf(wide ? "----" : "---");
+ 	(void) printf("\n");
+     }
+ 
+@@ -239,6 +241,8 @@
+ 
+ 	(void) printf("\n");
+     }
++
++    return (0);
+ }
+ 
+ /* 
+@@ -276,7 +280,8 @@
+     sa = a;
+     sb = b;
+ 
+-    signal(SIGFPE, choosecatch);
++    if(signal(SIGFPE, choosecatch) == SIG_ERR)
++      exit(EXIT_FAILURE);
+ 
+     if (b >= a)
+ 	p = 0;
+@@ -287,7 +292,8 @@
+     if (verbose)
+ 	(void) fprintf(stderr, "log_a_choose_b(%d, %d) = %f\n", a, b, p);
+ 
+-    signal(SIGFPE, hypercatch);
++    if(signal(SIGFPE, hypercatch) == SIG_ERR)
++       exit(EXIT_FAILURE);
+ 
+     return(p);
+ }
--- _deal.diff ends here ---



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

http://www.freebsd.org/cgi/query-pr.cgi?pr=118340 
State-Changed-From-To: open->closed 
State-Changed-By: miwi 
State-Changed-When: Fri Nov 30 12:35:52 UTC 2007 
State-Changed-Why:  
Committed. Thanks! 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/118340: commit references a PR
Date: Fri, 30 Nov 2007 12:35:44 +0000 (UTC)

 miwi        2007-11-30 12:35:36 UTC
 
   FreeBSD ports repository
 
   Modified files:
     games/deal           Makefile 
     games/deal/files     patch-deal.c 
   Log:
   - Fix build with gcc 4.2
   = Pass maintainership to submitter
   
   PR:             118340
   Submitted by:   Pietro Cerutti <gahr@gahr.ch>
   Approved by:    portmgr (pav)
   
   Revision  Changes    Path
   1.12      +5 -9      ports/games/deal/Makefile
   1.2       +76 -5     ports/games/deal/files/patch-deal.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"
 
>Unformatted:
