summaryrefslogtreecommitdiff
path: root/games/warsow/Makefile
blob: 2109de8d3310e4d53f4c39616a3ef2499e02292c (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
147
148
# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
# $FreeBSD$

PORTNAME=	warsow
PORTVERSION=	1.51
CATEGORIES=	games
MASTER_SITES=	SF/warsow.mirror/Warsow%20${PORTVERSION}
DISTNAME=	${PORTNAME}_${PORTVERSION}_sdk
EXTRACT_SUFX=	.tar.gz.1

MAINTAINER=	ports@FreeBSD.org
COMMENT=	Futuristic, fast-paced first person shooter

LICENSE=	GPLv2

LIB_DEPENDS=	libcurl.so:${PORTSDIR}/ftp/curl
RUN_DEPENDS=	${DATADIR}/basewsw/data1_15.pk3:${PORTSDIR}/games/warsow-data

ONLY_FOR_ARCHS=	i386 amd64

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

WRKSRC=		${WRKDIR}/source/source
ALL_TARGET=	game angelwrap
RELEASEDIR=	${WRKSRC}/release
AS_SDK_DIR=	${WRKSRC}/../libsrcs/angelscript/sdk
LDFLAGS=	-L${LOCALBASE}/lib

PORTDATA=	*
PORTDOCS=	*.rtf *.doc sourcecode_quickstart.txt

OPTIONS_DEFINE=	CLIENT SERVER FTLIB REF_GL QF OPENAL IRC CIN TV_SRV DOCS XRANDR
OPTIONS_DEFAULT=	CLIENT SERVER FTLIB REF_GL QF OPENAL IRC CIN TV_SRV

CLIENT_DESC=	Build game client
SERVER_DESC=	Build dedicated server
FTLIB_DESC=	Build FreeType library module
REF_GL_DESC=	Build reference OpenGL module
QF_DESC=	Build Qf sound module
OPENAL_DESC=	Build OpenAL sound module
IRC_DESC=	Build IRC client module
CIN_DESC=	Build Cinematics playback module
TV_SRV_DESC=	Build Warsow TV server
XRANDR_DESC=	Xrandr support (may be broken with nvidia-driver)

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MCLIENT}
USE_XORG=	xi

ALL_TARGET+=	cgame ui client
PLIST_FILES+=	bin/warsow \
		share/pixmaps/warsow128x128.xpm

DESKTOP_ENTRIES="Warsow" "${COMMENT}" \
	"${PREFIX}/share/pixmaps/warsow128x128.xpm" "${PORTNAME}" \
	"Game;Shooter;" false

. if ${PORT_OPTIONS:MFTLIB} || ${PORT_OPTIONS:MREF_GL}
LIB_DEPENDS+=	libpng15.so:${PORTSDIR}/graphics/png
. endif

. if ${PORT_OPTIONS:MFTLIB}
LIB_DEPENDS+=	libfreetype.so:${PORTSDIR}/print/freetype2
ALL_TARGET+=	ftlib
. endif

. if ${PORT_OPTIONS:MREF_GL}
USE_GL=		gl
USE_XORG+=	xinerama
LIB_DEPENDS+=	libjpeg.so:${PORTSDIR}/graphics/jpeg
ALL_TARGET+=	ref_gl
. endif

. if ${PORT_OPTIONS:MQF} || ${PORT_OPTIONS:MOPENAL}
LIB_DEPENDS+=	libvorbisfile.so:${PORTSDIR}/audio/libvorbis
. endif

. if ${PORT_OPTIONS:MQF}
USE_SDL=	sdl
ALL_TARGET+=	qf
. endif

. if ${PORT_OPTIONS:MOPENAL}
USES+=		openal:al
ALL_TARGET+=	openal
. endif

. if ${PORT_OPTIONS:MIRC}
ALL_TARGET+=	irc
. endif

. if ${PORT_OPTIONS:MCIN}
ALL_TARGET+=	cin
BUILD_DEPENDS+=	${LOCALBASE}/include/theora/theoradec.h:${PORTSDIR}/multimedia/libtheora
. endif

. if ${PORT_OPTIONS:MXRANDR}
USE_XORG+=	xrandr
. else
EXTRA_PATCHES+=	${FILESDIR}/extra-patch-no-xrandr
. endif
.endif

.if ${PORT_OPTIONS:MSERVER}
ALL_TARGET+=	ded
PLIST_FILES+=	bin/wsw_server
.endif

.if ${PORT_OPTIONS:MTV_SRV}
ALL_TARGET+=	tv_server
PLIST_FILES+=	bin/wswtv_server
.endif

.if ${OPSYS} == FreeBSD
SWAPARCH=	s/x86_64/amd64/
.endif

post-patch: .SILENT
# Unmute build and link commands, respect CFLAGS
	${REINPLACE_CMD} -e 's|@$$(DO_CC|$$(DO_CC| ; /> Linking $$@/d ; \
		s|-O2 -fno-strict-aliasing -ffast-math -funroll-loops ||; \
		s| -msse2||' \
		${WRKSRC}/Makefile
# Adjust architecture names, get rid of ``freebsd_'' prefix
	${REINPLACE_CMD} -e 's/freebsd_//; ${SWAPARCH}' \
		${WRKSRC}/gameshared/q_arch.h
# Search directory provided by warsow-data port instead of current (doing
# so allows us not to install any wrapper scripts)
	${REINPLACE_CMD} -e 's|path", "\.|path", "${DATADIR}|' \
		${WRKSRC}/qcommon/files.c
# Disable pure check for library files, because they are built and placed to
# ${DATADIR} base path instead of pack file(s)
	${REINPLACE_CMD} -e 's|pure \&\& !FS_IsPureFile|0 \&\& !FS_IsPureFile|' \
		${WRKSRC}/qcommon/library.c

do-install:
.for b in ${PLIST_FILES:Mbin/*:T}
	${INSTALL_PROGRAM} ${RELEASEDIR}/${b}.${ARCH} ${STAGEDIR}${PREFIX}/bin/${b}
.endfor
	cd ${RELEASEDIR} && ${COPYTREE_SHARE} "basewsw libs" ${STAGEDIR}${DATADIR}
.if ${PORT_OPTIONS:MCLIENT}
	${INSTALL_DATA} ${WRKSRC}/unix/warsow128x128.xpm \
		${STAGEDIR}${PREFIX}/share/pixmaps
.endif
	cd ${WRKDIR}/docs && ${COPYTREE_SHARE} "${PORTDOCS}" ${STAGEDIR}${DOCSDIR}

.include <bsd.port.mk>