aports/testing/stockfish/APKBUILD

66 lines
2 KiB
Text

# Contributor: Prokop Randáček <prokop@rdck.dev>
# Maintainer: Prokop Randáček <prokop@rdck.dev>
pkgname=stockfish
pkgver=17
_nnue="1c0000000000"
pkgrel=0
pkgdesc="Strong chess engine"
url="https://stockfishchess.org/"
# s390x: doesn't build
# riscv64: intermittent test failures
arch="all !riscv64 !s390x"
license="GPL-3.0-only"
checkdepends="bash curl expect"
source="$pkgname-$pkgver.tar.gz::https://github.com/official-stockfish/Stockfish/archive/refs/tags/sf_$pkgver.tar.gz
https://tests.stockfishchess.org/api/nn/nn-$_nnue.nnue
no-lto.patch
"
builddir="$srcdir/Stockfish-sf_$pkgver/src"
prepare() {
default_prepare
ln -sfv "$srcdir"/nn-$_nnue.nnue "$builddir"/
}
build() {
export CXXFLAGS="$CXXFLAGS -O2"
export CPPFLAGS="$CPPFLAGS -O2"
local arch
case "$CARCH" in
x86_64) arch=x86-64 ;;
x86) arch=x86-32 ;;
aarch64) arch=armv8 ;;
armhf) arch=armv7 ;;
armv7) arch=armv7 ;;
loongarch64) arch=loongarch64 ;;
ppc64le) arch=ppc-64 ;;
riscv64) arch=riscv64 ;;
*) die "Unable to determine architecture from CARCH=$CARCH" ;;
esac
make COMP="${CC:-cc}" ARCH="$arch" profile-build
}
check() {
# not supported on all platforms that stockfish supports
# ../tests/instrumented.sh --valgrind
# ../tests/instrumented.sh --valgrind-thread
# requires building with sanitizers
# ../tests/instrumented.sh --sanitizer-undefined
# ../tests/instrumented.sh --sanitizer-thread
../tests/instrumented.sh
../tests/perft.sh
../tests/reprosearch.sh
}
package() {
install -Dm755 stockfish "$pkgdir"/usr/bin/stockfish
}
sha512sums="
2736c7e78a30670704b4400e20a4a5bb5b07b2e3a14d19149eccea9ba45cda5b9b42034b1ae40ef1f49c87fc1b0bc1750e998ff732da8c5fe45dd8bdbf90f9cc stockfish-17.tar.gz
8f0aca52f6ce9b229eea6ab97c72ad74207d7c74cca8b35fb94ca349773bbe66d729b0d4bf7475a22cce2b5ebec0b605dd7625b98c2b6d0ce24227fddb969d7c nn-1c0000000000.nnue
eb26852585faa5d8fae5f9a663a87a819aa47d70683c1ba75f5e13a328b78677472990471bfd03b935b52c02fe34bbf6e52d691c98bc36ff3dec6fa2e2491d27 no-lto.patch
"