# Template file for 'stockfish'
pkgname=stockfish
version=11
revision=1
wrksrc="Stockfish-sf_${version}"
build_wrksrc=src
build_style=gnu-makefile
make_build_target=build
hostmakedepends="tar"
short_desc="Free UCI chess engine derived from Glaurung"
maintainer="cipr3s <cipr3s@gmx.com>"
license="GPL-3.0-or-later"
homepage="http://stockfishchess.org/"
distfiles="https://github.com/official-stockfish/Stockfish/archive/sf_${version}.tar.gz"
checksum=802261cc601b67bed00c0ef7d21e2125959630f0852a06db9fc9bd74f440b199

LDFLAGS+="-lpthread"

case $XBPS_TARGET_MACHINE in
	x86_64*) make_build_args+="ARCH=x86-64" ;;
	i686*) make_build_args+="ARCH=x86-32" ;;
	aarch64*) make_build_args+="ARCH=general-64" ;;
	armv[56]*) make_build_args+="ARCH=general-32";;
	armv7*) make_build_args+="ARCH=armv7" ;;
	ppc64*) make_build_args+="ARCH=ppc-64" ;;
	ppc*) make_build_args+="ARCH=ppc-32" ;;
esac

if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
	makedepends+=" libatomic-devel"
	LDFLAGS+=" -latomic"
fi

do_install() {
	vbin stockfish
}
