Initial commit
[otih-overlay.git] / games-simulation / openttd / openttd-0.7.0_rc2.ebuild
blob85b281a3303814879af818b1f57c989959aa78b4
1 # Copyright 1999-2009 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/games-simulation/openttd/openttd-0.6.3.ebuild,v 1.6 2009/02/02 15:14:49 ranger Exp $
5 EAPI="2"
7 inherit eutils games
9 MY_P=${P/_rc/-RC}
10 MY_PV=${PV/_rc/-RC}
12 DESCRIPTION="OpenTTD is a clone of Transport Tycoon Deluxe"
13 HOMEPAGE="http://www.openttd.org/"
14 SRC_URI="http://binaries.openttd.org/releases/${MY_PV}/${MY_P}-source.tar.bz2"
15 SCENARIOS="0.4.8 0.5.0"
16 for scenario in ${SCENARIOS}; do
17 SRC_URI="${SRC_URI} scenarios? (
18 http://binaries.openttd.org/scenarios/${PN}-${scenario}-scenarios.tar.bz2 )"
19 done
21 LICENSE="GPL-2"
22 SLOT="0"
23 KEYWORDS="amd64 ppc ppc64 x86"
24 IUSE="alsa debug dedicated iconv +png scenarios timidity +truetype +zlib"
25 RESTRICT="test"
27 DEPEND="!dedicated? (
28 media-libs/libsdl[X]
29 truetype? (
30 media-libs/fontconfig
31 media-libs/freetype:2
34 iconv? ( virtual/libiconv )
35 png? ( media-libs/libpng )
36 zlib? ( sys-libs/zlib )"
37 RDEPEND="${DEPEND}
38 !dedicated? (
39 timidity? ( media-sound/timidity++ )
40 !timidity? ( alsa? ( media-sound/alsa-utils ) )
43 S=${WORKDIR}/${MY_P}
45 src_unpack() {
46 unpack ${MY_P}-source.tar.bz2
48 if use scenarios ; then
49 cd "${S}"/bin/scenario/
50 for scenario in ${SCENARIOS}; do
51 unpack ${PN}-${scenario}-scenarios.tar.bz2
52 done
56 src_configure() {
57 local myopts=""
58 use debug && myopts="${myopts} --enable-debug=3"
59 if use dedicated; then
60 myopts="${myopts} --enable-dedicated "
61 else
62 myopts="${myopts} --with-sdl $(use_with truetype freetype)
63 $(use_with truetype fontconfig)"
64 if ! use timidity; then
65 use alsa && myopts="${myopts} --with-midi=/usr/bin/aplaymidi"
68 # configure is a hand-written sh-script, so econf will not work
69 ./configure --disable-strip \
70 --prefix-dir=/usr \
71 --binary-dir=games/bin \
72 --data-dir=share/games/${PN} \
73 --install-dir="${D}" \
74 --doc-dir=share/doc/${P} \
75 --menu-group="Game;Simulation;" \
76 $(use_with iconv) \
77 $(use_with png) \
78 $(use_with zlib) \
79 ${myopts} \
80 || die "configure failed"
83 src_compile() {
84 emake || die "emake failed"
87 src_install() {
88 emake DESTDIR="${D}" install || die "emake install failed"
90 if use scenarios ; then
91 insinto "${GAMES_DATADIR}"/${PN}/scenario
92 doins bin/scenario/*.scn || die "doins failed (scenario)"
93 doins bin/scenario/*/*.scn || die "doins failed (scenario)"
96 prepgamesdirs
99 pkg_postinst() {
100 games_pkg_postinst
102 elog
103 elog "In order to play, you must copy the following 6 files from "
104 elog "a version of TTD to ${GAMES_DATADIR}/${PN}/data/."
105 elog
106 elog "From the WINDOWS version you need: "
107 elog " sample.cat trg1r.grf trgcr.grf trghr.grf trgir.grf trgtr.grf"
108 elog "OR from the DOS version you need: "
109 elog " SAMPLE.CAT TRG1.GRF TRGC.GRF TRGH.GRF TRGI.GRF TRGT.GRF"
110 elog
111 elog "File names are case sensitive so make sure they are "
112 elog "correct for whichever version you have."
113 elog
115 if use scenarios ; then
116 elog "Scenarios are installed into:"
117 elog "${GAMES_DATADIR}/${PN}/scenario,"
118 elog "you will have to symlink them to ~/.openttd/scenario in order"
119 elog "to use them."
120 elog "Example:"
121 elog " ln -s ${GAMES_DATADIR}/${PN}/scenario ~/.openttd/scenario"
122 elog
125 if use dedicated ; then
126 ewarn "Warning: The init script will kill all running openttd"
127 ewarn "processes when run, including any running client sessions!"
128 else
129 if use timidity || use alsa ; then
130 elog "If you want music, you must copy the gm/ directory to"
131 elog "${GAMES_DATADIR}/${PN}/"
132 elog "You can enable MIDI by running:"
133 elog " openttd -m extmidi"
134 elog
135 if use timidity ; then
136 elog "You also need soundfonts for timidity, if you don't"
137 elog "know what that is, do:"
138 elog
139 elog "emerge media-sound/timidity-eawpatches"
140 else
141 elog "You have emerged with 'aplaymidi' for playing MIDI."
142 elog "You have to set the environment variable ALSA_OUTPUT_PORTS."
143 elog "Available ports can be listed by using 'aplaymidi -l'."
145 else
146 elog "timidity and/or alsa not in USE so music will not be played during the game."
148 elog