/textproc/iiimf-headers/

e='freebsd-ports-graphics Git repository'/>
aboutsummaryrefslogtreecommitdiffstats
path: root/games/stockfish/Makefile
blob: 3b972c86a7414d67c8bda031cf8715ba7202bf3b (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
77
78
79
# Created by: Gautam Mani <execve@gmail.com>
# $FreeBSD$

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

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

LICENSE=    GPLv3

NOT_FOR_ARCHS=  sparc64
BROKEN_aarch64= Fails to build: cannot detect architecture
BROKEN_mips64=  Fails to build: cannot detect architecture

USES=       compiler gmake zip

WRKSRC=     ${WRKDIR}/${DISTNAME}/src
BOOKDIR=    .
MYARCH=     ${ARCH}
MYCC=       ${COMPILER_TYPE}
TGTBLD=     build

PLIST_FILES=    bin/stockfish
PORTDATA=   Book.bin
PORTDOCS=   Readme.md polyglot.ini

OPTIONS_DEFINE= DOCS POPCNT PROFILE

POPCNT_DESC=    Use the POPCNT instruction

.include <bsd.port.options.mk>

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

.if ${PORT_OPTIONS:MPOPCNT} && ${ARCH} != amd64
BROKEN=     POPCNT compiles only on amd64
.endif

# workaround the ARCH usage in the stockfish Makefile
.if ${ARCH} == "i386"
MYARCH=     x86-32
.elif ${ARCH} == "amd64"
.  if ${PORT_OPTIONS:MPOPCNT}
MYARCH=     x86-64-modern
.  else
MYARCH=     x86-64
.  endif
.elif ${ARCH} == powerpc
MYARCH=     ppc-32
.elif ${ARCH} == powerpc64
MYARCH=     ppc-64
.endif

ALL_TARGET= ${TGTBLD} ARCH=${MYARCH} COMP=${MYCC}

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

do-install:
    ${INSTALL_PROGRAM} ${WRKSRC}/stockfish ${STAGEDIR}${PREFIX}/bin
    @${MKDIR} ${STAGEDIR}${DATADIR}
    ${INSTALL_DATA} ${WRKDIR}/${BOOKDIR}/${PORTDATA} ${STAGEDIR}${DATADIR}

do-install-DOCS-on:
    @${MKDIR} ${STAGEDIR}${DOCSDIR}
    ${INSTALL_DATA} ${WRKDIR}/${DISTNAME}/Readme.md ${STAGEDIR}${DOCSDIR}
    ${INSTALL_DATA} ${WRKDIR}/${DISTNAME}/polyglot.ini ${STAGEDIR}${DOCSDIR}

.include <bsd.port.mk>