]> Pileus Git - ~andy/sunrise/blob - games-fps/vavoom/vavoom-1.29.ebuild
app-misc/tudu: Drop old version
[~andy/sunrise] / games-fps / vavoom / vavoom-1.29.ebuild
1 # Copyright 1999-2008 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 wxwidgets games
10
11 DESCRIPTION="Advanced source port for Doom/Heretic/Hexen/Strife"
12 HOMEPAGE="http://www.vavoom-engine.com/"
13 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
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[X,alsa,opengl?]
33         media-libs/sdl-mixer[timidity]"
34 ALLEGDEPEND=">=media-libs/allegro-4.0[X,alsa]"
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.3 )
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         # Print some warning if needed
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         ! use opengl && ewarn "'opengl' USE flag disabled. OpenGL is recommended, for best graphics."
72 }
73
74 src_unpack() {
75         unpack ${A}
76         cd "${S}"
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 wxwindows LAUNCHER)
128                                         -DwxWidgets_CONFIG_EXECUTABLE=${WX_CONFIG}"
129
130         cmake-utils_src_configurein
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 wxwindows ; 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 wxwindows ; then
177                 echo
178                 elog "You've also installed a nice graphical launcher. Simply run:"
179                 elog
180                 elog "   vlaunch"
181                 elog
182                 elog "to enjoy it :)"
183         fi
184
185         if use tools; then
186                 echo
187                 elog "You have also installed some Vavoom-related utilities"
188                 elog "(useful for mod developing):"
189                 elog
190                 elog " - acc (ACS Script Compiler)"
191                 elog " - fixmd2 (MD2 models utility)"
192                 elog " - vcc (Vavoom C Compiler)"
193                 elog " - vlumpy (Vavoom Lump utility)"
194                 elog
195                 elog "See the Vavoom Wiki at http://vavoom-engine.com/wiki/ or"
196                 elog "Vavoom Forum at http://www.vavoom-engine.com/forums/"
197                 elog "for further help."
198         fi
199 }