# Template file for 'stockfish'
pkgname=stockfish
version=9
revision=2
build_style=gnu-makefile
build_wrksrc="src"
wrksrc="${pkgname}-${version}-src"
create_wrksrc=yes
make_build_target="build"
hostmakedepends="unzip"
short_desc="A free UCI chess engine derived from Glaurung"
maintainer="cipr3s <cipr3s@gmx.com>"
license="GPL-3"
homepage="http://stockfishchess.org/"
distfiles="http://stockfish.s3.amazonaws.com/${pkgname}-${version}-src.zip"
checksum=ba2e72d6973479c8c839c7f4a095d121829ebe8df39b71ebf291c84e5cb3e36e

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"
		makedepends+="libatomic-devel"
		LDFLAGS+=" -latomic"
		;;
	armv7*)
		make_build_args+="ARCH=armv7"
		;;
esac

do_install() {
	vbin stockfish
}
