summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'games-board/crafty')
-rw-r--r--games-board/crafty/Manifest2
-rw-r--r--games-board/crafty/crafty-24.1.ebuild86
-rw-r--r--games-board/crafty/files/crafty-24.1-numcpus.patch44
-rw-r--r--games-board/crafty/metadata.xml8
4 files changed, 140 insertions, 0 deletions
diff --git a/games-board/crafty/Manifest b/games-board/crafty/Manifest
new file mode 100644
index 000000000000..b895a203a9bf
--- /dev/null
+++ b/games-board/crafty/Manifest
@@ -0,0 +1,2 @@
+DIST crafty-24.1.zip 442680 SHA256 a29d25d9a26a5a958f07a075d1f76f52c12d287ad16ee7aadb224a0dfee40659 SHA512 4d8088aeb683d69e3ea5e01194eb0dc9b957049823c7f8a1f28686e601f9f270b829319083a8b8170016bfda36a42c592a94b4429d7c4f35a6351fd469f16124 WHIRLPOOL c98726bfd1cb042273105525b13c8bd85e99ce9591292be6e63981bb1b08d8447a53eaf5bb476135cc1221516d18005517e7c6096096f35fbd1e32d1735f1a85
+DIST crafty.doc.ascii 79678 SHA256 be291c0f4c7e7d64404ec58b9e92c2455c4342d3c96c721ba21a80fce8332e83 SHA512 562698c3954e53f05c009025291bdb748baaa08616437796a08b42198057cff9f9efa7a8caf41574e71dafe60f4c132dc9497ad5ed9a83b8f071d1c31c8583b8 WHIRLPOOL 8786cafa5afd98b6878467701ff19206f220b20fd3f575f51f17a052de709d7f5572632dd56876d34a412d4628a6c4eb984ec6e6f148a3418ff16617d7670845
diff --git a/games-board/crafty/crafty-24.1.ebuild b/games-board/crafty/crafty-24.1.ebuild
new file mode 100644
index 000000000000..c719ab55acc7
--- /dev/null
+++ b/games-board/crafty/crafty-24.1.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit flag-o-matic toolchain-funcs eutils games
+
+DESCRIPTION="Bob Hyatt's strong chess engine"
+HOMEPAGE="http://www.craftychess.com/"
+SRC_URI="http://www.craftychess.com/${P}.zip
+ http://www.cis.uab.edu/hyatt/crafty/source/${P}.zip
+ ftp://ftp.cis.uab.edu/pub/hyatt/documentation/${PN}.doc.ascii"
+
+LICENSE="crafty"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="no-opts"
+RESTRICT="test"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ app-arch/unzip"
+
+src_prepare() {
+ sed -i \
+ -e '/-o crafty/s/CC/CXX/' \
+ -e 's:CXFLAGS:CXXFLAGS:g' \
+ -e 's:-j ::g' \
+ Makefile || die
+ sed -i \
+ -e "s:\"crafty.hlp\":\"${GAMES_DATADIR}/${PN}/crafty.hlp\":" option.c || die
+ epatch "${FILESDIR}"/${P}-numcpus.patch
+}
+
+src_compile() {
+ local makeopts="target=UNIX"
+
+ if ! use no-opts ; then
+ if [[ $(tc-getCC) = icc ]] ; then
+ makeopts="${makeopts} asm=X86.o"
+ append-flags -D_REENTRANT -tpp6 \
+ -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \
+ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B -DFAST \
+ -DSMP -DCPUS=4 -DCLONE -DDGT
+ append-flags -O2 -fno-alias -fforce-mem \
+ -fomit-frame-pointer -fno-gcse -mpreferred-stack-boundary=2
+ else
+ if [[ "${CHOST}" == "i686-pc-linux-gnu" ]] \
+ || [[ "${CHOST}" == "i586-pc-linux-gnu" ]] ; then
+ append-flags -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \
+ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B \
+ -DFAST -DSMP -DCPUS=4 -DCLONE -DDGT
+ append-flags -fno-gcse \
+ -fomit-frame-pointer -mpreferred-stack-boundary=2
+ elif [[ "${CHOST}" == "x86_64-pc-linux-gnu" ]] ; then
+ append-flags -DCOMPACT_ATTACKS -DUSE_ATTACK_FUNCTIONS \
+ -DUSE_ASSEMBLY_A -DUSE_ASSEMBLY_B \
+ -DFAST -DSMP -DCPUS=4 -DCLONE -DDGT
+ append-flags -fomit-frame-pointer
+ else
+ : # everything else :)
+ fi
+ fi
+ fi
+ append-flags -DPOSIX -DSKILL
+ emake ${makeopts} crafty-make LDFLAGS="${LDFLAGS} -pthread"
+}
+
+src_install() {
+ dogamesbin crafty
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins crafty.hlp
+ dodoc "${DISTDIR}"/crafty.doc.ascii
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ elog
+ elog "Note: No books or tablebases have been installed. If you want them, just"
+ elog " download them from ${HOMEPAGE}."
+ elog " You will find documentation there too. In most cases you take now "
+ elog " your xboard compatible application, (xboard, eboard, knights) and "
+ elog " just play chess against computer opponent. Have fun."
+ elog
+}
diff --git a/games-board/crafty/files/crafty-24.1-numcpus.patch b/games-board/crafty/files/crafty-24.1-numcpus.patch
new file mode 100644
index 000000000000..14365cede2a0
--- /dev/null
+++ b/games-board/crafty/files/crafty-24.1-numcpus.patch
@@ -0,0 +1,44 @@
+diff -ru crafty-24.1.org/lock.h crafty-24.1/lock.h
+--- crafty-24.1.org/lock.h 2015-03-10 16:24:09.064539177 +0100
++++ crafty-24.1/lock.h 2015-03-10 17:45:37.675995497 +0100
+@@ -42,6 +42,7 @@
+ * *
+ *******************************************************************************
+ */
++# if defined(__i386__) || defined(__amd64__)
+ static void __inline__ LockX86(volatile int *lock) {
+ int dummy;
+ asm __volatile__(
+@@ -71,17 +72,26 @@
+ :"memory");
+ }
+
+-# define LockInit(p) (p=0)
+-# define LockFree(p) (p=0)
+-# define Unlock(p) (UnlockX86(&p))
+-# define Lock(p) (LockX86(&p))
+-# define lock_t volatile int
+-# endif
++# define LockInit(p) (p=0)
++# define LockFree(p) (p=0)
++# define Unlock(p) (UnlockX86(&p))
++# define Lock(p) (LockX86(&p))
++# define lock_t volatile int
++# else /* Not building for x86 or amd64 platforms */
++# define LockInit(p)
++# define LockFree(p)
++# define Lock(p)
++# define Unlock(p)
++# define Pause()
++# define lock_t volatile int
++# endif /* x86 && amd64 platforms or rest of the world. */
++# endif /* SMP code */
+ #else
+ # define LockInit(p)
+ # define LockFree(p)
+ # define Lock(p)
+ # define Unlock(p)
++# define Pause()
+ # define lock_t volatile int
+ #endif /* SMP code */
+ /* *INDENT-ON* */
diff --git a/games-board/crafty/metadata.xml b/games-board/crafty/metadata.xml
new file mode 100644
index 000000000000..f21032049697
--- /dev/null
+++ b/games-board/crafty/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <use>
+ <flag name="no-opts">Don't try to enable crazy CFLAG options</flag>
+ </use>
+</pkgmetadata>