summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorjmc <jmc>2003-03-08 06:10:47 +0000
committerjmc <jmc>2003-03-08 06:10:47 +0000
commitd36256fc00ba63817ffc758e190f84a97aeab832 (patch)
tree5a53e102b3e3d5734a9c56780e6cd5f6d73dfe42 /games
parent26eddaf08d49ebeb37b30bd91f27530b3038bfad (diff)
downloadpkgsrc-d36256fc00ba63817ffc758e190f84a97aeab832.tar.gz
Make this work correctly. While in the past gnuchess may have appeared to
read/parse this book, in reality it wasn't. It doesn't seem to understand full pgn format and instead uses an abbreviated format (which all the other book packages use as well). It sort of interprets full pgn but gets lots of things wrong. Include a script to convert the book to a proper format and then run gnuchess across that and it seems to find much less errors.
Diffstat (limited to 'games')
-rw-r--r--games/gnuchess-book-medium/Makefile10
-rwxr-xr-xgames/gnuchess-book-medium/files/convert.pl32
2 files changed, 40 insertions, 2 deletions
diff --git a/games/gnuchess-book-medium/Makefile b/games/gnuchess-book-medium/Makefile
index 93512ccc95c..e8f986433c9 100644
--- a/games/gnuchess-book-medium/Makefile
+++ b/games/gnuchess-book-medium/Makefile
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.6 2001/09/27 23:18:07 jlam Exp $
+# $NetBSD: Makefile,v 1.7 2003/03/08 06:10:47 jmc Exp $
DISTNAME= medium
PKGNAME= ${CHESS_ENGINE}-book-${DISTNAME}-20000511
+PKGREVISION= 1
CATEGORIES= games
MASTER_SITES= ftp://ftp.cis.uab.edu/pub/hyatt/common/${DISTNAME}/
EXTRACT_SUFX= .zip
@@ -17,22 +18,27 @@ CHESS_ENGINE= gnuchess
DIST_SUBDIR= chessbooks
WRKSRC= ${WRKDIR}
NO_CONFIGURE= # defined
+USE_PERL5= build
+USE_BUILDLINK2= YES
PLIST_SUBST+= CHESS_ENGINE=${CHESS_ENGINE}
PLIST_SUBST+= BOOK_FILE=${BOOK_FILE}
BOOKDIR= ${PREFIX}/lib/${CHESS_ENGINE}
PGN_FILE= book.txt
+PGN_CONVERTED_FILE= book_pgn.txt
BOOK_FILE= book.dat
do-build:
@${ECHO} ""
@${ECHO} " ** Go to bed! This will take _very_ long!"
@${ECHO} ""
- cd ${WRKSRC} && gnuchess compile ${PGN_FILE} ${BOOK_FILE}
+ ${PREFIX}/bin/perl ${PKGDIR}/files/convert.pl < ${WRKSRC}/${PGN_FILE} > ${WRKSRC}/${PGN_CONVERTED_FILE}
+ cd ${WRKSRC} && gnuchess compile ${PGN_CONVERTED_FILE} ${BOOK_FILE}
do-install:
${INSTALL_DATA_DIR} ${BOOKDIR}
${INSTALL_DATA} ${WRKSRC}/${BOOK_FILE} ${BOOKDIR}
+.include "../../lang/perl5/buildlink2.mk"
.include "../../mk/bsd.pkg.mk"
diff --git a/games/gnuchess-book-medium/files/convert.pl b/games/gnuchess-book-medium/files/convert.pl
new file mode 100755
index 00000000000..b577d0d938e
--- /dev/null
+++ b/games/gnuchess-book-medium/files/convert.pl
@@ -0,0 +1,32 @@
+#!${PREFIX}/bin/perl
+
+while (<STDIN>) {
+
+ /^\[Site/ && print $_;
+
+ /^\[/ && next;
+ /^$/ && next;
+
+ $_ =~ s/[0-9]+\.//g;
+ $_ =~ s/0-1//g;
+ $_ =~ s/1-0//g;
+ $_ =~ s/1\/2-1\/2//g;
+ $_ =~ s/^ +//g;
+ $_ =~ s/ +/ /g;
+ /^$/ && next;
+ print "$_";
+
+ while (<STDIN>) {
+ /^$/ && last;
+ $_ =~ s/[0-9]+\.//g;
+ $_ =~ s/0-1//g;
+ $_ =~ s/1-0//g;
+ $_ =~ s/1\/2-1\/2//g;
+ $_ =~ s/^ +//g;
+ $_ =~ s/ +/ /g;
+ /^$/ && next;
+ print "$_";
+ }
+
+}
+