summaryrefslogtreecommitdiff
path: root/games/stockfish/Makefile
blob: d1ff4ec7e446ec6dbdf497edc29e9c46c8d9313c (plain)
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
# Created by: Gautam Mani <execve@gmail.com>
# $FreeBSD$

PORTNAME=	stockfish
DISTVERSION=	10
PORTREVISION=	1
DISTVERSIONSUFFIX=	-src
CATEGORIES=	games
MASTER_SITES=	http://stockfish.s3.amazonaws.com/

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

LICENSE=	GPLv3
LICENSE_FILE=	${WRKSRC}/../Copying.txt

NOT_FOR_ARCHS=	sparc64
BROKEN_aarch64=	Fails to build: cannot detect architecture
BROKEN_armv6=	Fails to configure: config-sanity: Error 1
BROKEN_armv7=	Fails to configure: config-sanity: Error 1
BROKEN_mips64=	Fails to build: cannot detect architecture

USES=		compiler:c++11-lang gmake zip

NO_WRKSUBDIR=	yes
WRKSRC_SUBDIR=	src
MYARCH=		${ARCH}
MYCC=		${CHOSEN_COMPILER_TYPE}
TGTBLD=		build

LDFLAGS+=	-fuse-ld=lld

PLIST_FILES=	bin/stockfish
PORTDOCS=	Readme.md

OPTIONS_DEFINE=	DOCS POPCNT

POPCNT_DESC=	Use the POPCNT instruction

.include <bsd.port.options.mk>

.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
	@${REINPLACE_CMD} -e "s/CXX=g++/CXX=g++${GCC_DEFAULT}/" \
		${WRKSRC}/Makefile

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

do-install-DOCS-on:
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
	${INSTALL_DATA} ${WRKSRC}/../Readme.md ${STAGEDIR}${DOCSDIR}

.include <bsd.port.mk>