the Fink project is an effort to port
popular Unix programs to Mac OS X
Package: sjeng
Version: 11.2
Revision: 1
Maintainer: Matthias Neeracher
BuildDepends: gdbm3
Depends: gdbm3-shlibs
Provides: chess
Source: http://sjeng.sourceforge.net/ftp/Sjeng-Free-%v.tar.gz
Source-MD5: 6561e740b7af703c16701304697d2870
Patch: %n.patch
PatchScript: <<
perl -pi -e 's|/usr/local/(\w+)/sjeng|%p/\1/sjeng|' sjeng.h
perl -pi -e 's|\015||g' AUTHORS BUGS COPYING NEWS README THANKS TODO
<<
InstallScript:<<
make install prefix=%i
/usr/bin/install -d -m 555 %i/lib/sjeng
/usr/bin/install -d -m 777 %i/var/sjeng
/bin/chmod 777 %i/var/sjeng
/usr/bin/install sjeng.rc books/*.opn %i/lib/sjeng
<<
DocFiles: AUTHORS BUGS COPYING NEWS README THANKS TODO
Description: Engine for Chess Variants
DescDetail: <<
Sjeng is a program that can play both regular chess and a number of
variants: crazyhouse, bughouse, suicide, and losers.
<<
DescPort: <<
Patched to read opening books from /sw/lib/sjeng $HOME/lib/sjeng
<<
Homepage: http://sjeng.sourceforge.net
License: GPL
--- Sjeng-Free-11.0/book.c.orig Thu Sep 27 21:13:00 2001
+++ Sjeng-Free-11.0/book.c Thu Sep 27 22:22:17 2001
@@ -38,6 +38,10 @@
#define book_solid 4 /* = */
#define book_murky 5 /* ?! */
+#undef fopen
+#define fopen book_fopen
+FILE * book_fopen(const char * name, const char * mode);
+
int init_book (void) {
/* simply read all the book moves into a book array. The book will be
--- Sjeng-Free-11.0/newbook.c.orig Thu Sep 27 21:25:03 2001
+++ Sjeng-Free-11.0/newbook.c Thu Sep 27 22:29:06 2001
14
if (Variant == Normal)
- binbook = gdbm_open("nbook.bin", 16384, GDBM_READER, 0, NULL);
+ binbook = gdbm_open(SJENG_LIB_PATH "/nbook.bin", 16384, GDBM_READER, 0, NULL);
else if (Variant == Suicide)
- binbook = gdbm_open("sbook.bin", 16384, GDBM_READER, 0, NULL);
+ binbook = gdbm_open(SJENG_LIB_PATH "/sbook.bin", 16384, GDBM_READER, 0, NULL);
else if (Variant == Losers)
- binbook = gdbm_open("lbook.bin", 16384, GDBM_READER, 0, NULL);
+ binbook = gdbm_open(SJENG_LIB_PATH "/lbook.bin", 16384, GDBM_READER, 0, NULL);
else
- binbook = gdbm_open("zbook.bin", 16384, GDBM_READER, 0, NULL);
+ binbook = gdbm_open(SJENG_LIB_PATH "/zbook.bin", 16384, GDBM_READER, 0, NULL);
if (binbook == NULL)
--- Sjeng-Free-11.0/rcfile.c.orig Thu Sep 27 21:36:59 2001
+++ Sjeng-Free-11.0/rcfile.c Thu Sep 27 21:39:42 2001
@@ -47,6 +47,10 @@
int cfg_attackeval;
float cfg_scalefac;
+#undef fopen
+#define fopen book_fopen
+FILE * book_fopen(const char * name, const char * mode);
+
void read_rcfile (void)
{
int i;
--- Sjeng-Free-11.0/sjeng.c.orig Thu Sep 27 22:21:25 2001
+++ Sjeng-Free-11.0/sjeng.c Thu Sep 27 22:39:44 2001
@@ -971,3 +971,26 @@
return 0;
}
+
+#define MAXBOOKPATH 1000
+
+FILE * book_fopen(const char * name, const char * mode)
+{
+ /* We search a couple of different directories */
+ char path[MAXBOOKPATH];
+ FILE * f;
+ const char * home;
+
+ if (f = fopen(name, mode)) /* Current directory */
+ return f;
+ if (home = getenv("HOME"))
+ if (snprintf(path, MAXBOOKPATH, "%s/lib/sjeng/%s", home, name)
+ < MAXBOOKPATH
+ )
+ if (f = fopen(path, mode)) /* ~/lib/sjeng */
+ return f;
+ if (snprintf(path, MAXBOOKPATH, "%s/%s", SJENG_LIB_PATH, name) < MAXBOOKPATH)
+ if (f = fopen(path, mode)) /* $(SJENG_LIB_PATH)/sjeng */
+ return f;
+ return NULL;
+}
--- Sjeng-Free-11.0/sjeng.h.orig Thu Aug 30 07:59:35 2001
+++ Sjeng-Free-11.0/sjeng.h Thu Sep 27 22:38:07 2001
@@ -39,6 +39,8 @@
#define NDEBUG
#include
+#define SJENG_LIB_PATH "/usr/local/lib/sjeng"
+
#define DIE (*(int *)(NULL) = 0)
/* GCP : my code uses WHITE=0 and BLACK=1 so reverse this */
Package: sjeng
Version: 11.2
Revision: 1
Maintainer: Matthias Neeracher
BuildDepends: gdbm3
Depends: gdbm3-shlibs
Provides: chess
Source: http://sjeng.sourceforge.net/ftp/Sjeng-Free-%v.tar.gz
Source-MD5: 6561e740b7af703c16701304697d2870
Patch: %n.patch
PatchScript: <<
perl -pi.bak -e 's|/usr/local/(\w+)/sjeng|%p/\1/sjeng|' sjeng.h
perl -pi.bak -e 's|\015||g' AUTHORS BUGS COPYING NEWS README THANKS TODO
<<
InstallScript:<<
make install prefix=%i
/usr/bin/install -d -m 555 %i/lib/sjeng
/usr/bin/install -d -m 777 %i/var/sjeng
/bin/chmod 777 %i/var/sjeng
/usr/bin/install sjeng.rc books/*.opn %i/lib/sjeng
<<
DocFiles: AUTHORS BUGS COPYING NEWS README THANKS TODO
Description: Engine for Chess Variants
DescDetail: <<
Sjeng is a program that can play both regular chess and a number of
variants: crazyhouse, bughouse, suicide, and losers.
<<
DescPort: <<
Patched to read opening books from /sw/lib/sjeng $HOME/lib/sjeng
<<
Homepage: http://sjeng.sourceforge.net
License: GPL
--- Sjeng-Free-11.0/book.c.orig Thu Sep 27 21:13:00 2001
+++ Sjeng-Free-11.0/book.c Thu Sep 27 22:22:17 2001
@@ -38,6 +38,10 @@
#define book_solid 4 /* = */
#define book_murky 5 /* ?! */
+#undef fopen
+#define fopen book_fopen
+FILE * book_fopen(const char * name, const char * mode);
+
int init_book (void) {
/* simply read all the book moves into a book array. The book will be
--- Sjeng-Free-11.0/newbook.c.orig Thu Sep 27 21:25:03 2001
+++ Sjeng-Free-11.0/newbook.c Thu Sep 27 22:29:06 2001
14
if (Variant == Normal)
- binbook = gdbm_open("nbook.bin", 16384, GDBM_READER, 0, NULL);
+ binbook = gdbm_open(SJENG_LIB_PATH "/nbook.bin", 16384, GDBM_READER, 0, NULL);
else if (Variant == Suicide)
- binbook = gdbm_open("sbook.bin", 16384, GDBM_READER, 0, NULL);
+ binbook = gdbm_open(SJENG_LIB_PATH "/sbook.bin", 16384, GDBM_READER, 0, NULL);
else if (Variant == Losers)
- binbook = gdbm_open("lbook.bin", 16384, GDBM_READER, 0, NULL);
+ binbook = gdbm_open(SJENG_LIB_PATH "/lbook.bin", 16384, GDBM_READER, 0, NULL);
else
- binbook = gdbm_open("zbook.bin", 16384, GDBM_READER, 0, NULL);
+ binbook = gdbm_open(SJENG_LIB_PATH "/zbook.bin", 16384, GDBM_READER, 0, NULL);
if (binbook == NULL)
--- Sjeng-Free-11.0/rcfile.c.orig Thu Sep 27 21:36:59 2001
+++ Sjeng-Free-11.0/rcfile.c Thu Sep 27 21:39:42 2001
@@ -47,6 +47,10 @@
int cfg_attackeval;
float cfg_scalefac;
+#undef fopen
+#define fopen book_fopen
+FILE * book_fopen(const char * name, const char * mode);
+
void read_rcfile (void)
{
int i;
--- Sjeng-Free-11.0/sjeng.c.orig Thu Sep 27 22:21:25 2001
+++ Sjeng-Free-11.0/sjeng.c Thu Sep 27 22:39:44 2001
@@ -971,3 +971,26 @@
return 0;
}
+
+#define MAXBOOKPATH 1000
+
+FILE * book_fopen(const char * name, const char * mode)
+{
+ /* We search a couple of different directories */
+ char path[MAXBOOKPATH];
+ FILE * f;
+ const char * home;
+
+ if (f = fopen(name, mode)) /* Current directory */
+ return f;
+ if (home = getenv("HOME"))
+ if (snprintf(path, MAXBOOKPATH, "%s/lib/sjeng/%s", home, name)
+ < MAXBOOKPATH
+ )
+ if (f = fopen(path, mode)) /* ~/lib/sjeng */
+ return f;
+ if (snprintf(path, MAXBOOKPATH, "%s/%s", SJENG_LIB_PATH, name) < MAXBOOKPATH)
+ if (f = fopen(path, mode)) /* $(SJENG_LIB_PATH)/sjeng */
+ return f;
+ return NULL;
+}
--- Sjeng-Free-11.0/sjeng.h.orig Thu Aug 30 07:59:35 2001
+++ Sjeng-Free-11.0/sjeng.h Thu Sep 27 22:38:07 2001
@@ -39,6 +39,8 @@
#define NDEBUG
#include
+#define SJENG_LIB_PATH "/usr/local/lib/sjeng"
+
#define DIE (*(int *)(NULL) = 0)
/* GCP : my code uses WHITE=0 and BLACK=1 so reverse this */