Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: games-simulation/openttd/
Date: Mon, 16 Jul 2018 09:21:16
Message-Id: 1531732857.273db3f0d8e19a51b242e834f17f74ccafe5ec4b.polynomial-c@gentoo
1 commit: 273db3f0d8e19a51b242e834f17f74ccafe5ec4b
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jul 16 09:20:57 2018 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Mon Jul 16 09:20:57 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=273db3f0
7
8 games-simulation/openttd: Added live ebuild.
9
10 Package-Manager: Portage-2.3.42, Repoman-2.3.9
11
12 games-simulation/openttd/openttd-9999.ebuild | 177 +++++++++++++++++++++++++++
13 1 file changed, 177 insertions(+)
14
15 diff --git a/games-simulation/openttd/openttd-9999.ebuild b/games-simulation/openttd/openttd-9999.ebuild
16 new file mode 100644
17 index 00000000000..8289f42f6d0
18 --- /dev/null
19 +++ b/games-simulation/openttd/openttd-9999.ebuild
20 @@ -0,0 +1,177 @@
21 +# Copyright 1999-2018 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=6
25 +inherit gnome2-utils
26 +
27 +MY_PV="${PV/_rc/-RC}"
28 +MY_P="${PN}-${MY_PV}"
29 +
30 +DESCRIPTION="OpenTTD is a clone of Transport Tycoon Deluxe"
31 +HOMEPAGE="http://www.openttd.org/"
32 +if [[ "${PV}" == *9999 ]] ; then
33 + inherit git-r3
34 + EGIT_REPO_URI="https://github.com/OpenTTD/OpenTTD.git"
35 +else
36 + SRC_URI="http://binaries.openttd.org/releases/${MY_PV}/${MY_P}-source.tar.xz"
37 + KEYWORDS="~amd64 ~ppc64 ~x86"
38 +fi
39 +
40 +LICENSE="GPL-2"
41 +SLOT="0"
42 +IUSE="aplaymidi debug dedicated iconv icu lzo +openmedia +png cpu_flags_x86_sse +timidity +truetype zlib"
43 +RESTRICT="test" # needs a graphics set in order to test
44 +
45 +RDEPEND="!dedicated? (
46 + media-libs/libsdl[sound,X,video]
47 + icu? (
48 + dev-libs/icu-layoutex
49 + dev-libs/icu-le-hb
50 + >=dev-libs/icu-58.1:=
51 + )
52 + truetype? (
53 + media-libs/fontconfig
54 + media-libs/freetype:2
55 + sys-libs/zlib
56 + )
57 + )
58 + lzo? ( dev-libs/lzo:2 )
59 + iconv? ( virtual/libiconv )
60 + png? ( media-libs/libpng:0 )
61 + zlib? ( sys-libs/zlib )"
62 +DEPEND="${RDEPEND}
63 + virtual/pkgconfig"
64 +PDEPEND="
65 + !dedicated? (
66 + openmedia? (
67 + games-misc/openmsx
68 + games-misc/opensfx
69 + )
70 + aplaymidi? ( media-sound/alsa-utils )
71 + !aplaymidi? ( timidity? ( media-sound/timidity++ ) )
72 + )
73 + openmedia? ( >=games-misc/opengfx-0.4.7 )"
74 +
75 +S="${WORKDIR}/${MY_P}"
76 +
77 +PATCHES=(
78 + "${FILESDIR}"/${PN}-1.6.0-cflags.patch
79 +)
80 +
81 +src_configure() {
82 + local myopts=(
83 + --disable-strip
84 + --prefix-dir="${EPREFIX%/}/usr"
85 + --binary-dir="bin"
86 + --install-dir="${D}"
87 + --menu-group="Game;Simulation;"
88 + $(use_with iconv)
89 + $(use_with png)
90 + $(use_with cpu_flags_x86_sse sse)
91 + $(use_with lzo liblzo2)
92 + $(usex debug '--enable-debug=3' '')
93 + # there is an allegro interface available as well as sdl, but
94 + # the configure for it looks broken so the sdl interface is
95 + # always built instead.
96 + --without-allegro
97 + # libtimidity not needed except for some embedded platform
98 + # nevertheless, it will be automagically linked if it is
99 + # installed. Hence, we disable it.
100 + --without-libtimidity
101 + )
102 +
103 + if use dedicated ; then
104 + myopts+=( --enable-dedicated )
105 + else
106 + myopts+=(
107 + $(usex aplaymidi '--with-midi=/usr/bin/aplaymidi' '')
108 + $(use_with truetype freetype)
109 + $(use_with icu)
110 + --with-sdl
111 + )
112 + fi
113 + if use png || { use !dedicated && use truetype; } || use zlib ; then
114 + myopts+=( --with-zlib )
115 + else
116 + myopts+=( --without-zlib )
117 + fi
118 +
119 + # configure is a hand-written bash-script, so econf will not work.
120 + # It's all built as C++, upstream uses CFLAGS internally.
121 + CFLAGS="" ./configure ${myopts[@]} || die
122 +}
123 +
124 +src_compile() {
125 + emake VERBOSE=1
126 +}
127 +
128 +src_install() {
129 + default
130 + if use dedicated ; then
131 + newinitd "${FILESDIR}"/${PN}.initd-r1 ${PN}
132 + rm -rf "${ED%/}"/usr/share/{applications,icons,pixmaps}
133 + fi
134 + rm -f "${ED%/}"/usr/share/doc/${PF}/COPYING
135 +}
136 +
137 +pkg_preinst() {
138 + gnome2_icon_savelist
139 +}
140 +
141 +pkg_postinst() {
142 + gnome2_icon_cache_update
143 +
144 + if ! use lzo ; then
145 + elog "OpenTTD was built without 'lzo' in USE. While 'lzo' is not"
146 + elog "required, disabling it does mean that loading old savegames"
147 + elog "or scenarios from ancient versions (~0.2) will fail."
148 + elog
149 + fi
150 +
151 + if use dedicated ; then
152 + ewarn "Warning: The init script will kill all running openttd"
153 + ewarn "processes when triggered, including any running client sessions!"
154 + else
155 + if use aplaymidi ; then
156 + elog "You have emerged with 'aplaymidi' for playing MIDI."
157 + elog "This option is for those with a hardware midi device,"
158 + elog "or who have set up ALSA to handle midi ports."
159 + elog "You must set the environment variable ALSA_OUTPUT_PORTS."
160 + elog "Available ports can be listed by using 'aplaymidi -l'."
161 + else
162 + if ! use timidity ; then
163 + elog "OpenTTD was built with neither 'aplaymidi' nor 'timidity'"
164 + elog "in USE. Music may or may not work in-game. If you happen"
165 + elog "to have timidity++ installed, music will work so long"
166 + elog "as it remains installed, but OpenTTD will not depend on it."
167 + fi
168 + fi
169 + if ! use openmedia ; then
170 + elog
171 + elog "OpenTTD was compiled without the 'openmedia' USE flag."
172 + elog
173 + elog "In order to play, you must at least install:"
174 + elog "games-misc/opengfx, and games-misc/opensfx, or copy the "
175 + elog "following 6 files from a version of Transport Tycoon Deluxe"
176 + elog "(windows or DOS) to ~/.openttd/data/ or"
177 + elog "${GAMES_DATADIR}/${PN}/data/."
178 + elog
179 + elog "From the WINDOWS version you need: "
180 + elog "sample.cat trg1r.grf trgcr.grf trghr.grf trgir.grf trgtr.grf"
181 + elog "OR from the DOS version you need: "
182 + elog "SAMPLE.CAT TRG1.GRF TRGC.GRF TRGH.GRF TRGI.GRF TRGT.GRF"
183 + elog
184 + elog "File names are case sensitive, but should work either with"
185 + elog "all upper or all lower case names"
186 + elog
187 + elog "In addition, in-game music will be unavailable: for music,"
188 + elog "install games-misc/openmsx, or use the in-game download"
189 + elog "functionality to get a music set"
190 + elog
191 + fi
192 + fi
193 +}
194 +
195 +pkg_postrm() {
196 + gnome2_icon_cache_update
197 +}