pkgname=stockfish
pkgver=16
pkgrel=2
epoch=1
pkgdesc="A strong UCI chess engine"
arch=('x86_64' 'i686' 'armv7h' 'aarch64')
url="https://stockfishchess.org/"
license=('GPL3')
depends=('glibc')
source=("$pkgname-$pkgver.zip::https://github.com/official-stockfish/Stockfish/archive/sf_$pkgver.zip")
sha512sums=('4c1ee8e36a8786392409fd0fa85d3751f6595b69529df09db3011229019a3f76b410dc84a077774ec1095c8a7bcde529db4cd0766f103ce94fc59fc186e6ee89')
build() {
cd "Stockfish-sf_${pkgver}/src"
_make=(make 'ARCH=" "')
"${_make[@]}" net
printf "\nStep 1/4. Building instrumented executable ...\n"
mkdir -p profdir
"${_make[@]}" \
EXTRACXXFLAGS='-fprofile-generate=profdir' \
EXTRALDFLAGS='-lgcov' \
all
printf "\nStep 2/4. Running benchmark for pgo-build ...\n"
./stockfish bench | tee PGOBENCH.out
printf "\nStep 3/4. Building optimized executable ...\n"
"${_make[@]}" objclean
"${_make[@]}" \
EXTRACXXFLAGS='-fprofile-use=profdir -fno-peel-loops -fno-tracer' \
EXTRALDFLAGS='-lgcov' \
all
printf "\nStep 4/4. Deleting profile data ...\n"
"${_make[@]}" profileclean
}
package() {
cd "Stockfish-sf_${pkgver}/src"
make PREFIX="$pkgdir/usr" install
}