Portfile

# $Id: Portfile 19359 2006-08-31 19:00:00Z pmq@macports.org $

PortSystem 1.0

name crafty
categories games
version 20.14
platforms darwin
maintainers pmq@macports.org
description Crafty is a chess program, that can be interfaced with xboard.

long_description \
Crafty is the derivative of Cray Blitz, a computer chess program. It is \
a very strong one, and its current peak ICC ratings are 3286 (bullet), \
3388 (blitz) and 2792 (standard). It can be used with xboard just like \
gnuchess.

homepage http://www.cis.uab.edu/hyatt/hyatt.html
master_sites ftp://ftp.cis.uab.edu/pub/hyatt/source:src \
ftp://ftp.cis.uab.edu/pub/hyatt/documentation:doc \
ftp://ftp.cis.uab.edu/pub/hyatt/book:book

set dist_srczip ${name}-${version}.zip
set dist_book1 book.bin
set dist_book2 bookc.bin
set dist_book3 books.bin
set dist_ascii ${name}.doc.ascii
set dist_ps ${name}.doc.ps
set dist_man ${name}.man
dist_subdir ${name}/${version}

distfiles ${dist_srczip}:src \
${dist_book1}:book \
${dist_book2}:book \
${dist_book3}:book \
${dist_ascii}:doc \
${dist_ps}:doc \
${dist_man}:doc

checksums ${dist_srczip} md5 ab681d84fc2f01ce0789cf4f47c945f8 \
${dist_book1} md5 75385ddfdc5469164e8ccaeca20210e1 \
${dist_book2} md5 5c8cc8db3ea8a3abd762a7d4247221ad \
${dist_book3} md5 7b3a55d563724701eff7b182c3714c6d \
${dist_ascii} md5 5fd73027a1de1674763562e1987197ba \
${dist_ps} md5 6cef69aa2f9ea1ceb74b6c14edc8291f \
${dist_man} md5 26163f4048f3ca05a1f6a1a2fb64525f

depends_build bin:unzip:unzip

extract {
file mkdir work

# extract the src zip
system "cd ${workpath} && unzip ${distpath}/${dist_srczip}"
}

use_configure no

build.target darwin
# in a next version, point crafty to the default location for books
# for the moment use the classic bookpath switch when launching it
# should you want to use endgame tables, put them into the TBDIR
# build.args -DBOOKDIR=${prefix}/share/${name}/ \
# -DTBDIR=${prefix}/share/${name}/TB/

destroot {
# copy the executable
xinstall -m 755 -d ${destroot}/${prefix}/bin
file copy ${worksrcpath}/${name} ${destroot}/${prefix}/bin/

# copy the book files
xinstall -m 755 -d ${destroot}/${prefix}/share/${name}
file copy ${distpath}/${dist_book1} \
${distpath}/${dist_book2} \
${distpath}/${dist_book3} \
${destroot}/${prefix}/share/${name}/

# copy the docs
xinstall -m 755 -d ${destroot}/${prefix}/share/doc/${name}
file copy ${distpath}/${dist_ascii} \
${distpath}/${dist_ps} \
${destroot}/${prefix}/share/doc/${name}

# copy the manpage, renaming the extension
file copy ${distpath}/${dist_man} \
${destroot}/${prefix}/share/man/man1/${name}.1
}