summaryrefslogtreecommitdiff
path: root/games/gnuchess-book-medium
diff options
context:
space:
mode:
authorjmc <jmc@pkgsrc.org>2003-03-08 06:10:47 +0000
committerjmc <jmc@pkgsrc.org>2003-03-08 06:10:47 +0000
commit7c0484f2eca572058eb7ef79462135d2e90140bd (patch)
tree5a53e102b3e3d5734a9c56780e6cd5f6d73dfe42 /games/gnuchess-book-medium
parentf993a8fa26f9df50484fa81c6c3c263ecf22c386 (diff)
downloadpkgsrc-7c0484f2eca572058eb7ef79462135d2e90140bd.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/gnuchess-book-medium')
-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 "$_";
+ }
+
+}
+