aboutsummaryrefslogtreecommitdiffstats
path: root/games
diff options
context:
space:
mode:
Diffstat (limited to 'games')
-rw-r--r--games/gnuchess/Makefile41
-rw-r--r--games/gnuchess/distinfo6
-rw-r--r--games/gnuchess/files/patch-book.h12
-rw-r--r--games/gnuchess/pkg-plist2
-rw-r--r--games/gnuchess/scripts/create_opening_book.sh19
5 files changed, 73 insertions, 7 deletions
diff --git a/games/gnuchess/Makefile b/games/gnuchess/Makefile
index 589952137c5e..71ac8ef454cd 100644
--- a/games/gnuchess/Makefile
+++ b/games/gnuchess/Makefile
@@ -6,8 +6,7 @@
#
PORTNAME= gnuchess
-PORTVERSION= 5.06
-PORTREVISION= 1
+PORTVERSION= 5.07
CATEGORIES= games
MASTER_SITES= ${MASTER_SITE_GNU}
MASTER_SITE_SUBDIR= chess
@@ -15,6 +14,26 @@ MASTER_SITE_SUBDIR= chess
MAINTAINER= ports@FreeBSD.org
COMMENT= "Classic" Gnu Chess
+PLIST_FILES= bin/gnuchess \
+ bin/gnuchessx
+
+.if !defined(NOPORTDOCS)
+PORTDOCS= ChangeLog \
+ NEWS \
+ README
+.endif
+
+OPTIONS= OPENING_BOOK "Install opening book (24 MB download)" on
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_OPENING_BOOK)
+DISTFILES+= book_1.01.pgn.gz
+PLIST_DIRS+= %%DATADIR%%
+PLIST_FILES+= %%DATADIR%%/book.dat
+EXTRACT_ONLY= ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}
+.endif
+
USE_REINPLACE= yes
GNU_CONFIGURE= yes
CONFIGURE_TARGET= --build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
@@ -24,7 +43,23 @@ post-patch:
@${REINPLACE_CMD} -e 's|-D_THREAD_SAFE|${PTHREAD_CFLAGS:S/"//g}|g ; \
s|-pthread ||g' ${WRKSRC}/configure
+pre-install:
+.if defined(WITH_OPENING_BOOK)
+ @scripts/create_opening_book.sh ${DISTDIR} ${WRKSRC}
+.endif
+
post-install:
${LN} -f ${PREFIX}/bin/gnuchess ${PREFIX}/bin/gnuchessx
+.if defined(WITH_OPENING_BOOK)
+ @${ECHO_CMD} Installing opening book
+ ${MKDIR} ${DATADIR} && \
+ ${CP} ${WRKSRC}/src/book.dat ${DATADIR}
+.endif
+.if !defined(NOPORTDOCS)
+ @${ECHO_CMD} Installing documentation
+ ${MKDIR} ${DOCSDIR} && \
+ ${CP} ${WRKSRC}/NEWS ${DOCSDIR} && \
+ ${CP} ${WRKSRC}/doc/* ${DOCSDIR}
+.endif
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/games/gnuchess/distinfo b/games/gnuchess/distinfo
index c20e15762ac7..78ae4ce8f0a7 100644
--- a/games/gnuchess/distinfo
+++ b/games/gnuchess/distinfo
@@ -1,2 +1,4 @@
-MD5 (gnuchess-5.06.tar.gz) = 9b25c80bef39e6ab24088dcfdea7d845
-SIZE (gnuchess-5.06.tar.gz) = 212829
+MD5 (gnuchess-5.07.tar.gz) = 259da00aa559e5624c65279484fccaf7
+SIZE (gnuchess-5.07.tar.gz) = 234542
+MD5 (book_1.01.pgn.gz) = 1be508d7a38a8c9a7d599d0cd92b24a6
+SIZE (book_1.01.pgn.gz) = 26070544
diff --git a/games/gnuchess/files/patch-book.h b/games/gnuchess/files/patch-book.h
new file mode 100644
index 000000000000..1c2d6666c16e
--- /dev/null
+++ b/games/gnuchess/files/patch-book.h
@@ -0,0 +1,12 @@
+--- src/book.h.orig Fri Nov 26 19:20:29 2004
++++ src/book.h Fri Nov 26 19:21:15 2004
+@@ -31,8 +31,7 @@
+ */
+ static char const * bookbin[] = {
+ "book.dat",
+- "/usr/share/games/gnuchess/book.dat",
+- "/usr/lib/games/gnuchess/book.dat",
++ "/usr/local/share/gnuchess/book.dat",
+ NULL
+ };
+
diff --git a/games/gnuchess/pkg-plist b/games/gnuchess/pkg-plist
deleted file mode 100644
index a8ff2db3b6ec..000000000000
--- a/games/gnuchess/pkg-plist
+++ /dev/null
@@ -1,2 +0,0 @@
-bin/gnuchess
-bin/gnuchessx
diff --git a/games/gnuchess/scripts/create_opening_book.sh b/games/gnuchess/scripts/create_opening_book.sh
new file mode 100644
index 000000000000..39d4aff2d097
--- /dev/null
+++ b/games/gnuchess/scripts/create_opening_book.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+DISTDIR=$1
+WRKSRC=$2
+
+[ -f ${WRKSRC}/src/book.dat ] && exit 0
+
+builtin echo -e "\nCreating opening book for gnuchess...\n"
+
+cp ${DISTDIR}/book_1.01.pgn.gz ${WRKSRC}/src/book.pgn.gz
+
+cd ${WRKSRC}/src && gunzip -f book.pgn.gz
+
+./gnuchess << END
+book add book.pgn
+quit
+END
+
+[ $? = 0 ] && builtin echo -e "\nBook successfully created!\n"