]> Pileus Git - ~andy/sunrise/blob - games-fps/vavoom/vavoom-9999.ebuild
add missing die
[~andy/sunrise] / games-fps / vavoom / vavoom-9999.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="2"
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=""
18 IUSE="allegro asm debug dedicated flac mad mikmod +models +music openal +opengl
19 +sdl +textures tools +vorbis wxwidgets"
20
21 # From econf:  "Vavoom requires Allegro or SDL to compile"
22 # SDL,like Allegro are *software* renderers in this game.
23 # So, if not selected through proper USEs, the default is SDL,
24 # without opengl (vavoom can run in software-mode only).
25 # To enable it, enable proper USE.
26 # OpenGL is the normally-desired hardware renderer, selected on command-line
27 # (through "-opengl" switch). This switch is also added to the desktop entry,
28 # if "opengl" USE flag is enabled
29
30 SDLDEPEND=">=media-libs/libsdl-1.2[X,alsa,opengl?]
31         media-libs/sdl-mixer[timidity]"
32 ALLEGDEPEND=">=media-libs/allegro-4.0[X,alsa]"
33 OPENGLDEPEND="opengl? ( virtual/opengl )
34         sdl? ( ${SDLDEPEND} )
35         allegro? ( media-libs/allegro[opengl] )
36         !sdl? ( !allegro? ( ${SDLDEPEND} ) )"
37 DEPEND="media-libs/libpng
38         virtual/jpeg
39         sdl? ( ${SDLDEPEND} )
40         !sdl? ( allegro? ( ${ALLEGDEPEND} ) )
41         !sdl? ( !allegro? ( !dedicated? ( ${OPENGLDEPEND} ) ) )
42         opengl? ( ${OPENGLDEPEND} )
43         vorbis? ( media-libs/libvorbis )
44         flac? ( media-libs/flac )
45         mad? ( media-libs/libmad )
46         mikmod? ( media-libs/libmikmod )
47         openal? ( media-libs/openal )
48         wxwidgets? ( x11-libs/wxGTK:2.8 )"
49 RDEPEND="${DEPEND}
50         allegro? ( media-sound/timidity++ )"
51 PDEPEND="models? ( >=games-fps/vavoom-models-1.4.3 )
52         music? ( games-fps/vavoom-music )
53         textures? ( games-fps/vavoom-textures )"
54
55 datadir=${GAMES_DATADIR}/${PN}
56
57 CMAKE_IN_SOURCE_BUILD=true
58
59 pkg_setup() {
60         games_pkg_setup
61
62         # Print some warning if needed
63         if use sdl && use allegro ; then
64                 ewarn
65                 ewarn "Both 'allegro' and 'sdl' USE flags enabled. Using SDL as default."
66         elif ! use sdl && ! use allegro ; then
67                 ewarn
68                 ewarn "Both 'allegro' and 'sdl' USE flags disabled. Using SDL as default."
69         fi
70
71         ! use opengl && ewarn "'opengl' USE flag disabled. OpenGL is recommended, for best graphics."
72 }
73
74 src_prepare() {
75         subversion_src_unpack
76         subversion_src_prepare
77
78         # Got rid of icon installation
79         sed -i \
80                 -e "/vavoom\.png/d" \
81                 source/CMakeLists.txt || die "sed CMakeLists.txt failed"
82
83         # Set shared data directory
84         sed -i \
85                 -e "s:fl_basedir = \".\":fl_basedir = \"${datadir}\":" \
86                 source/files.cpp || die "sed files.cpp failed"
87 }
88
89 src_compile() {
90         local \
91                 with_allegro="-DWITH_ALLEGRO=OFF" \
92                 with_sdl="-DWITH_SDL=OFF" \
93                 with_vorbis=$(cmake-utils_use_with vorbis)
94
95         # Sdl is the default, unless sdl=off & allegro=on
96         if ! use sdl && use allegro ; then
97                 with_allegro="-DWITH_ALLEGRO=ON"
98         else
99                 with_sdl="-DWITH_SDL=ON"
100         fi
101
102         # Forcibly enable vorbis support if "music" USE flag is enabled
103         if ! use vorbis && use music ; then
104                 ewarn "\"music\" USE flag requires Vorbis support enabled."
105                 ewarn "Forced enabling of \"vorbis\" USE flag"
106                 with_vorbis="-DWITH_VORBIS=ON"
107         fi
108
109         mycmakeargs="${mycmakeargs}
110                                         -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG
111                                         -DCMAKE_CXX_FLAGS_DEBUG=-g2
112                                         -DDATADIR=${datadir}
113                                         -DBINDIR="${GAMES_BINDIR}"
114                                         -DENABLE_CLIENT=ON
115                                         -DENABLE_WRAPPERS=OFF
116                                         ${with_allegro}
117                                         ${with_sdl}
118                                         ${with_vorbis}
119                                         $(cmake-utils_use_with opengl OPENGL)
120                                         $(cmake-utils_use_with openal OPENAL)
121                                         $(cmake-utils_use_with mad LIBMAD)
122                                         $(cmake-utils_use_with mikmod MIKMOD)
123                                         $(cmake-utils_use_with flac FLAC)
124                                         $(cmake-utils_use_enable debug ZONE_DEBUG)
125                                         $(cmake-utils_use_enable dedicated SERVER)
126                                         $(cmake-utils_use_enable asm ASM)
127                                         $(cmake-utils_use_enable wxwidgets LAUNCHER)
128                                         -DwxWidgets_CONFIG_EXECUTABLE=${WX_CONFIG}"
129
130         cmake-utils_src_configure
131
132         cmake-utils_src_make -j1
133 }
134
135 src_install() {
136         local de_cmd="${PN}"
137
138         cmake-utils_src_install
139
140         # Enable OpenGL in desktop entry, if relevant USE flag is enabled
141         use opengl && de_cmd="${PN} -opengl"
142         doicon "source/${PN}.png" || die "doicon ${PN}.png failed"
143         make_desktop_entry "${de_cmd}" "Vavoom"
144
145         dodoc "docs/${PN}.txt" || die "dodoc vavoom.txt failed"
146
147         if use tools ; then
148                 # The tools are always built
149                 dogamesbin utils/bin/{acc,fixmd2,vcc,vlumpy} || die "dobin utils failed"
150                 dodoc utils/vcc/vcc.txt || die "dodoc vcc.txt failed"
151         fi
152
153         if use wxwidgets ; then
154                 # Install graphical launcher shortcut
155                 doicon utils/vlaunch/vlaunch.xpm || die "doicon vlaunch.xpm failed"
156                 make_desktop_entry "vlaunch" "Vavoom Launcher" "vlaunch.xpm"
157         fi
158
159         prepgamesdirs
160 }
161
162 pkg_postinst() {
163         games_pkg_postinst
164
165         elog "Copy or link wad files into ${datadir}"
166         elog "(the files must be readable by the 'games' group)."
167         elog
168         elog "Example setup:"
169         elog "ln -sn "${GAMES_DATADIR}"/doom-data/doom.wad "${datadir}"/"
170         elog
171         elog "Example command-line:"
172         elog "   vavoom -doom -opengl"
173         elog
174         elog "See documentation for further details."
175
176         if use wxwidgets ; then
177                 einfo
178                 einfo "You've also installed a nice graphical launcher. Simply run:"
179                 einfo
180                 einfo "   vlaunch"
181                 einfo
182                 einfo "to enjoy it :)"
183         fi
184
185         if use tools; then
186                 einfo
187                 einfo "You have also installed some Vavoom-related utilities"
188                 einfo "(useful for mod developing):"
189                 einfo
190                 einfo " - acc (ACS Script Compiler)"
191                 einfo " - fixmd2 (MD2 models utility)"
192                 einfo " - vcc (Vavoom C Compiler)"
193                 einfo " - vlumpy (Vavoom Lump utility)"
194                 einfo
195                 einfo "See the Vavoom Wiki at http://vavoom-engine.com/wiki/ or"
196                 einfo "Vavoom Forum at http://www.vavoom-engine.com/forums/"
197                 einfo "for further help."
198         fi
199 }