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