1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
9 inherit cmake-utils eutils subversion wxwidgets games
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"
17 KEYWORDS="~amd64 ~x86"
18 IUSE="allegro asm debug dedicated flac mad mikmod models music openal opengl
19 +sdl textures tools vorbis wxwindows"
21 QA_EXECSTACK="${GAMES_BINDIR:1}/${PN}"
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
32 SDLDEPEND=">=media-libs/libsdl-1.2
34 ALLEGDEPEND=">=media-libs/allegro-4.0"
35 OPENGLDEPEND="opengl? ( virtual/opengl )
37 allegro? ( media-libs/allegrogl )
38 !sdl? ( !allegro? ( ${SDLDEPEND} ) )"
39 DEPEND="media-libs/libpng
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* )"
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 )"
57 datadir=${GAMES_DATADIR}/${PN}
62 # Do some important check ...
63 if use sdl && use allegro ; then
65 ewarn "Both 'allegro' and 'sdl' USE flags enabled. Using SDL as default."
66 elif ! use sdl && ! use allegro ; then
68 ewarn "Both 'allegro' and 'sdl' USE flags disabled. Using SDL as default."
71 # Base graphic/sound/music support is enabled?
73 einfo "Doing some sanity check..."
75 # Graphic/sound/opengl check
76 local backend="media-libs/libsdl"
78 if ! use sdl && use allegro ; then
79 backend="media-libs/allegro"
82 local backendflags="X alsa"
85 [[ "${backend}" == "media-libs/libsdl" ]] && backendflags="${backendflags} opengl"
87 ewarn "'opengl' USE flag disabled. OpenGL is recommended, for best graphics."
90 local msg="Please rebuild ${backend} with ${backendflags} USE flag enabled"
91 if ! built_with_use ${backend} ${backendflags} ; then
97 if ! use allegro && ! built_with_use media-libs/sdl-mixer timidity ; then
99 eerror "MIDI Music support is not configured properly!"
100 eerror "Please rebuild sdl-mixer with USE 'timidity' enabled!"
101 die "music support error"
105 einfo "All is OK, let's build!"
109 subversion_src_unpack
112 # Got rid of icon installation
114 -e "/vavoom\.png/d" \
115 source/CMakeLists.txt || die "sed CMakeLists.txt failed"
117 # Set shared data directory
119 -e "s:fl_basedir = \".\":fl_basedir = \"${datadir}\":" \
120 source/files.cpp || die "sed files.cpp failed"
125 with_allegro="-DWITH_ALLEGRO=OFF" \
126 with_sdl="-DWITH_SDL=OFF" \
127 with_vorbis=$(cmake-utils_use_with vorbis)
129 # Sdl is the default, unless sdl=off & allegro=on
130 if ! use sdl && use allegro ; then
131 with_allegro="-DWITH_ALLEGRO=ON"
133 with_sdl="-DWITH_SDL=ON"
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"
143 mycmakeargs="${mycmakeargs}
144 -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG
145 -DCMAKE_CXX_FLAGS_DEBUG=-g2
147 -DBINDIR="${GAMES_BINDIR}"
149 -DENABLE_WRAPPERS=OFF
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}"
164 cmake-utils_src_configurein
166 cmake-utils_src_make -j1
172 cmake-utils_src_install
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"
179 dodoc "docs/${PN}.txt" || die "dodoc vavoom.txt failed"
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"
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"
199 elog "Copy or link wad files into ${datadir}"
200 elog "(the files must be readable by the 'games' group)."
202 elog "Example setup:"
203 elog "ln -sn "${GAMES_DATADIR}"/doom-data/doom.wad "${datadir}"/"
205 elog "Example command-line:"
206 elog " vavoom -doom -opengl"
208 elog "See documentation for further details."
210 if use wxwindows ; then
212 elog "You've also installed a nice graphical launcher. Simply run:"
216 elog "to enjoy it :)"
221 elog "You have also installed some Vavoom-related utilities"
222 elog "(useful for mod developing):"
224 elog " - acc (ACS Script Compiler)"
225 elog " - fixmd2 (MD2 models utility)"
226 elog " - vcc (Vavoom C Compiler)"
227 elog " - vlumpy (Vavoom Lump utility)"
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."