diff options
-rw-r--r-- | games/gnuchess-book-medium/Makefile | 10 | ||||
-rwxr-xr-x | games/gnuchess-book-medium/files/convert.pl | 32 |
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 "$_"; + } + +} + |