aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Torokhov <torokhov-s-a@yandex.ru>2021-09-27 18:14:43 +0300
committerSergey Torokhov <torokhov-s-a@yandex.ru>2021-09-27 18:16:19 +0300
commita1ea9f2d5d5ab80c534a0883439cbd43ff185217 (patch)
treea5b97e28b5aec3129f576cb77c437ec03c309d8e
parentsci-libs/ann: eapi bump, drop old (diff)
downloadguru-a1ea9f2d.tar.gz
guru-a1ea9f2d.tar.bz2
guru-a1ea9f2d.zip
games-board/fairy-stockfish: new package
Ebuild is based on games-board/stockfish::gentoo Fairy-Stockfish is a chess variant engine derived from Stockfish designed for the support of fairy chess variants and easy extensibility with more games. It can play various regional, historical, and modern chess variants as well as games with user-defined rules. For compatibility with graphical user interfaces it supports the UCI, UCCI, USI, UCI-cyclone, and CECP/XBoard protocols. Signed-off-by: Sergey Torokhov <torokhov-s-a@yandex.ru>
-rw-r--r--games-board/fairy-stockfish/Manifest2
-rw-r--r--games-board/fairy-stockfish/fairy-stockfish-14.ebuild101
-rw-r--r--games-board/fairy-stockfish/metadata.xml18
3 files changed, 121 insertions, 0 deletions
diff --git a/games-board/fairy-stockfish/Manifest b/games-board/fairy-stockfish/Manifest
new file mode 100644
index 000000000..e4fff19a3
--- /dev/null
+++ b/games-board/fairy-stockfish/Manifest
@@ -0,0 +1,2 @@
+DIST fairy-stockfish-14.tar.gz 326041 BLAKE2B 16c8f07e60a2df19d0c87c5acb2a5d0e9fe3ffcba5791ac36a33337a35eebaaa01296f86a9cfbecc2916744c73c3d3f6f4ae03f2ea74759bfa96cb92c32f30b4 SHA512 7b684009447ddc0083cf356b1859215c11817a81892d887c1e47d34b26da5338a2f12846fac804995a2d21903ccc74132870a71bec46644ac0a8bba453ba7666
+DIST fairy-stockfish-test-syzygy-14.tar.gz 4201241 BLAKE2B 0c4dd000b382dda233a6be0da2e5ce02651b83507143f6e79ab831f07e2d8b0a30dc700b1375ad3781cc86083538fed48bb59e0dd31f262dd19d25549205d09c SHA512 16b000a93c0cdeaa188be37489f104781f34558ac806b5124716faf9ff6224e7f99e9ca92aa2bd16227a7664624aa8934ebeece80c94fd18c2785f523bc4c583
diff --git a/games-board/fairy-stockfish/fairy-stockfish-14.ebuild b/games-board/fairy-stockfish/fairy-stockfish-14.ebuild
new file mode 100644
index 000000000..8ea4cb783
--- /dev/null
+++ b/games-board/fairy-stockfish/fairy-stockfish-14.ebuild
@@ -0,0 +1,101 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+DESCRIPTION="Chess variant engine derived from Stockfish to support fairy chess variants"
+HOMEPAGE="https://github.com/ianfab/Fairy-Stockfish"
+
+MY_PV=$(ver_rs 1 _)
+
+SRC_URI="
+ https://github.com/ianfab/Fairy-Stockfish/archive/fairy_sf_${MY_PV}.tar.gz -> ${P}.tar.gz
+ test? ( https://api.github.com/repos/niklasf/python-chess/tarball/9b9aa13f9f36d08aadfabff872882f4ab1494e95 -> ${PN}-test-syzygy-${PV}.tar.gz )
+"
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="cpu_flags_arm_v7 cpu_flags_x86_avx2 cpu_flags_x86_popcnt cpu_flags_x86_sse allvariants debug
+ general-32 general-64 largeboards +optimize python test"
+
+RESTRICT="!test? ( test )"
+
+DEPEND="
+ || ( app-arch/unzip app-arch/zip )
+ test? ( dev-tcltk/expect )
+"
+RDEPEND=""
+
+S="${WORKDIR}/Fairy-Stockfish-fairy_sf_${PV}/src"
+
+src_prepare() {
+ default
+
+ local item
+ use test && { mv -T ../../niklasf-python-chess-9b9aa13 ../tests/syzygy || die; }
+ # Rename Stockfish to Fairy-Stockfish
+ sed -i -e 's:EXE = stockfish:EXE = fairy-stockfish:' Makefile || die
+ for item in ../tests/*.sh ; do
+ sed -i -e 's:./stockfish:./fairy-stockfish:' $item || die
+ done
+ # protocol.sh test 'ucci.exp' fails for timeout 5 but pass with 15
+ sed -i -e 's:timeout 5:timeout 15:' ../tests/protocol.sh || die
+ # instrumented.sh syzygy test runs infinitly with USE="largeboards", drop it
+ use largeboards && { sed -i -e '112,141d' ../tests/instrumented.sh || die; }
+
+ # prevent pre-stripping
+ sed -e 's:-strip $(BINDIR)/$(EXE)::' -i Makefile \
+ || die 'failed to disable stripping in the Makefile'
+}
+
+src_compile() {
+ local my_arch
+
+ # generic unoptimized first
+ use general-32 && my_arch=general-32
+ use general-64 && my_arch=general-64
+
+ # x86
+ use x86 && my_arch=x86-32-old
+ use cpu_flags_x86_sse && my_arch=x86-32
+
+ # amd64
+ use amd64 && my_arch=x86-64
+ use cpu_flags_x86_popcnt && my_arch=x86-64-modern
+
+ # both bmi2 and avx2 are part of hni (haswell new instructions)
+ use cpu_flags_x86_avx2 && my_arch=x86-64-bmi2
+
+ # other architectures
+ use cpu_flags_arm_v7 && my_arch=armv7
+ use ppc && my_arch=ppc
+ use ppc64 && my_arch=ppc64
+
+ # Skip the "build" target and use "all" instead to avoid the config
+ # sanity check (which would throw a fit about our compiler). There's
+ # a nice hack in the Makefile that overrides the value of CXX with
+ # COMPILER to support Travis CI and we abuse it to make sure that we
+ # build with our compiler of choice.
+ emake all ARCH="${my_arch}" \
+ COMP=$(tc-getCXX) \
+ COMPILER=$(tc-getCXX) \
+ all=$(usex allvariants "yes" "no") \
+ debug=$(usex debug "yes" "no") \
+ largeboards=$(usex largeboards "yes" "no")
+ optimize=$(usex optimize "yes" "no")
+}
+
+src_test() {
+ ../tests/instrumented.sh || die
+ ../tests/perft.sh || die
+ ../tests/protocol.sh || die
+ ../tests/reprosearch.sh || die
+ ../tests/signature.sh || die
+}
+
+src_install() {
+ dobin "${PN}"
+ dodoc ../AUTHORS ../README.md
+}
diff --git a/games-board/fairy-stockfish/metadata.xml b/games-board/fairy-stockfish/metadata.xml
new file mode 100644
index 000000000..18578fabb
--- /dev/null
+++ b/games-board/fairy-stockfish/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>torokhov-s-a@yandex.ru</email>
+ <name>Sergey Torokhov</name>
+ </maintainer>
+ <use>
+ <flag name="general-32">Generic unoptimized 32-bits build</flag>
+ <flag name="general-64">Generic unoptimized 64-bits build</flag>
+ <flag name="allvariants">Adds Game of the Amazons</flag>
+ <flag name="largeboards">Support for board sizes more than 8x8 (e.g., Xiangqi, Shogi). Engine is slower</flag>
+ <flag name="optimize">Enable upstream -O3 optimizations (default enabled)</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">ianfab/Fairy-Stockfish</remote-id>
+ </upstream>
+</pkgmetadata>