]> Pileus Git - ~andy/sunrise/blob - games-fps/vavoom/vavoom-9999.ebuild
games-fps/vavoom: Version bump. Also forced enabling of some USE, to improve the...
[~andy/sunrise] / games-fps / vavoom / vavoom-9999.ebuild
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="1"
6
7 WX_GTK_VER="2.8"
8
9 inherit cmake-utils eutils subversion wxwidgets games
10
11 DESCRIPTION="Advanced source port for Doom/Heretic/Hexen/Strife"
12 HOMEPAGE="http://www.vavoom-engine.com/"
13 ESVN_REPO_URI="https://vavoom.svn.sourceforge.net/svnroot/vavoom/trunk/vavoom"
14
15 LICENSE="GPL-2"
16 SLOT="0"
17 KEYWORDS="~amd64 ~x86"
18 IUSE="allegro asm debug dedicated flac mad mikmod models music openal opengl
19 +sdl textures tools vorbis wxwindows"
20
21 QA_EXECSTACK="${GAMES_BINDIR:1}/${PN}"
22
23 # From econf:  "Vavoom requires Allegro or SDL to compile"
24 # SDL,like Allegro are *software* renderers in this game.
25 # So, if not selected through proper USEs, the default is SDL,
26 # without opengl (vavoom can run in software-mode only).
27 # To enable it, enable proper USE.
28 # OpenGL is the normally-desired hardware renderer, selected on command-line
29 # (through "-opengl" switch). This switch is also added to the desktop entry,
30 # if "opengl" USE flag is enabled
31
32 SDLDEPEND=">=media-libs/libsdl-1.2
33         media-libs/sdl-mixer"
34 ALLEGDEPEND=">=media-libs/allegro-4.0"
35 OPENGLDEPEND="opengl? ( virtual/opengl )
36         sdl? ( ${SDLDEPEND} )
37         allegro? ( media-libs/allegrogl )
38         !sdl? ( !allegro? ( ${SDLDEPEND} ) )"
39 DEPEND="media-libs/libpng
40         media-libs/jpeg
41         sdl? ( ${SDLDEPEND} )
42         !sdl? ( allegro? ( ${ALLEGDEPEND} ) )
43         !sdl? ( !allegro? ( !dedicated? ( ${OPENGLDEPEND} ) ) )
44         opengl? ( ${OPENGLDEPEND} )
45         vorbis? ( media-libs/libvorbis )
46         flac? ( media-libs/flac )
47         mad? ( media-libs/libmad )
48         mikmod? ( media-libs/libmikmod )
49         openal? ( media-libs/openal )
50         wxwindows? ( =x11-libs/wxGTK-2.8* )"
51 RDEPEND="${DEPEND}
52         allegro? ( media-sound/timidity++ )"
53 PDEPEND="models? ( >=games-fps/vavoom-models-1.4.2 )
54         music? ( games-fps/vavoom-music )
55         textures? ( games-fps/vavoom-textures )"
56
57 datadir=${GAMES_DATADIR}/${PN}
58
59 pkg_setup() {
60         games_pkg_setup
61
62         # Do some important check ...
63         if use sdl && use allegro ; then
64                 echo
65                 ewarn "Both 'allegro' and 'sdl' USE flags enabled. Using SDL as default."
66         elif ! use sdl && ! use allegro ; then
67                 echo
68                 ewarn "Both 'allegro' and 'sdl' USE flags disabled. Using SDL as default."
69         fi
70
71         # Base graphic/sound/music support is enabled?
72         echo
73         einfo "Doing some sanity check..."
74
75         # Graphic/sound/opengl check
76         local backend="media-libs/libsdl"
77
78         if ! use sdl && use allegro ; then
79                 backend="media-libs/allegro"
80         fi
81
82         local backendflags="X alsa"
83
84         if use opengl ; then
85                 [[ "${backend}" == "media-libs/libsdl" ]] && backendflags="${backendflags} opengl"
86         else
87                 ewarn "'opengl' USE flag disabled. OpenGL is recommended, for best graphics."
88         fi
89
90         local msg="Please rebuild ${backend} with ${backendflags} USE flag enabled"
91         if ! built_with_use ${backend} ${backendflags} ; then
92                         eerror "${msg}"
93                         die ${msg}
94         fi
95
96         # Music check
97         if ! use allegro && ! built_with_use media-libs/sdl-mixer timidity ; then
98                 echo
99                 eerror "MIDI Music support is not configured properly!"
100                 eerror "Please rebuild sdl-mixer with USE 'timidity' enabled!"
101                 die "music support error"
102         fi
103
104         echo
105         einfo "All is OK, let's build!"
106 }
107
108 src_unpack() {
109         subversion_src_unpack
110         cd "${S}"
111
112         # Got rid of icon installation
113         sed -i \
114                 -e "/vavoom\.png/d" \
115                 source/CMakeLists.txt || die "sed CMakeLists.txt failed"
116
117         # Set shared data directory
118         sed -i \
119                 -e "s:fl_basedir = \".\":fl_basedir = \"${datadir}\":" \
120                 source/files.cpp || die "sed files.cpp failed"
121 }
122
123 src_compile() {
124         local \
125                 with_allegro="-DWITH_ALLEGRO=OFF" \
126                 with_sdl="-DWITH_SDL=OFF" \
127                 with_vorbis=$(cmake-utils_use_with vorbis)
128
129         # Sdl is the default, unless sdl=off & allegro=on
130         if ! use sdl && use allegro ; then
131                 with_allegro="-DWITH_ALLEGRO=ON"
132         else
133                 with_sdl="-DWITH_SDL=ON"
134         fi
135
136         # Forcibly enable vorbis support if "music" USE flag is enabled
137         if ! use vorbis && use music ; then
138                 ewarn "\"music\" USE flag requires Vorbis support enabled."
139                 ewarn "Forced enabling of \"vorbis\" USE flag"
140                 with_vorbis="-DWITH_VORBIS=ON"
141         fi
142
143         mycmakeargs="${mycmakeargs}
144                                         -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG
145                                         -DCMAKE_CXX_FLAGS_DEBUG=-g2
146                                         -DDATADIR=${datadir}
147                                         -DBINDIR="${GAMES_BINDIR}"
148                                         -DENABLE_CLIENT=ON
149                                         -DENABLE_WRAPPERS=OFF
150                                         ${with_allegro}
151                                         ${with_sdl}
152                                         ${with_vorbis}
153                                         $(cmake-utils_use_with opengl OPENGL)
154                                         $(cmake-utils_use_with openal OPENAL)
155                                         $(cmake-utils_use_with mad LIBMAD)
156                                         $(cmake-utils_use_with mikmod MIKMOD)
157                                         $(cmake-utils_use_with flac FLAC)
158                                         $(cmake-utils_use_enable debug ZONE_DEBUG)
159                                         $(cmake-utils_use_enable dedicated SERVER)
160                                         $(cmake-utils_use_enable asm ASM)
161                                         $(cmake-utils_use_enable wxwindows LAUNCHER)
162                                         -DwxWidgets_CONFIG_EXECUTABLE=${WX_CONFIG}"
163
164         cmake-utils_src_configurein
165
166         cmake-utils_src_make -j1
167 }
168
169 src_install() {
170         local de_cmd="${PN}"
171
172         cmake-utils_src_install
173
174         # Enable OpenGL in desktop entry, if relevant USE flag is enabled
175         use opengl && de_cmd="${PN} -opengl"
176         doicon "source/${PN}.png" || die "doicon ${PN}.png failed"
177         make_desktop_entry "${de_cmd}" "Vavoom"
178
179         dodoc "docs/${PN}.txt" || die "dodoc vavoom.txt failed"
180
181         if use tools ; then
182                 # The tools are always built
183                 dogamesbin utils/bin/{acc,fixmd2,vcc,vlumpy} || die "dobin utils failed"
184                 dodoc utils/vcc/vcc.txt || die "dodoc vcc.txt failed"
185         fi
186
187         if use wxwindows ; then
188                 # Install graphical launcher shortcut
189                 doicon utils/vlaunch/vlaunch.xpm || die "doicon vlaunch.xpm failed"
190                 make_desktop_entry "vlaunch" "Vavoom Launcher" "vlaunch.xpm"
191         fi
192
193         prepgamesdirs
194 }
195
196 pkg_postinst() {
197         games_pkg_postinst
198
199         elog "Copy or link wad files into ${datadir}"
200         elog "(the files must be readable by the 'games' group)."
201         elog
202         elog "Example setup:"
203         elog "ln -sn "${GAMES_DATADIR}"/doom-data/doom.wad "${datadir}"/"
204         elog
205         elog "Example command-line:"
206         elog "   vavoom -doom -opengl"
207         elog
208         elog "See documentation for further details."
209
210         if use wxwindows ; then
211                 echo
212                 elog "You've also installed a nice graphical launcher. Simply run:"
213                 elog
214                 elog "   vlaunch"
215                 elog
216                 elog "to enjoy it :)"
217         fi
218
219         if use tools; then
220                 echo
221                 elog "You have also installed some Vavoom-related utilities"
222                 elog "(useful for mod developing):"
223                 elog
224                 elog " - acc (ACS Script Compiler)"
225                 elog " - fixmd2 (MD2 models utility)"
226                 elog " - vcc (Vavoom C Compiler)"
227                 elog " - vlumpy (Vavoom Lump utility)"
228                 elog
229                 elog "See the Vavoom Wiki at http://vavoom-engine.com/wiki/ or"
230                 elog "Vavoom Forum at http://www.vavoom-engine.com/forums/"
231                 elog "for further help."
232         fi
233 }