1 |
commit: a1ea9f2d5d5ab80c534a0883439cbd43ff185217 |
2 |
Author: Sergey Torokhov <torokhov-s-a <AT> yandex <DOT> ru> |
3 |
AuthorDate: Mon Sep 27 15:14:43 2021 +0000 |
4 |
Commit: Sergey Torokhov <torokhov-s-a <AT> yandex <DOT> ru> |
5 |
CommitDate: Mon Sep 27 15:16:19 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=a1ea9f2d |
7 |
|
8 |
games-board/fairy-stockfish: new package |
9 |
|
10 |
Ebuild is based on games-board/stockfish::gentoo |
11 |
|
12 |
Fairy-Stockfish is a chess variant engine derived from Stockfish designed |
13 |
for the support of fairy chess variants and easy extensibility with more games. |
14 |
It can play various regional, historical, and modern chess variants |
15 |
as well as games with user-defined rules. |
16 |
For compatibility with graphical user interfaces it supports the UCI, UCCI, |
17 |
USI, UCI-cyclone, and CECP/XBoard protocols. |
18 |
|
19 |
Signed-off-by: Sergey Torokhov <torokhov-s-a <AT> yandex.ru> |
20 |
|
21 |
games-board/fairy-stockfish/Manifest | 2 + |
22 |
.../fairy-stockfish/fairy-stockfish-14.ebuild | 101 +++++++++++++++++++++ |
23 |
games-board/fairy-stockfish/metadata.xml | 18 ++++ |
24 |
3 files changed, 121 insertions(+) |
25 |
|
26 |
diff --git a/games-board/fairy-stockfish/Manifest b/games-board/fairy-stockfish/Manifest |
27 |
new file mode 100644 |
28 |
index 000000000..e4fff19a3 |
29 |
--- /dev/null |
30 |
+++ b/games-board/fairy-stockfish/Manifest |
31 |
@@ -0,0 +1,2 @@ |
32 |
+DIST fairy-stockfish-14.tar.gz 326041 BLAKE2B 16c8f07e60a2df19d0c87c5acb2a5d0e9fe3ffcba5791ac36a33337a35eebaaa01296f86a9cfbecc2916744c73c3d3f6f4ae03f2ea74759bfa96cb92c32f30b4 SHA512 7b684009447ddc0083cf356b1859215c11817a81892d887c1e47d34b26da5338a2f12846fac804995a2d21903ccc74132870a71bec46644ac0a8bba453ba7666 |
33 |
+DIST fairy-stockfish-test-syzygy-14.tar.gz 4201241 BLAKE2B 0c4dd000b382dda233a6be0da2e5ce02651b83507143f6e79ab831f07e2d8b0a30dc700b1375ad3781cc86083538fed48bb59e0dd31f262dd19d25549205d09c SHA512 16b000a93c0cdeaa188be37489f104781f34558ac806b5124716faf9ff6224e7f99e9ca92aa2bd16227a7664624aa8934ebeece80c94fd18c2785f523bc4c583 |
34 |
|
35 |
diff --git a/games-board/fairy-stockfish/fairy-stockfish-14.ebuild b/games-board/fairy-stockfish/fairy-stockfish-14.ebuild |
36 |
new file mode 100644 |
37 |
index 000000000..8ea4cb783 |
38 |
--- /dev/null |
39 |
+++ b/games-board/fairy-stockfish/fairy-stockfish-14.ebuild |
40 |
@@ -0,0 +1,101 @@ |
41 |
+# Copyright 1999-2021 Gentoo Authors |
42 |
+# Distributed under the terms of the GNU General Public License v2 |
43 |
+ |
44 |
+EAPI=7 |
45 |
+ |
46 |
+inherit toolchain-funcs |
47 |
+ |
48 |
+DESCRIPTION="Chess variant engine derived from Stockfish to support fairy chess variants" |
49 |
+HOMEPAGE="https://github.com/ianfab/Fairy-Stockfish" |
50 |
+ |
51 |
+MY_PV=$(ver_rs 1 _) |
52 |
+ |
53 |
+SRC_URI=" |
54 |
+ https://github.com/ianfab/Fairy-Stockfish/archive/fairy_sf_${MY_PV}.tar.gz -> ${P}.tar.gz |
55 |
+ test? ( https://api.github.com/repos/niklasf/python-chess/tarball/9b9aa13f9f36d08aadfabff872882f4ab1494e95 -> ${PN}-test-syzygy-${PV}.tar.gz ) |
56 |
+" |
57 |
+LICENSE="GPL-3" |
58 |
+SLOT="0" |
59 |
+KEYWORDS="~amd64 ~x86" |
60 |
+IUSE="cpu_flags_arm_v7 cpu_flags_x86_avx2 cpu_flags_x86_popcnt cpu_flags_x86_sse allvariants debug |
61 |
+ general-32 general-64 largeboards +optimize python test" |
62 |
+ |
63 |
+RESTRICT="!test? ( test )" |
64 |
+ |
65 |
+DEPEND=" |
66 |
+ || ( app-arch/unzip app-arch/zip ) |
67 |
+ test? ( dev-tcltk/expect ) |
68 |
+" |
69 |
+RDEPEND="" |
70 |
+ |
71 |
+S="${WORKDIR}/Fairy-Stockfish-fairy_sf_${PV}/src" |
72 |
+ |
73 |
+src_prepare() { |
74 |
+ default |
75 |
+ |
76 |
+ local item |
77 |
+ use test && { mv -T ../../niklasf-python-chess-9b9aa13 ../tests/syzygy || die; } |
78 |
+ # Rename Stockfish to Fairy-Stockfish |
79 |
+ sed -i -e 's:EXE = stockfish:EXE = fairy-stockfish:' Makefile || die |
80 |
+ for item in ../tests/*.sh ; do |
81 |
+ sed -i -e 's:./stockfish:./fairy-stockfish:' $item || die |
82 |
+ done |
83 |
+ # protocol.sh test 'ucci.exp' fails for timeout 5 but pass with 15 |
84 |
+ sed -i -e 's:timeout 5:timeout 15:' ../tests/protocol.sh || die |
85 |
+ # instrumented.sh syzygy test runs infinitly with USE="largeboards", drop it |
86 |
+ use largeboards && { sed -i -e '112,141d' ../tests/instrumented.sh || die; } |
87 |
+ |
88 |
+ # prevent pre-stripping |
89 |
+ sed -e 's:-strip $(BINDIR)/$(EXE)::' -i Makefile \ |
90 |
+ || die 'failed to disable stripping in the Makefile' |
91 |
+} |
92 |
+ |
93 |
+src_compile() { |
94 |
+ local my_arch |
95 |
+ |
96 |
+ # generic unoptimized first |
97 |
+ use general-32 && my_arch=general-32 |
98 |
+ use general-64 && my_arch=general-64 |
99 |
+ |
100 |
+ # x86 |
101 |
+ use x86 && my_arch=x86-32-old |
102 |
+ use cpu_flags_x86_sse && my_arch=x86-32 |
103 |
+ |
104 |
+ # amd64 |
105 |
+ use amd64 && my_arch=x86-64 |
106 |
+ use cpu_flags_x86_popcnt && my_arch=x86-64-modern |
107 |
+ |
108 |
+ # both bmi2 and avx2 are part of hni (haswell new instructions) |
109 |
+ use cpu_flags_x86_avx2 && my_arch=x86-64-bmi2 |
110 |
+ |
111 |
+ # other architectures |
112 |
+ use cpu_flags_arm_v7 && my_arch=armv7 |
113 |
+ use ppc && my_arch=ppc |
114 |
+ use ppc64 && my_arch=ppc64 |
115 |
+ |
116 |
+ # Skip the "build" target and use "all" instead to avoid the config |
117 |
+ # sanity check (which would throw a fit about our compiler). There's |
118 |
+ # a nice hack in the Makefile that overrides the value of CXX with |
119 |
+ # COMPILER to support Travis CI and we abuse it to make sure that we |
120 |
+ # build with our compiler of choice. |
121 |
+ emake all ARCH="${my_arch}" \ |
122 |
+ COMP=$(tc-getCXX) \ |
123 |
+ COMPILER=$(tc-getCXX) \ |
124 |
+ all=$(usex allvariants "yes" "no") \ |
125 |
+ debug=$(usex debug "yes" "no") \ |
126 |
+ largeboards=$(usex largeboards "yes" "no") |
127 |
+ optimize=$(usex optimize "yes" "no") |
128 |
+} |
129 |
+ |
130 |
+src_test() { |
131 |
+ ../tests/instrumented.sh || die |
132 |
+ ../tests/perft.sh || die |
133 |
+ ../tests/protocol.sh || die |
134 |
+ ../tests/reprosearch.sh || die |
135 |
+ ../tests/signature.sh || die |
136 |
+} |
137 |
+ |
138 |
+src_install() { |
139 |
+ dobin "${PN}" |
140 |
+ dodoc ../AUTHORS ../README.md |
141 |
+} |
142 |
|
143 |
diff --git a/games-board/fairy-stockfish/metadata.xml b/games-board/fairy-stockfish/metadata.xml |
144 |
new file mode 100644 |
145 |
index 000000000..18578fabb |
146 |
--- /dev/null |
147 |
+++ b/games-board/fairy-stockfish/metadata.xml |
148 |
@@ -0,0 +1,18 @@ |
149 |
+<?xml version="1.0" encoding="UTF-8"?> |
150 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
151 |
+<pkgmetadata> |
152 |
+ <maintainer type="person"> |
153 |
+ <email>torokhov-s-a@××××××.ru</email> |
154 |
+ <name>Sergey Torokhov</name> |
155 |
+ </maintainer> |
156 |
+ <use> |
157 |
+ <flag name="general-32">Generic unoptimized 32-bits build</flag> |
158 |
+ <flag name="general-64">Generic unoptimized 64-bits build</flag> |
159 |
+ <flag name="allvariants">Adds Game of the Amazons</flag> |
160 |
+ <flag name="largeboards">Support for board sizes more than 8x8 (e.g., Xiangqi, Shogi). Engine is slower</flag> |
161 |
+ <flag name="optimize">Enable upstream -O3 optimizations (default enabled)</flag> |
162 |
+ </use> |
163 |
+ <upstream> |
164 |
+ <remote-id type="github">ianfab/Fairy-Stockfish</remote-id> |
165 |
+ </upstream> |
166 |
+</pkgmetadata> |