aboutsummaryrefslogtreecommitdiffstats
path: root/games/warsow/Makefile
blob: 470d2c6ddcfecde92f57ea80d623e7c7394bfa47 (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
# Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
# $FreeBSD$

PORTNAME=   warsow
PORTVERSION=    0.6.2
PORTREVISION=   3
CATEGORIES= games
MASTER_SITES=   http://www.zcdn.org/dl/
DISTNAME=   ${PORTNAME}_${PORTVERSION:R}${PORTVERSION:E}_sdk
DIST_SUBDIR=    ${PORTNAME}

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

LICENSE=    GPLv2

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

ONLY_FOR_ARCHS= i386 amd64
USE_GMAKE=  yes
USE_ZIP=    yes

WRKSRC=     ${WRKDIR}/source
ALL_TARGET= game angelwrap
RELEASEDIR= ${WRKSRC}/release
AS_SDK_DIR= ${WRKSRC}/../libsrcs/angelscript/angelSVN/sdk

PLIST_FILES=    %%DATADIR%%/basewsw/game_${ARCH}.so \
        %%DATADIR%%/libs/angelwrap_${ARCH}.so
PLIST_DIRS= %%DATADIR%%/libs

OPTIONS_DEFINE= CLIENT SERVER QF OPENAL IRC TV_SRV
OPTIONS_DEFAULT=    CLIENT SERVER QF OPENAL IRC TV_SRV

CLIENT_DESC=    Build game client
SERVER_DESC=    Build dedicated server
QF_DESC=    Build Qf sound module
OPENAL_DESC=    Build OpenAL sound module
IRC_DESC=   Build IRC client module
TV_SRV_DESC=    Build Warsow TV server

.include <bsd.port.pre.mk>

.if ${PORT_OPTIONS:MCLIENT}
LIB_DEPENDS+=   jpeg:${PORTSDIR}/graphics/jpeg
USE_GL=     gl
USE_SDL=    sdl
USE_XORG=   xinerama xxf86dga
ALL_TARGET+=    cgame ui client
PLIST_FILES+=   bin/warsow %%DATADIR%%/basewsw/cgame_${ARCH}.so \
        %%DATADIR%%/basewsw/ui_${ARCH}.so

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

. if ${PORT_OPTIONS:MQF}
USE_SDL=    sdl
ALL_TARGET+=    qf
PLIST_FILES+=   %%DATADIR%%/libs/snd_qf_${ARCH}.so
. endif

. if ${PORT_OPTIONS:MOPENAL}
USE_OPENAL= al
ALL_TARGET+=    openal
PLIST_FILES+=   %%DATADIR%%/libs/snd_openal_${ARCH}.so
. endif

. if ${PORT_OPTIONS:MIRC}
ALL_TARGET+=    irc
PLIST_FILES+=   %%DATADIR%%/libs/irc_${ARCH}.so
. 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

post-extract:
    ${CP} ${FILESDIR}/keysym2ucs.* ${WRKSRC}/unix

post-patch: .SILENT
# Unmute build and link commands, respect CFLAGS, fix hardcoded make(1)
    ${REINPLACE_CMD} -e 's|@$$(DO_CC|$$(DO_CC| ; /> Linking $$@/d ; \
        s|-O2 -fno-strict-aliasing -ffast-math -funroll-loops || ; \
        s|make -C|$$(MAKE) -C|' ${WRKSRC}/Makefile
    ${REINPLACE_CMD} -e 's|-g ||' \
        ${AS_SDK_DIR}/angelscript/projects/gnuc/makefile
# 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", "\.|&:${DATADIR}|' \
        ${WRKSRC}/qcommon/files.c
# Adjust architecture names, get rid of ``freebsd_'' prefix
    ${REINPLACE_CMD} -e 's/x86_64/amd64/ ; s/freebsd_//' \
        ${WRKSRC}/gameshared/q_arch.h
# Resolve name collision with jpeg-8
    ${REINPLACE_CMD} -e 's|jpeg_mem_src|local_&|' \
        ${WRKSRC}/ref_gl/r_image.c
# Add missing #include's
    ${REINPLACE_CMD} -e '24s|^|#include <sys/socket.h>|' \
        ${WRKSRC}/qcommon/net.c
    ${REINPLACE_CMD} -e '19s|^|#include <stdint.h>|' \
        ${WRKSRC}/unix/unix_xpm.c
# Fix AngelScript build on 64-bit arches
    ${REINPLACE_CMD} -e '/GetCurrentThreadId/!s|asDWORD|pthread_t| ; \
        s|(asDWORD)||' ${AS_SDK_DIR}/angelscript/source/as_thread.*

do-install:
.for b in ${PLIST_FILES:Mbin/*:T}
    ${INSTALL_PROGRAM} ${RELEASEDIR}/${b}.${ARCH} ${PREFIX}/bin/${b}
.endfor
    cd ${RELEASEDIR} && ${COPYTREE_SHARE} "basewsw libs" ${DATADIR}

.include <bsd.port.post.mk>