Sun Aug 17 21:00:20 2008 UTC ()
Fix some 64-bit issues and a y2038 bug I noticed in passing.
Also, round size of shmget() requests to be page-aligned; at least on
amd64 -current this seems to be required to run at all.
PKGREVISION++.


(dholland)
diff -r1.42 -r1.43 pkgsrc/games/crafty/Makefile
diff -r1.13 -r1.14 pkgsrc/games/crafty/distinfo
diff -r0 -r1.6 pkgsrc/games/crafty/patches/patch-ab
diff -r0 -r1.6 pkgsrc/games/crafty/patches/patch-ac
diff -r0 -r1.3 pkgsrc/games/crafty/patches/patch-ad

cvs diff -r1.42 -r1.43 pkgsrc/games/crafty/Attic/Makefile (expand / switch to unified diff)

--- pkgsrc/games/crafty/Attic/Makefile 2008/05/25 15:55:27 1.42
+++ pkgsrc/games/crafty/Attic/Makefile 2008/08/17 21:00:20 1.43
@@ -1,16 +1,17 @@ @@ -1,16 +1,17 @@
1# $NetBSD: Makefile,v 1.42 2008/05/25 15:55:27 joerg Exp $ 1# $NetBSD: Makefile,v 1.43 2008/08/17 21:00:20 dholland Exp $
2 2
3DISTNAME= crafty-22.1 3DISTNAME= crafty-22.1
 4PKGREVISION= 1
4CATEGORIES= games 5CATEGORIES= games
5MASTER_SITES= ftp://ftp.cis.uab.edu/pub/hyatt/source/ \ 6MASTER_SITES= ftp://ftp.cis.uab.edu/pub/hyatt/source/ \
6 http://www.craftychess.com/ 7 http://www.craftychess.com/
7EXTRACT_SUFX= .zip 8EXTRACT_SUFX= .zip
8 9
9MAINTAINER= pkgsrc-users@NetBSD.org 10MAINTAINER= pkgsrc-users@NetBSD.org
10COMMENT= Chess engine 11COMMENT= Chess engine
11 12
12PKG_DESTDIR_SUPPORT= user-destdir 13PKG_DESTDIR_SUPPORT= user-destdir
13 14
14USE_LANGUAGES= c c++ 15USE_LANGUAGES= c c++
15 16
16.include "../../mk/bsd.prefs.mk" 17.include "../../mk/bsd.prefs.mk"

cvs diff -r1.13 -r1.14 pkgsrc/games/crafty/Attic/distinfo (expand / switch to unified diff)

--- pkgsrc/games/crafty/Attic/distinfo 2008/05/25 15:55:27 1.13
+++ pkgsrc/games/crafty/Attic/distinfo 2008/08/17 21:00:20 1.14
@@ -1,6 +1,9 @@ @@ -1,6 +1,9 @@
1$NetBSD: distinfo,v 1.13 2008/05/25 15:55:27 joerg Exp $ 1$NetBSD: distinfo,v 1.14 2008/08/17 21:00:20 dholland Exp $
2 2
3SHA1 (crafty-22.1.zip) = 4ed19f5c676035b899d82cd254eee3d391cbabbf 3SHA1 (crafty-22.1.zip) = 4ed19f5c676035b899d82cd254eee3d391cbabbf
4RMD160 (crafty-22.1.zip) = 963ec8110617b3d1273953d03ddb974019ec26a9 4RMD160 (crafty-22.1.zip) = 963ec8110617b3d1273953d03ddb974019ec26a9
5Size (crafty-22.1.zip) = 405169 bytes 5Size (crafty-22.1.zip) = 405169 bytes
6SHA1 (patch-aa) = 8efbb76aa23b3972c05dd41cde6b2c5ec8dc49b9 6SHA1 (patch-aa) = 8efbb76aa23b3972c05dd41cde6b2c5ec8dc49b9
 7SHA1 (patch-ab) = 2b926a2ebd8f9ecf125d9f62c6d5f751a52d41a7
 8SHA1 (patch-ac) = 5ea68aa6ef3188ceeaf823be853e6f8c81e320df
 9SHA1 (patch-ad) = 8fff57e2a0df5c81b0c783f5e04b340dcd5b630a

File Added: pkgsrc/games/crafty/patches/Attic/patch-ab
$NetBSD: patch-ab,v 1.6 2008/08/17 21:00:20 dholland Exp $

--- egtb.cpp~	2008-04-15 18:41:49.000000000 -0400
+++ egtb.cpp	2008-08-17 16:21:19.000000000 -0400
@@ -332,7 +332,7 @@ static void* PvMalloc
     pv = malloc (cb);
     if (NULL == pv)
         {
-        printf ("*** Cannot allocate %d bytes of memory\n", cb);
+        printf ("*** Cannot allocate %zu bytes of memory\n", cb);
         exit (1);
         }
     cbAllocated += cb;
@@ -1268,24 +1268,24 @@ static void VInitEnumerations (void)
     if (fPrint)
         {
         for (pi1 = x_pieceNone; pi1 <= x_pieceQueen; pi1 = (piece) (pi1 + 1))
-            printf ("%c - %d enumerated positions\n", "pPNBRQ"[pi1], rgcSinglePawnPresent[pi1]);
+            printf ("%c - %ld enumerated positions\n", "pPNBRQ"[pi1], rgcSinglePawnPresent[pi1]);
         for (pi1 = x_pieceNone; pi1 <= x_pieceQueen; pi1 = (piece) (pi1 + 1))
             {
             if (0 != rgcSinglePawnless[pi1])
-                printf ("pawnless %c - %d enumerated positions\n", "pPNBRQ"[pi1], rgcSinglePawnless[pi1]);
+                printf ("pawnless %c - %ld enumerated positions\n", "pPNBRQ"[pi1], rgcSinglePawnless[pi1]);
             }
         for (pi1 = x_pieceNone; pi1 <= x_pieceQueen; pi1 = (piece) (pi1 + 1))
             for (pi2 = x_pieceNone; pi2 <= pi1; pi2 = (piece) (pi2 + 1))
                 {
                 if (0 != rgcPairPawnPresent[pi1][pi2])
-                    printf ("%c%c - %d enumerated positions\n", "pPNBRQ"[pi1], "pPNBRQ"[pi2],
+                    printf ("%c%c - %ld enumerated positions\n", "pPNBRQ"[pi1], "pPNBRQ"[pi2],
                             rgcPairPawnPresent[pi1][pi2]);
                 }
         for (pi1 = x_pieceNone; pi1 <= x_pieceQueen; pi1 = (piece) (pi1 + 1))
             for (pi2 = x_pieceNone; pi2 <= pi1; pi2 = (piece) (pi2 + 1))
                 {
                 if (0 != rgcPairPawnless[pi1][pi2])
-                    printf ("pawnless %c%c - %d enumerated positions\n", "pPNBRQ"[pi1], "pPNBRQ"[pi2],
+                    printf ("pawnless %c%c - %ld enumerated positions\n", "pPNBRQ"[pi1], "pPNBRQ"[pi2],
                             rgcPairPawnless[pi1][pi2]);
                 }
 #if defined (T41_INCLUDE) || defined (T42_INCLUDE)
@@ -1294,7 +1294,7 @@ static void VInitEnumerations (void)
                 for (pi3 = x_pieceNone; pi3 <= pi2; pi3 = (piece) (pi3 + 1))
                     {
                     if (0 != rgcTriplePawnPresent[pi1][pi2][pi3])
-                        printf ("%c%c%c - %d enumerated positions\n",
+                        printf ("%c%c%c - %ld enumerated positions\n",
                                 "pPNBRQ"[pi1], "pPNBRQ"[pi2], "pPNBRQ"[pi3],
                                 rgcTriplePawnPresent[pi1][pi2][pi3]);
                     }
@@ -1303,12 +1303,12 @@ static void VInitEnumerations (void)
                 for (pi3 = x_pieceNone; pi3 <= pi2; pi3 = (piece) (pi3 + 1))
                     {
                     if (0 != rgcTriplePawnless[pi1][pi2][pi3])
-                        printf ("pawnless %c%c%c - %d enumerated positions\n",
+                        printf ("pawnless %c%c%c - %ld enumerated positions\n",
                                 "pPNBRQ"[pi1], "pPNBRQ"[pi2], "pPNBRQ"[pi3],
                                 rgcTriplePawnless[pi1][pi2][pi3]);
                     }
 #endif
-        printf ("\nAllocated %dk\n\n", (cbAllocated + 1023)/1024);
+        printf ("\nAllocated %zuk\n\n", (cbAllocated + 1023)/1024);
         }
     }
 

File Added: pkgsrc/games/crafty/patches/Attic/patch-ac
$NetBSD: patch-ac,v 1.6 2008/08/17 21:00:20 dholland Exp $

--- option.c~	2008-04-15 18:41:49.000000000 -0400
+++ option.c	2008-08-17 16:23:39.000000000 -0400
@@ -3025,7 +3025,7 @@ int Option(TREE * RESTRICT tree)
 
     output_file = stdout;
     secs = time(0);
-    timestruct = localtime((time_t *) & secs);
+    timestruct = localtime(& secs);
     if (nargs > 1) {
       if (!(output_file = fopen(args[1], "w"))) {
         printf("unable to open %s for write.\n", args[1]);
@@ -3548,10 +3548,10 @@ int Option(TREE * RESTRICT tree)
  */
   else if (OptionMatch("tags", *args)) {
     struct tm *timestruct;
-    long secs;
+    time_t secs;
 
     secs = time(0);
-    timestruct = localtime((time_t *) & secs);
+    timestruct = localtime(& secs);
     printf("[Event \"%s\"]\n", pgn_event);
     printf("[Site \"%s\"]\n", pgn_site);
     printf("[Date \"%4d.%02d.%02d\"]\n", timestruct->tm_year + 1900,

File Added: pkgsrc/games/crafty/patches/Attic/patch-ad
$NetBSD: patch-ad,v 1.3 2008/08/17 21:00:20 dholland Exp $

--- utility.c.orig	2008-04-15 18:41:49.000000000 -0400
+++ utility.c	2008-08-17 16:41:20.000000000 -0400
@@ -2788,6 +2788,15 @@
 #if defined(UNIX)
   int shmid;
   void *shared;
+  long pagesize;
+
+  /* round to page boundary */
+  pagesize = sysconf(_SC_PAGESIZE);
+  if (pagesize == -1) {
+     /* just in case, guess */
+     pagesize = 4096;
+  }
+  size = size + pagesize - (size % pagesize);
 
   shmid = shmget(IPC_PRIVATE, size, (IPC_CREAT | 0600));
   if (shmid < 0) {