aboutsummaryrefslogtreecommitdiffstats
path: root/games/stockfish/Makefile
blob: 3f8b2d458e66ed262a47aa1af73192cf2b5c659c (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
66
67
68
69
70
71
72
73
74
75
76
# Created by: Gautam Mani <execve@gmail.com>
# $FreeBSD$

PORTNAME=   stockfish
PORTVERSION=    4
CATEGORIES= games
MASTER_SITES=   https://s3.amazonaws.com/stockfish/:src \
        http://www.execve.net/sf/:src \
        http://cl.ly/3x333m0G173F/download/:book \
        http://www.execve.net/sf/:book
DISTNAME=   stockfish-${PORTVERSION:S/.//g}-win
DISTFILES=  stockfish-${PORTVERSION:S/.//g}-win.zip:src \
        stockfish-231-book.zip:book

MAINTAINER= execve@gmail.com
COMMENT=    Open source chess engine

LICENSE=    GPLv3

WRKSRC=     ${WRKDIR}/${DISTNAME}/src
USES=       gmake compiler zip
MYARCH=     ${ARCH}
BOOKDIR=    .
PORTDOCS=   Readme.md polyglot.ini
PORTDATA=   Book.bin

PLIST_FILES=    bin/stockfish

TGTBLD=     build
MYCC=       ${COMPILER_TYPE}

OPTIONS_DEFINE= DOCS POPCNT_ENABLED PROFILE_BUILD
POPCNT_ENABLED_DESC=    Use the POPCNT instruction
PROFILE_BUILD_DESC= Make a Profile build

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MPROFILE_BUILD}
TGTBLD=     profile-build
.endif

.if ${PORT_OPTIONS:MPOPCNT_ENABLED}
.if ${ARCH} != "amd64"
BROKEN=     POPCNT_ENABLED compiles only on amd64
.endif
.endif

# workaround the ARCH usage in the stockfish Makefile
.if ${ARCH} == "i386"
MYARCH=     x86-32
.elif ${ARCH} == "amd64"
.if ${PORT_OPTIONS:MPOPCNT_ENABLED}
MYARCH=     x86-64-modern
.else
MYARCH=     x86-64
.endif
.endif
ALL_TARGET= ${TGTBLD} ARCH=${MYARCH} COMP=${MYCC}

.if ${ARCH} == "ia64" || ${ARCH} == "powerpc" || ${ARCH} == "sparc64"
BROKEN=     Does not compile on ia64, powerpc, or sparc64
.endif

post-patch:
    @${REINPLACE_CMD} -e "s/^PREFIX =/PREFIX ?=/" ${WRKSRC}/Makefile

do-install:
    ${INSTALL_PROGRAM} ${WRKSRC}/stockfish ${STAGEDIR}${PREFIX}/bin/stockfish

    ${MKDIR} ${STAGEDIR}${DOCSDIR}
    ${INSTALL_DATA} ${WRKDIR}/${DISTNAME}/Readme.md ${STAGEDIR}${DOCSDIR}
    ${INSTALL_DATA} ${WRKDIR}/${DISTNAME}/polyglot.ini ${STAGEDIR}${DOCSDIR}
    ${MKDIR} ${STAGEDIR}${DATADIR}
    ${INSTALL_DATA} ${WRKDIR}/${BOOKDIR}/${PORTDATA} ${STAGEDIR}${DATADIR}/

.include <bsd.port.mk>