summaryrefslogtreecommitdiff
path: root/games-board/crafty
diff options
context:
space:
mode:
Diffstat (limited to 'games-board/crafty')
-rw-r--r--games-board/crafty/Manifest5
-rw-r--r--games-board/crafty/crafty-24.1-r1.ebuild74
-rw-r--r--games-board/crafty/files/crafty-24.1-numcpus.patch44
-rw-r--r--games-board/crafty/metadata.xml11
4 files changed, 134 insertions, 0 deletions
diff --git a/games-board/crafty/Manifest b/games-board/crafty/Manifest
new file mode 100644
index 000000000000..2a0e0b66492d
--- /dev/null
+++ b/games-board/crafty/Manifest
@@ -0,0 +1,5 @@
+AUX crafty-24.1-numcpus.patch 1564 BLAKE2B 9796e2bb0363500deabd703a64243fe8a771e072dc7e95ddc3e2e50f0c8aec67995c768d69b802213d640cf63aa32a8bb764b15993af414a4770cf07119196ff SHA512 303942f906b0ddedd1f2d2ab2c6808877c793dbc58d5f866c1af9823509fe08085d81cb3ed44f9663fa56aadc6b96a0fa4fbfde0b5ff9f53f1a235185faa2cbf
+DIST crafty-24.1.zip 442680 BLAKE2B a6f2e00e4ce3882b7548ff401eab122a102c3504b640ff6adeba58727fcc06b029ac5e49cc120d5ce394e883cb0f6c12fcb59bb82efd0789c61777f7dc13569d SHA512 4d8088aeb683d69e3ea5e01194eb0dc9b957049823c7f8a1f28686e601f9f270b829319083a8b8170016bfda36a42c592a94b4429d7c4f35a6351fd469f16124
+DIST crafty.doc.ascii 79678 BLAKE2B 776f5b141fa7982af7d95d32da4f1b2acd39794f530616fbfce828e5b5acdd094b83573da0ac684b3fe95462a453d50853dd211c5fff66b4cf99626716547696 SHA512 562698c3954e53f05c009025291bdb748baaa08616437796a08b42198057cff9f9efa7a8caf41574e71dafe60f4c132dc9497ad5ed9a83b8f071d1c31c8583b8
+EBUILD crafty-24.1-r1.ebuild 2047 BLAKE2B 5d7a1a12f2bc7e3bdd48f749c8ec366b413a839e3f49c765682d84681c1839d8ea0ec5ab390e295a2610a626af3e4705117d3b38e36c6fd0a010c440382f3d36 SHA512 a924129a809aa4f6bf38298693a4f96419a3485a9916c776228883a2918f64a8c11cdc318aaf65075953ced7cee85b7b5790319c0148fcb00206956f620b9f9d
+MISC metadata.xml 348 BLAKE2B 0553d91a61ec7b5f0fe5a67b6934b340e88030210d9b105d7f74e9599412a2f855c8b3cfd145c0bf428a0d19463eaeb97cf10aea75b1570db5b788749a0a9d36 SHA512 dac102e7447ff6f41ab290b7e59dfc9a97b2614e8f977f97a54ef1d5d616e8f22cc83607d3f9803693b59b98ecb175dcd527dcc78519451770e80f0a9cf6ed27
diff --git a/games-board/crafty/crafty-24.1-r1.ebuild b/games-board/crafty/crafty-24.1-r1.ebuild
new file mode 100644
index 000000000000..906629747c2b
--- /dev/null
+++ b/games-board/crafty/crafty-24.1-r1.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit flag-o-matic toolchain-funcs
+
+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 ~x86"
+IUSE="no-opts"
+RESTRICT="test"
+
+RDEPEND=""
+DEPEND="${RDEPEND}
+ app-arch/unzip"
+
+src_prepare() {
+ default
+ 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\":\"/usr/share/${PN}/crafty.hlp\":" option.c || die
+ eapply "${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-cppflags -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-cppflags -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-cppflags -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-cppflags -DPOSIX -DSKILL
+ emake ${makeopts} crafty-make LDFLAGS="${LDFLAGS} -pthread"
+}
+
+src_install() {
+ dobin crafty
+ insinto "/usr/share/${PN}"
+ doins crafty.hlp
+ dodoc "${DISTDIR}"/crafty.doc.ascii
+}
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..a8ab91531634
--- /dev/null
+++ b/games-board/crafty/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>games@gentoo.org</email>
+ <name>Gentoo Games Project</name>
+ </maintainer>
+ <use>
+ <flag name="no-opts">Don't try to enable crazy CFLAG options</flag>
+ </use>
+</pkgmetadata>