aboutsummaryrefslogtreecommitdiff
path: root/games/xboard/Makefile
blob: 4cbdf72bc0638b8d85c18a4ba687581ee425763a (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
PORTNAME?=	xboard
PORTVERSION?=	4.9.1
PORTREVISION?=	3
PORTEPOCH?=	0
CATEGORIES?=	games
MASTER_SITES?=	GNU

MAINTAINER?=	mbeis@xs4all.nl
COMMENT?=	X frontend for Crafty, GNUChess, Chess Servers, or e-mail chess
WWW=		https://www.gnu.org/software/xboard/

LICENSE?=	GPLv3

LIB_DEPENDS?=	libcairo.so:graphics/cairo

CONFLICTS?=	xboard-devel

OPTIONS_DEFINE?=	NLS DOCS ZIPPY
OPTIONS_SINGLE?=	FRONTEND
OPTIONS_SINGLE_FRONTEND?=	XAW XAW3D GTK2
OPTIONS_GROUP?=	ENGINES
OPTIONS_GROUP_ENGINES?=	CRAFTY FAIRYMAX GNUCHESS KNIGHTCAP PHALANX
OPTIONS_RADIO?=	SOUND
OPTIONS_RADIO_SOUND?=	SOX ALSA
OPTIONS_DEFAULT?=	FAIRYMAX XAW
OPTIONS_SUB?=	yes

ZIPPY_DESC=	Add Zippy capability (computer player on ICS)
ENGINES_DESC=	Chess Engines
CRAFTY_DESC=	Install crafty engine
FAIRYMAX_DESC=	Install fairymax engine (many chess variants)
GNUCHESS_DESC=	Install GnuChess engine
KNIGHTCAP_DESC=	Install KnightCap engine
PHALANX_DESC=	Install phalanx engine
FRONTEND_DESC=	Front End
XAW_DESC=	Xaw GUI toolkit support (default)
XAW3D_DESC=	Xaw3d GUI toolkit support (not fully supported)
GTK2_DESC=	GTK+ 2 GUI toolkit support (experimental)
SOUND_DESC=	Sound Output
SOX_DESC=	SoX audio support

CRAFTY_RUN_DEPENDS=	crafty:games/crafty
FAIRYMAX_RUN_DEPENDS=	fairymax:games/fairymax
GNUCHESS_RUN_DEPENDS=	gnuchess:games/gnuchess
KNIGHTCAP_RUN_DEPENDS=	KnightCap:games/KnightCap
PHALANX_RUN_DEPENDS=	phalanx:games/phalanx
XAW3D_DEPENDS=		libXaw3d.so:x11-toolkits/Xaw3d
SOX_RUN_DEPENDS=	play:audio/sox
ALSA_RUN_DEPENDS=	aplay:audio/alsa-utils
NLS_USES=		gettext
NLS_CONFIGURE_ENABLE=	nls
ZIPPY_CONFIGURE_ENABLE=	zippy
XAW_CONFIGURE_WITH=	Xaw
XAW3D_CONFIGURE_WITH=	Xaw3d
GTK2_CONFIGURE_WITH=	gtk

.include <bsd.port.options.mk>

USES+=		desktop-file-utils gnome makeinfo perl5 pkgconfig \
		shared-mime-info shebangfix xorg
USE_XORG+=	ice sm x11 xmu xt xpm
USE_GNOME+=	librsvg2
.if ${PORT_OPTIONS:MXAW}
USE_XORG+=	xaw
.endif
.if ${PORT_OPTIONS:MGTK2}
USE_GNOME+=	gtk20
.endif
SHEBANG_FILES=	texi2man

GNU_CONFIGURE=	yes
CONFIGURE_ARGS+=MKDIR_P="${MKDIR}" PERLPATH=${PERL}
CFLAGS+=	-I${LOCALBASE}/include -fcommon
LDFLAGS+=	-L${LOCALBASE}/lib
INFO=		xboard
USE_PERL5=	build
DATADIR?=	${PREFIX}/share/games/${PORTNAME}
XBOARDCONF?=	${WRKSRC}/xboard.conf

PORTDOCS=	AUTHORS COPYING COPYRIGHT ChangeLog DIFFSTAT FAQ.html NEWS README SHORTLOG TODO

.if ${PORT_OPTIONS:MZIPPY}
USES+=		shebangfix
SHEBANG_FILES+=	./texi2man
PORTDOCS+=	zippy.README
.endif

.if ${PORT_OPTIONS:MNLS}
PORTDOCS+=	ABOUT-NLS
.endif

post-patch:
	-@[ -f ${WRKSRC}/Makefile.in ] && ${REINPLACE_CMD} -e \
		'/xboard_LDADD/s/-ldl //' ${WRKSRC}/Makefile.in
	@${ECHO_CMD} -n "" > ${WRKSRC}/engineEntries.txt
	@${ECHO_CMD} -n "" > ${WRKSRC}/firstEngine.txt
.if ${PORT_OPTIONS:MCRAFTY}
	@${ECHO_CMD} "\"Crafty\" -fcp crafty\\" >> ${WRKSRC}/engineEntries.txt
	@${ECHO_CMD} -n "crafty" > ${WRKSRC}/firstEngine.txt
.endif
.if ${PORT_OPTIONS:MGNUCHESS}
	@${ECHO_CMD} "\"GNU Chess\" -fcp gnuchess\\" >> ${WRKSRC}/engineEntries.txt
	@${ECHO_CMD} -n "gnuchess" > ${WRKSRC}/firstEngine.txt
.endif
.if ${PORT_OPTIONS:MKNIGHTCAP}
	@${ECHO_CMD} "\"KnightCap\" -fcp \"KnightCap -n -X -A -f ${PREFIX}/share/games/KnightCap/coeffs.dat\"\\" >> ${WRKSRC}/engineEntries.txt
	@${ECHO_CMD} -n "KnightCap" > ${WRKSRC}/firstEngine.txt
.endif
.if ${PORT_OPTIONS:MPHALANX}
	@${ECHO_CMD} "\"Phalanx\" -fcp phalanx\\" >> ${WRKSRC}/engineEntries.txt
	@${ECHO_CMD} -n "phalanx" > ${WRKSRC}/firstEngine.txt
.endif
.if ${PORT_OPTIONS:MFAIRYMAX}
	@${ECHO_CMD} "\"FairyMax\" -fcp fairymax\\" >> ${WRKSRC}/engineEntries.txt
	@${ECHO_CMD} -n "fairymax" > ${WRKSRC}/firstEngine.txt
.endif
	@firstEngine=`cat ${WRKSRC}/firstEngine.txt` && \
	 ${REINPLACE_CMD} -e "s|\(-firstChessProgram\) .*|\1 $${firstEngine}|" ${XBOARDCONF}
	@engineEntries=`cat ${WRKSRC}/engineEntries.txt` && \
	 ${REINPLACE_CMD} -e "s|\(firstChessProgramNames[ 	]*{\)[ 	]*.*|\1$${engineEntries}}|" ${XBOARDCONF}
	@${REINPLACE_CMD} -e '/^#include..malloc.h/d' \
		${WRKSRC}/engineoutput.c ${WRKSRC}/uci.c
.if ${PORT_OPTIONS:MZIPPY}
	@cd ${WRKSRC} && ${PATCH} < ${PATCHDIR}/OPTION_ZIPPY__patch-xboard.texi
	@${REINPLACE_CMD} -e 's|%%DOCSDIR%%|${DOCSDIR}|g' ${WRKSRC}/xboard.texi
.endif
.if ${PORT_OPTIONS:MSOX}
	@${REINPLACE_CMD} -e "s|\(soundProgram\) .*|\1 \"play -q\"|" ${XBOARDCONF}
.elif ${PORT_OPTIONS:MALSA}
	@${REINPLACE_CMD} -e "s|\(soundProgram\) .*|\1 \"aplay -q\"|" ${XBOARDCONF}
.else
	@${REINPLACE_CMD} -e "s|\(soundProgram\) .*|\1 \"\"|" ${XBOARDCONF}
.endif
	@${REINPLACE_CMD} -e "1s|^|int initialSquareSize;|" \
		${WRKSRC}/xaw/xboard.c

post-install:
	${INSTALL_SCRIPT} ${WRKSRC}/cmail ${STAGEDIR}${PREFIX}/bin/
	${MV} ${STAGEDIR}${PREFIX}/etc/xboard.conf \
		 ${STAGEDIR}${PREFIX}/etc/xboard.conf.sample
.if ${PORT_OPTIONS:MDOCS}
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
	${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${STAGEDIR}${DOCSDIR}
.endif

.include <bsd.port.mk>