crafty stable port information

Package: crafty
Version: 20.14
Revision: 1001
GCC: 4.0
Provides: chess
Replaces: crafty-smallbook, crafty-largebook, crafty-enormousbook
Source: ftp://ftp.cis.uab.edu/pub/hyatt/source/%n-%v.zip
Source-MD5: ab681d84fc2f01ce0789cf4f47c945f8
Source2: ftp://ftp.cis.uab.edu/pub/hyatt/documentation/crafty.doc.ascii
Source2-MD5: 5fd73027a1de1674763562e1987197ba
Source3: ftp://ftp.cis.uab.edu/pub/hyatt/documentation/crafty.doc.ps
Source3-MD5: 6cef69aa2f9ea1ceb74b6c14edc8291f
Source4: http://ftp.nl.freebsd.org/os/FreeBSD/distfiles/crafty/medium.zip
Source4-MD5: 6b4a61d15029811d7cdc34d6adae7a17
Source5: ftp://ftp.cis.uab.edu/pub/hyatt/pgn/start.pgn.gz
Source5-MD5: c3c54b29351408298e3c7548f4faed93
BuildDepends: fink (>= 0.24.12)
PatchFile: %n.patch
PatchFile-MD5: 4398b7ac519f1322a2c6033b512bda56
PatchScript: <<
patch -p1 <%{PatchFile}
perl -ne 'print if /\Q*****\E/..m|\Q*/\E|;' main.c>README
gunzip ../start.pgn.gz
<<
CompileScript: <<
make darwin prefix=%p opt="-DBOOKDIR=\\\"%p/lib/crafty\\\" -DTBDIR=\\\"%p/lib/crafty/TB\\\""
echo "books create ../start.pgn 60" | ./crafty
echo "book create ../book.txt 60 2 50" | ./crafty
<<
InstallScript: <<
mkdir -p %i/bin
mkdir -p %i/lib/crafty/TB
/usr/bin/install -c crafty %i/bin
/usr/bin/install -c -m 444 book.bin books.bin %i/lib/crafty
chmod a+w %i/lib/crafty/book.bin
mkdir -p %i/share/doc/%n
cp ../crafty.doc.ascii ../crafty.doc.ps %i/share/doc/%n
<<
DocFiles: README
Description: Strong Chess Engine
DescDetail: <<
Crafty is a chess engine that allows you to play chess either via the console
or through XBoard.
<<
DescPort: <<
Patched to get its opening books from /sw/lib/crafty by default. Note that
crafty learns by writing into its books, so having a global copy might have
disadvantages.
<<
License: Restrictive/Distributable
Maintainer: Matthias Neeracher
Homepage: ftp://ftp.cis.uab.edu/pub/hyatt/

crafty stable port .patch

diff -ru crafty-20.14-orig/chess.h crafty-20.14/chess.h
--- crafty-20.14-orig/chess.h 2007-03-23 21:46:15.000000000 -0700
+++ crafty-20.14/chess.h 2007-03-23 21:53:36.000000000 -0700
@@ -136,6 +136,9 @@
#if !defined(PERSDIR)
# define PERSDIR "."
#endif
+#if !defined(LEARNDIR)
+# define LEARNDIR "."
+#endif
#if !defined(LOGDIR)
# define LOGDIR "."
#endif
Only in crafty-20.14: chess.h.orig
diff -ru crafty-20.14-orig/data.c crafty-20.14/data.c
--- crafty-20.14-orig/data.c 2007-03-23 21:46:15.000000000 -0700
+++ crafty-20.14/data.c 2007-03-23 21:53:36.000000000 -0700
@@ -209,6 +209,7 @@
int new_game = 0;
char channel_title[32] = { "" };
char book_path[128] = { BOOKDIR };
+char learn_path[128] = { LEARNDIR };
char personality_path[128] = { PERSDIR };
char log_path[128] = { LOGDIR };
char tb_path[128] = { TBDIR };
Only in crafty-20.14: data.c.orig
diff -ru crafty-20.14-orig/data.h crafty-20.14/data.h
--- crafty-20.14-orig/data.h 2007-03-23 21:46:15.000000000 -0700
+++ crafty-20.14/data.h 2007-03-23 21:53:36.000000000 -0700
@@ -90,6 +90,7 @@
extern int channel;
extern char channel_title[32];
extern char book_path[128];
+extern char learn_path[128];
extern char personality_path[128];
extern char log_path[128];
extern char tb_path[128];
Only in crafty-20.14: data.h.orig
diff -ru crafty-20.14-orig/init.c crafty-20.14/init.c
--- crafty-20.14-orig/init.c 2007-03-23 21:46:15.000000000 -0700
+++ crafty-20.14/init.c 2007-03-23 21:53:36.000000000 -0700
@@ -173,15 +173,15 @@
books_file = 0;
}
}
- sprintf(log_filename, "%s/book.lrn", book_path);
+ sprintf(log_filename, "%s/book.lrn", learn_path);
book_lrn_file = fopen(log_filename, "a");
if (!book_lrn_file) {
- Print(128, "unable to open book learning file [%s/book.lrn].\n", book_path);
+ Print(128, "unable to open book learning file [%s/book.lrn].\n", learn_path);
Print(128, "learning disabled.\n");
learning &= ~(book_learning + result_learning);
}
if (learning & position_learning) {
- sprintf(log_filename, "%s/position.bin", book_path);
+ sprintf(log_filename, "%s/position.bin", learn_path);
position_file = fopen(log_filename, "rb+");
if (position_file) {
fseek(position_file, 0, SEEK_END);
@@ -199,12 +199,12 @@
fwrite(&i, sizeof(int), 1, position_file);
} else {
Print(128, "unable to open position learning file [%s/position.bin].\n",
- book_path);
+ learn_path);
Print(128, "learning disabled.\n");
learning &= ~position_learning;
}
}
- sprintf(log_filename, "%s/position.lrn", book_path);
+ sprintf(log_filename, "%s/position.lrn", learn_path);
position_lrn_file = fopen(log_filename, "r");
if (!position_lrn_file) {
position_lrn_file = fopen(log_filename, "a");
@@ -212,7 +212,7 @@
fprintf(position_lrn_file, "position\n");
else {
Print(128, "unable to open position learning file [%s/position.bin].\n",
- book_path);
+ learn_path);
Print(128, "learning disabled.\n");
learning &= ~position_learning;
}
diff -ru crafty-20.14-orig/learn.c crafty-20.14/learn.c
--- crafty-20.14-orig/learn.c 2007-03-23 21:46:15.000000000 -0700
+++ crafty-20.14/learn.c 2007-03-23 21:53:36.000000000 -0700
@@ -552,7 +552,7 @@
int index[32768], i, j, cluster;

fclose(book_lrn_file);
- sprintf(text, "%s/book.lrn", book_path);
+ sprintf(text, "%s/book.lrn", learn_path);
book_lrn_file = fopen(text, "w");
fseek(book_file, 0, SEEK_SET);
for (i = 0; i < 32768; i++) {
@@ -905,15 +905,15 @@
}
if (nargs > 1 && !strcmp(args[1], "clear")) {
fclose(position_file);
- sprintf(text, "%s/position.lrn", book_path);
+ sprintf(text, "%s/position.lrn", learn_path);
position_lrn_file = fopen(text, "w");
if (!position_lrn_file) {
printf("unable to open position learning file [%s/position.lrn].\n",
- book_path);
+ learn_path);
return;
}
fprintf(position_lrn_file, "position\n");
- sprintf(text, "%s/position.bin", book_path);
+ sprintf(text, "%s/position.bin", learn_path);
position_file = fopen(text, "wb+");
if (position_file) {
i = 0;
@@ -923,7 +923,7 @@
fwrite(&i, sizeof(int), 1, position_file);
} else {
printf("unable to open position learning file [%s/position.bin].\n",
- book_path);
+ learn_path);
return;
}
}
Only in crafty-20.14: learn.c.orig
diff -ru crafty-20.14-orig/main.c crafty-20.14/main.c
--- crafty-20.14-orig/main.c 2007-03-23 21:46:15.000000000 -0700
+++ crafty-20.14/main.c 2007-03-23 21:53:36.000000000 -0700
@@ -3414,6 +3414,9 @@
shared = SharedMalloc(sizeof(SHARED), 0);
if (directory_spec)
strncpy(book_path, directory_spec, sizeof book_path);
+ directory_spec = getenv("CRAFTY_LEARN_PATH");
+ if (directory_spec)
+ strncpy(learn_path, directory_spec, sizeof learn_path);
directory_spec = getenv("CRAFTY_LOG_PATH");
if (directory_spec)
strncpy(log_path, directory_spec, sizeof log_path);
Only in crafty-20.14: main.c.orig
diff -ru crafty-20.14-orig/option.c crafty-20.14/option.c
--- crafty-20.14-orig/option.c 2007-03-23 21:46:15.000000000 -0700
+++ crafty-20.14/option.c 2007-03-23 21:53:36.000000000 -0700
@@ -2326,19 +2326,21 @@
************************************************************
*/
else if (OptionMatch("logpath", *args) || OptionMatch("perspath", *args)
- || OptionMatch("bookpath", *args) || OptionMatch("tbpath", *args)) {
+ || OptionMatch("bookpath", *args) || OptionMatch("learnpath", *args) || OptionMatch("tbpath", *args)) {
if (OptionMatch("logpath", *args) || OptionMatch("bookpath", *args)) {
if (log_file)
Print(4095, "ERROR -- this must be used on command line only\n");
}
nargs = ReadParse(buffer, args, " =");
if (nargs < 2) {
- printf("usage: bookpath|perspath|logpath|tbpath \n");
+ printf("usage: bookpath|learnpath|perspath|logpath|tbpath \n");
return (1);
}
if (!strchr(args[1], '(')) {
if (strstr(args[0], "bookpath"))
strcpy(book_path, args[1]);
+ else if (strstr(args[0], "learnpath"))
+ strcpy(learn_path, args[1]);
else if (strstr(args[0], "perspath"))
strcpy(personality_path, args[1]);
else if (strstr(args[0], "logpath"))

crafty _unstable_ port information

Package: crafty
Version: 23.4
Revision: 1
GCC: 4.0
Provides: chess
Replaces: crafty-smallbook, crafty-largebook, crafty-enormousbook
Source: ftp://ftp.cis.uab.edu/pub/hyatt/source/%n-%v.zip
Source-MD5: 7e0811dd2d801428d8da48a4e487885a
Source2: ftp://ftp.cis.uab.edu/pub/hyatt/documentation/crafty.doc.ascii
Source2-MD5: 5fd73027a1de1674763562e1987197ba
Source3: ftp://ftp.cis.uab.edu/pub/hyatt/documentation/crafty.doc.ps
Source3-MD5: 6cef69aa2f9ea1ceb74b6c14edc8291f
Source4: http://ftp.nl.freebsd.org/os/FreeBSD/distfiles/crafty/medium.zip
Source4-MD5: 6b4a61d15029811d7cdc34d6adae7a17
Source5: ftp://ftp.cis.uab.edu/pub/hyatt/pgn/start.pgn
Source5-MD5: 98176af8ec13945a4ec60ad9b5959412
BuildDepends: fink (>= 0.24.12)
PatchFile: %n.patch
PatchFile-MD5: 811fbc98fe4614daa69a9911c17e2282
PatchScript: <<
patch -p1 <%{PatchFile}
perl -ne 'print if /\Q*****\E/..m|\Q*/\E|;' main.c>README
<<
CompileScript: <<
#!
ARCH=`uname -p | perl -pe 'if (/p\w+c/) { $_ = "-arch ppc -arch ppc64"; } else { $_ = "-arch i386 -arch x86_64"; }'`
CPUS=-DCPUS=8
make darwin ARCH="$ARCH" CPUS=$CPUS prefix=%p opt="-DBOOKDIR=\\\"%p/lib/crafty\\\" -DTBDIR=\\\"%p/lib/crafty/TB\\\""
echo "books create ../start.pgn 60" | ./crafty
echo "book create ../book.txt 60 2 50" | ./crafty
<<
InstallScript: <<
mkdir -p %i/bin
mkdir -p %i/lib/crafty/TB
/usr/bin/install -c crafty %i/bin
/usr/bin/install -c -m 444 book.bin books.bin crafty.hlp %i/lib/crafty
chmod a+w %i/lib/crafty/book.bin
mkdir -p %i/share/doc/%n
cp ../crafty.doc.ascii ../crafty.doc.ps %i/share/doc/%n
<<
DocFiles: README
Description: Strong Chess Engine
DescDetail: <<
Crafty is a chess engine that allows you to play chess either via the console
or through XBoard.
<<
DescPort: <<
Patched to get its opening books from /sw/lib/crafty by default. Note that
crafty learns by writing into its books, so having a global copy might have
disadvantages.
<<
License: Restrictive/Distributable
Maintainer: Matthias Neeracher
Homepage: ftp://ftp.cis.uab.edu/pub/hyatt/

crafty _unstable_ port .patch

diff -ru crafty-23.4-orig/Makefile crafty-23.4/Makefile
--- crafty-23.4-orig/Makefile 2011-04-25 21:07:29.000000000 +0200
+++ crafty-23.4/Makefile 2011-04-25 21:10:07.000000000 +0200
@@ -66,9 +66,9 @@
darwin:
$(MAKE) target=FreeBSD \
CC=gcc CXX=g++ \
- CFLAGS='-Wall -pipe -O3' \
- CXFLAGS='-Wall -pipe -O3' \
- LDFLAGS=$(LDFLAGS) \
+ CFLAGS='$(ARCH) $(CPUS) -Wall -pipe -O3' \
+ CXFLAGS='$(ARCH) $(CPUS) -Wall -pipe -O3' \
+ LDFLAGS='$(LDFLAGS) $(ARCH)' \
LIBS='-lstdc++' \
opt='$(opt)' \
crafty-make
Only in crafty-23.4: Makefile.orig
diff -ru crafty-23.4-orig/chess.h crafty-23.4/chess.h
--- crafty-23.4-orig/chess.h 2011-04-25 21:07:29.000000000 +0200
+++ crafty-23.4/chess.h 2011-04-25 21:13:25.000000000 +0200
@@ -24,7 +24,7 @@
#include
#include
#include
-#if !defined(IPHONE)
+#if !defined(__APPLE__)
# include
#endif
#include
diff -ru crafty-23.4-orig/lock.h crafty-23.4/lock.h
--- crafty-23.4-orig/lock.h 2011-04-25 21:07:29.000000000 +0200
+++ crafty-23.4/lock.h 2011-04-25 21:08:06.000000000 +0200
@@ -49,7 +49,7 @@
* *
*******************************************************************************
*/
-# if defined(POWERPC)
+# if defined(__APPLE__)
/* OS X */
# include
# define lock_t OSSpinLock
diff -ru crafty-23.4-orig/option.c crafty-23.4/option.c
--- crafty-23.4-orig/option.c 2011-04-25 21:07:29.000000000 +0200
+++ crafty-23.4/option.c 2011-04-25 21:08:06.000000000 +0200
@@ -1093,7 +1093,8 @@
char *readstat = (char *) -1;
int lines = 0;

- helpfile = fopen("crafty.hlp", "r");
+ sprintf(log_filename, "%s/crafty.hlp", book_path);
+ helpfile = fopen(log_filename, "r");
if (!helpfile) {
printf("ERROR. Unable to open \"crafty.hlp\" -- help unavailable\n");
return (1);
Only in crafty-23.4: option.c.orig