Tweak games/dunelegacy version 0.96.3_2
[dports.git] / games / warsow / Makefile
1 # Created by: Alexey Dokuchaev <danfe@FreeBSD.org>
2 # $FreeBSD$
3
4 PORTNAME=       warsow
5 PORTVERSION=    1.51
6 PORTREVISION=   2
7 CATEGORIES=     games
8 MASTER_SITES=   http://update.warsow.net/mirror/ \
9                 http://mirror.amdmi3.ru/distfiles/
10 DISTNAME=       ${PORTNAME}_${PORTVERSION}_sdk
11
12 MAINTAINER=     ports@FreeBSD.org
13 COMMENT=        Futuristic, fast-paced first person shooter
14
15 LICENSE=        GPLv2
16
17 LIB_DEPENDS=    libcurl.so:ftp/curl
18 RUN_DEPENDS=    ${LOCALBASE}/${DATADIR_REL}/basewsw/data1_15.pk3:games/warsow-data
19
20 ONLY_FOR_ARCHS= i386 amd64
21
22 USES=           alias gmake compiler:c++11-lang
23
24 WRKSRC=         ${WRKDIR}/source/source
25 ALL_TARGET=     game angelwrap
26 RELEASEDIR=     ${WRKSRC}/release
27 AS_SDK_DIR=     ${WRKSRC}/../libsrcs/angelscript/sdk
28 LDFLAGS=        -L${LOCALBASE}/lib
29
30 PORTDATA=       *
31 PORTDOCS=       *.rtf *.doc sourcecode_quickstart.txt
32
33 OPTIONS_DEFINE= CLIENT SERVER FTLIB REF_GL QF OPENAL IRC CIN TV_SRV DOCS XRANDR
34 OPTIONS_DEFAULT=        CLIENT SERVER FTLIB REF_GL QF OPENAL IRC CIN TV_SRV
35
36 CLIENT_DESC=    Build game client
37 SERVER_DESC=    Build dedicated server
38 FTLIB_DESC=     Build FreeType library module
39 REF_GL_DESC=    Build reference OpenGL module
40 QF_DESC=        Build Qf sound module
41 OPENAL_DESC=    Build OpenAL sound module
42 IRC_DESC=       Build IRC client module
43 CIN_DESC=       Build Cinematics playback module
44 TV_SRV_DESC=    Build Warsow TV server
45 XRANDR_DESC=    Xrandr support (may be broken with nvidia-driver)
46
47 .include <bsd.port.options.mk>
48
49 .if ${PORT_OPTIONS:MCLIENT}
50 USE_XORG=       xi
51
52 ALL_TARGET+=    cgame ui client
53 PLIST_FILES+=   bin/warsow \
54                 share/pixmaps/warsow128x128.xpm
55
56 DESKTOP_ENTRIES="Warsow" "${COMMENT}" \
57         "${PREFIX}/share/pixmaps/warsow128x128.xpm" "${PORTNAME}" \
58         "Game;Shooter;" false
59
60 . if ${PORT_OPTIONS:MFTLIB} || ${PORT_OPTIONS:MREF_GL}
61 LIB_DEPENDS+=   libpng.so:graphics/png
62 . endif
63
64 . if ${PORT_OPTIONS:MFTLIB}
65 LIB_DEPENDS+=   libfreetype.so:print/freetype2
66 ALL_TARGET+=    ftlib
67 . endif
68
69 . if ${PORT_OPTIONS:MREF_GL}
70 USE_GL=         gl
71 USE_XORG+=      xinerama
72 USES+=          jpeg
73 ALL_TARGET+=    ref_gl
74 . endif
75
76 . if ${PORT_OPTIONS:MQF} || ${PORT_OPTIONS:MOPENAL}
77 LIB_DEPENDS+=   libvorbisfile.so:audio/libvorbis
78 . endif
79
80 . if ${PORT_OPTIONS:MQF}
81 USE_SDL=        sdl
82 ALL_TARGET+=    qf
83 . endif
84
85 . if ${PORT_OPTIONS:MOPENAL}
86 USES+=          openal:al
87 ALL_TARGET+=    openal
88 . endif
89
90 . if ${PORT_OPTIONS:MIRC}
91 ALL_TARGET+=    irc
92 . endif
93
94 . if ${PORT_OPTIONS:MCIN}
95 ALL_TARGET+=    cin
96 BUILD_DEPENDS+= ${LOCALBASE}/include/theora/theoradec.h:multimedia/libtheora
97 . endif
98
99 . if ${PORT_OPTIONS:MXRANDR}
100 USE_XORG+=      xrandr
101 . else
102 EXTRA_PATCHES+= ${FILESDIR}/extra-patch-no-xrandr
103 . endif
104 .endif
105
106 .if ${PORT_OPTIONS:MSERVER}
107 ALL_TARGET+=    ded
108 PLIST_FILES+=   bin/wsw_server
109 .endif
110
111 .if ${PORT_OPTIONS:MTV_SRV}
112 ALL_TARGET+=    tv_server
113 PLIST_FILES+=   bin/wswtv_server
114 .endif
115
116 .if ${OPSYS} == FreeBSD
117 SWAPARCH=       s/x86_64/amd64/
118 .endif
119
120 post-patch: .SILENT
121 # Unmute build and link commands, respect CFLAGS
122         ${REINPLACE_CMD} -e 's|@$$(DO_CC|$$(DO_CC| ; /> Linking $$@/d ; \
123                 s|-O2 -fno-strict-aliasing -ffast-math -funroll-loops ||; \
124                 s| -msse2||' \
125                 ${WRKSRC}/Makefile
126 # Adjust architecture names, get rid of ``freebsd_'' prefix
127         ${REINPLACE_CMD} -e 's/freebsd_//; ${SWAPARCH}' \
128                 ${WRKSRC}/gameshared/q_arch.h
129 # Search directory provided by warsow-data port instead of current (doing
130 # so allows us not to install any wrapper scripts)
131         ${REINPLACE_CMD} -e 's|path", "\.|path", "${DATADIR}|' \
132                 ${WRKSRC}/qcommon/files.c
133 # Disable pure check for library files, because they are built and placed to
134 # ${DATADIR} base path instead of pack file(s)
135         ${REINPLACE_CMD} -e 's|pure \&\& !FS_IsPureFile|0 \&\& !FS_IsPureFile|' \
136                 ${WRKSRC}/qcommon/library.c
137
138 do-install:
139 .for b in ${PLIST_FILES:Mbin/*:T}
140         ${INSTALL_PROGRAM} ${RELEASEDIR}/${b}.${ARCH} ${STAGEDIR}${PREFIX}/bin/${b}
141 .endfor
142         cd ${RELEASEDIR} && ${COPYTREE_SHARE} "basewsw libs" ${STAGEDIR}${DATADIR}
143 .if ${PORT_OPTIONS:MCLIENT}
144         ${INSTALL_DATA} ${WRKSRC}/unix/warsow128x128.xpm \
145                 ${STAGEDIR}${PREFIX}/share/pixmaps
146 .endif
147         cd ${WRKDIR}/docs && ${COPYTREE_SHARE} "${PORTDOCS}" ${STAGEDIR}${DOCSDIR}
148
149 .include <bsd.port.mk>