]> Pileus Git - ~andy/sunrise/blob - games-fps/vavoom/vavoom-1.30.ebuild
sunrise/ app-portage/elog-list/elog-list-0.0.6.ebuild: Update headers for 2010
[~andy/sunrise] / games-fps / vavoom / vavoom-1.30.ebuild
1 # Copyright 1999-2010 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 # 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/allegrogl )
36         !sdl? ( !allegro? ( ${SDLDEPEND} ) )"
37 DEPEND="media-libs/libpng
38         media-libs/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         wxwindows? ( 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         # Got rid of icon installation
76         sed -i \
77                 -e "/vavoom\.png/d" \
78                 source/CMakeLists.txt || die "sed CMakeLists.txt failed"
79
80         # Set shared data directory
81         sed -i \
82                 -e "s:fl_basedir = \".\":fl_basedir = \"${datadir}\":" \
83                 source/files.cpp || die "sed files.cpp failed"
84 }
85
86 src_compile() {
87         local \
88                 with_allegro="-DWITH_ALLEGRO=OFF" \
89                 with_sdl="-DWITH_SDL=OFF" \
90                 with_vorbis=$(cmake-utils_use_with vorbis)
91
92         # Sdl is the default, unless sdl=off & allegro=on
93         if ! use sdl && use allegro ; then
94                 with_allegro="-DWITH_ALLEGRO=ON"
95         else
96                 with_sdl="-DWITH_SDL=ON"
97         fi
98
99         # Forcibly enable vorbis support if "music" USE flag is enabled
100         if ! use vorbis && use music ; then
101                 ewarn "\"music\" USE flag requires Vorbis support enabled."
102                 ewarn "Forced enabling of \"vorbis\" USE flag"
103                 with_vorbis="-DWITH_VORBIS=ON"
104         fi
105
106         mycmakeargs="${mycmakeargs}
107                                         -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG
108                                         -DCMAKE_CXX_FLAGS_DEBUG=-g2
109                                         -DDATADIR=${datadir}
110                                         -DBINDIR="${GAMES_BINDIR}"
111                                         -DENABLE_CLIENT=ON
112                                         -DENABLE_WRAPPERS=OFF
113                                         ${with_allegro}
114                                         ${with_sdl}
115                                         ${with_vorbis}
116                                         $(cmake-utils_use_with opengl OPENGL)
117                                         $(cmake-utils_use_with openal OPENAL)
118                                         $(cmake-utils_use_with mad LIBMAD)
119                                         $(cmake-utils_use_with mikmod MIKMOD)
120                                         $(cmake-utils_use_with flac FLAC)
121                                         $(cmake-utils_use_enable debug ZONE_DEBUG)
122                                         $(cmake-utils_use_enable dedicated SERVER)
123                                         $(cmake-utils_use_enable asm ASM)
124                                         $(cmake-utils_use_enable wxwindows LAUNCHER)
125                                         -DwxWidgets_CONFIG_EXECUTABLE=${WX_CONFIG}"
126
127         cmake-utils_src_configure
128
129         cmake-utils_src_make -j1
130 }
131
132 src_install() {
133         local de_cmd="${PN}"
134
135         cmake-utils_src_install
136
137         # Enable OpenGL in desktop entry, if relevant USE flag is enabled
138         use opengl && de_cmd="${PN} -opengl"
139         doicon "source/${PN}.png" || die "doicon ${PN}.png failed"
140         make_desktop_entry "${de_cmd}" "Vavoom"
141
142         dodoc "docs/${PN}.txt" || die "dodoc vavoom.txt failed"
143
144         if use tools ; then
145                 # The tools are always built
146                 dogamesbin utils/bin/{acc,fixmd2,vcc,vlumpy} || die "dobin utils failed"
147                 dodoc utils/vcc/vcc.txt || die "dodoc vcc.txt failed"
148         fi
149
150         if use wxwindows ; then
151                 # Install graphical launcher shortcut
152                 doicon utils/vlaunch/vlaunch.xpm || die "doicon vlaunch.xpm failed"
153                 make_desktop_entry "vlaunch" "Vavoom Launcher" "vlaunch.xpm"
154         fi
155
156         prepgamesdirs
157 }
158
159 pkg_postinst() {
160         games_pkg_postinst
161
162         elog "Copy or link wad files into ${datadir}"
163         elog "(the files must be readable by the 'games' group)."
164         elog
165         elog "Example setup:"
166         elog "ln -sn "${GAMES_DATADIR}"/doom-data/doom.wad "${datadir}"/"
167         elog
168         elog "Example command-line:"
169         elog "   vavoom -doom -opengl"
170         elog
171         elog "See documentation for further details."
172
173         if use wxwindows ; then
174                 einfo
175                 einfo "You've also installed a nice graphical launcher. Simply run:"
176                 einfo
177                 einfo "   vlaunch"
178                 einfo
179                 einfo "to enjoy it :)"
180         fi
181
182         if use tools; then
183                 einfo
184                 einfo "You have also installed some Vavoom-related utilities"
185                 einfo "(useful for mod developing):"
186                 einfo
187                 einfo " - acc (ACS Script Compiler)"
188                 einfo " - fixmd2 (MD2 models utility)"
189                 einfo " - vcc (Vavoom C Compiler)"
190                 einfo " - vlumpy (Vavoom Lump utility)"
191                 einfo
192                 einfo "See the Vavoom Wiki at http://vavoom-engine.com/wiki/ or"
193                 einfo "Vavoom Forum at http://www.vavoom-engine.com/forums/"
194                 einfo "for further help."
195         fi
196 }