app-admin/awscli: Bump to 1.37.9
[gentoo/gentoo.git] / games-board / stockfish / stockfish-14.ebuild
blobf6130d54cc749e50f063b687092b66c04d708bfb
1 # Copyright 1999-2024 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
4 EAPI=7
6 inherit toolchain-funcs
8 DESCRIPTION="Free UCI chess engine, claimed to be the strongest in the world"
9 HOMEPAGE="https://stockfishchess.org/"
11 NNUE_FILE="nn-3475407dc199.nnue"
13 SRC_URI="https://github.com/official-stockfish/Stockfish/archive/sf_${PV}.tar.gz -> ${P}.tar.gz
14         https://tests.stockfishchess.org/api/nn/${NNUE_FILE} -> ${P}-${NNUE_FILE}"
15 LICENSE="GPL-3"
16 SLOT="0"
17 KEYWORDS="~amd64 ~riscv ~x86"
18 IUSE="cpu_flags_arm_v7 cpu_flags_x86_avx2 cpu_flags_x86_popcnt cpu_flags_x86_sse debug
19         general-32 general-64 +optimize"
21 DEPEND="|| ( app-arch/unzip app-arch/zip )"
23 S="${WORKDIR}/Stockfish-sf_${PV}/src"
25 src_prepare() {
26         default
28         cp "${DISTDIR}"/${P}-${NNUE_FILE} ${NNUE_FILE} || die "copying the nnue file failed"
30         # prevent pre-stripping
31         sed -e 's:-strip $(BINDIR)/$(EXE)::' -i Makefile \
32                 || die 'failed to disable stripping in the Makefile'
35 src_compile() {
36         local my_arch
38         # generic unoptimized first
39         use general-32 && my_arch=general-32
40         use general-64 && my_arch=general-64
42         # x86
43         use x86 && my_arch=x86-32-old
44         use cpu_flags_x86_sse && my_arch=x86-32
46         # amd64
47         use amd64 && my_arch=x86-64
48         use cpu_flags_x86_popcnt && my_arch=x86-64-modern
50         # both bmi2 and avx2 are part of hni (haswell new instructions)
51         use cpu_flags_x86_avx2 && my_arch=x86-64-bmi2
53         # other architectures
54         use cpu_flags_arm_v7 && my_arch=armv7
55         use ppc && my_arch=ppc
56         use ppc64 && my_arch=ppc64
58         # Skip the "build" target and use "all" instead to avoid the config
59         # sanity check (which would throw a fit about our compiler). There's
60         # a nice hack in the Makefile that overrides the value of CXX with
61         # COMPILER to support Travis CI and we abuse it to make sure that we
62         # build with our compiler of choice.
63         emake all ARCH="${my_arch}" \
64                 COMP="$(tc-getCXX)" \
65                 COMPILER="$(tc-getCXX)" \
66                 debug=$(usex debug "yes" "no") \
67                 optimize=$(usex optimize "yes" "no")
70 src_install() {
71         dobin "${PN}"
72         dodoc ../AUTHORS ../README.md