summaryrefslogtreecommitdiff
path: root/games-board/stockfish/stockfish-5.ebuild
blob: 95dd07b6030bea853f703df861c0582e0936a953 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=5
inherit games toolchain-funcs

DESCRIPTION="UCI chess engine http://www.stockfishchess.com/"
HOMEPAGE="http://www.stockfishchess.com/"
SRC_URI="http://stockfish.s3.amazonaws.com/stockfish-${PV}-linux.zip"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug optimization"

case $(tc-arch) in
	"x86"   ) IUSE+=" sse"    ;;
	"amd64" ) IUSE+=" popcnt" ;;
esac

DEPEND="optimization? ( sys-devel/gcc[lto] )"

S="${WORKDIR}/${PN}-${PV}-linux/src"

pkg_setup() {
	games_pkg_setup
}

src_compile() {
	local makeopts="ARCH="

	case $(tc-arch) in
		"x86"   )
			makeopts+="x86-32"
			! use sse && makeopts+="-old"
			;;
		"amd64" )
			makeopts+="x86-64"
			use popcnt && makeopts+="-modern"
			;;
	esac

	use debug && makeopts+=" debug=yes"
	! use optimization && makeopts+=" optimize=no"

	emake build ${makeopts} || die "emake failed"
}

src_install() {
	dogamesbin stockfish || die "dogamesbin failed"
	dodoc ../Copying.txt ../Readme.md || die "dodoc failed"
	prepgamesdirs
}

pkg_postinst() {
	games_pkg_postinst
	elog
	elog "Note: The opening book hasn't been installed. If you want it, just"
	elog "      download it from ${HOMEPAGE}."
	elog "      In most cases you take now your xboard compatible application,"
	elog "      (xboard, eboard, knights) and just play chess against computer"
	elog "      opponent. Have fun."
	elog
}