Skip site navigation (1)Skip section navigation (2)
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:   ports/118340: [patch] games/deal fix build + adopt maintainship -- test for ia64 needed!
Message-ID:  <1196377622.41182@gahrtop.localhost>
Resent-Message-ID: <200711292310.lATNA2Dl009176@freefall.freebsd.org>

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

>Number:         118340
>Category:       ports
>Synopsis:       [patch] games/deal fix build + adopt maintainship -- test for ia64 needed!
>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 Nov 29 23:10:01 UTC 2007
>Closed-Date:
>Last-Modified:
>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:
>Unformatted:



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