Version bump.
authorLars Weiler <pylon@gentoo.org>
Sat, 21 Apr 2007 11:50:51 +0000 (11:50 +0000)
committerLars Weiler <pylon@gentoo.org>
Sat, 21 Apr 2007 11:50:51 +0000 (11:50 +0000)
Package-Manager: portage-2.1.2.4

games-simulation/openttd/ChangeLog
games-simulation/openttd/Manifest
games-simulation/openttd/files/digest-openttd-0.5.1 [new file with mode: 0644]
games-simulation/openttd/files/openttd-0.4.0.1-buffer-checks.patch [deleted file]
games-simulation/openttd/openttd-0.5.1.ebuild [new file with mode: 0644]

index 16c65b5b052b9b460656c56db413a801e5ee0476..e1f63bb1a6513269aa8d1238263057def989fec3 100644 (file)
@@ -1,6 +1,12 @@
 # ChangeLog for games-simulation/openttd
 # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/games-simulation/openttd/ChangeLog,v 1.38 2007/03/04 14:40:36 chainsaw Exp $
+# $Header: /var/cvsroot/gentoo-x86/games-simulation/openttd/ChangeLog,v 1.39 2007/04/21 11:50:51 pylon Exp $
+
+*openttd-0.5.1 (21 Apr 2007)
+
+  21 Apr 2007; Lars Weiler <pylon@gentoo.org>
+  -files/openttd-0.4.0.1-buffer-checks.patch, +openttd-0.5.1.ebuild:
+  Version bump.
 
   04 Mar 2007; Tony Vroon <chainsaw@gentoo.org> openttd-0.5.0.ebuild:
   Add ~ppc64 keyword. Tested on 64UL with GCC 4.1.2
index 3fa9d7b08dec6f386578032092f0dae4f444a571..390d21055aeff147e3ea44ab6ce0ca13d300e699 100644 (file)
@@ -1,10 +1,6 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-AUX openttd-0.4.0.1-buffer-checks.patch 6632 RMD160 444629d2d4b33e7eac3ed962f43d8f0dee23d149 SHA1 2230a91e8699a9bbe0b7bc73844323c238c68554 SHA256 809f28bc4233641312e07c4305a3d6f15e3a609d420fca66d4aadcf68fbd65c8
-MD5 43ec527a9d656d58d852c2a828458840 files/openttd-0.4.0.1-buffer-checks.patch 6632
-RMD160 444629d2d4b33e7eac3ed962f43d8f0dee23d149 files/openttd-0.4.0.1-buffer-checks.patch 6632
-SHA256 809f28bc4233641312e07c4305a3d6f15e3a609d420fca66d4aadcf68fbd65c8 files/openttd-0.4.0.1-buffer-checks.patch 6632
 AUX openttd.initd 529 RMD160 ff9fdf7a787ae3d08ec4dbef1b1b37eee12d1ccd SHA1 f833206fc430c6e7afec76c39e97af0f7ec6578a SHA256 a16e5c64a073d0b7e7092bb906b7f064414870a8607bebce16b4b08cff7f4112
 MD5 a169eb5c8572ee01be52c4accf2608a2 files/openttd.initd 529
 RMD160 ff9fdf7a787ae3d08ec4dbef1b1b37eee12d1ccd files/openttd.initd 529
@@ -13,6 +9,7 @@ DIST openttd-0.4.8-scenarios.tar.bz2 5000799 RMD160 a6c2fa9f81e4e4628adb9c3932de
 DIST openttd-0.4.8-source.tar.bz2 2212990 RMD160 9ec9d8ee3531dc5a4f421eae6844a50299c22455 SHA1 8161079003dadbd7153d65cc88f373f16a0c0aab SHA256 39556ac3524e762c7bfbd6b1438590c9d5010bed99b4aff725e68897a0d62f8f
 DIST openttd-0.5.0-scenarios.tar.bz2 917117 RMD160 f6ea4a4004bb0c90de9283a92b14da4bd99bc33c SHA1 965fc34bbe9998741ea07531772c9673b33aab99 SHA256 c89e652aca1a9ad9f0f4936dd99cd8a9c96f4c53450990ff87d87483f8e74a31
 DIST openttd-0.5.0-source.tar.bz2 3029813 RMD160 7da82a6ab3bf58fd59dfef46920d15271e722682 SHA1 a97da66ec6943e45353bf53bae7947ad1454a8c1 SHA256 dec6761a291fa48e52911485d465689c3622c4eec9e66732bb9713e69220885c
+DIST openttd-0.5.1-source.tar.bz2 3033665 RMD160 e3faad8b8ed697aeb705af90d673b61370e02b6f SHA1 0fd40643443423a9493dfce836a0f00c2f6240d1 SHA256 476eed7f6a45c06b193cdf5143e33056272f8bc197aa7903d17403f34a0faf5f
 EBUILD openttd-0.4.8.ebuild 5315 RMD160 615025d777a177ba1fc888d22c819359fd9afdce SHA1 13bf0d1cd47d5bf01cf4fb703eccc48cdd82752d SHA256 f94a1a6dc9982f0a6af38cc4b5297ede3f406659f5bc78ec902dbe0d3c8b46bc
 MD5 5a4bf2dac6a5acf721ecb7cf30e4caa4 openttd-0.4.8.ebuild 5315
 RMD160 615025d777a177ba1fc888d22c819359fd9afdce openttd-0.4.8.ebuild 5315
@@ -21,10 +18,14 @@ EBUILD openttd-0.5.0.ebuild 5590 RMD160 4003aa6375e6bb6cdc3a6c6ef45009dba6055f83
 MD5 648bec2b2d5d2dc7ce09c172047718af openttd-0.5.0.ebuild 5590
 RMD160 4003aa6375e6bb6cdc3a6c6ef45009dba6055f83 openttd-0.5.0.ebuild 5590
 SHA256 773fd3351cdeea13b5d4c0b8762578651fd57a73235acbfea389bfc9ded5821d openttd-0.5.0.ebuild 5590
-MISC ChangeLog 6412 RMD160 c87d8b4ca4fe4ccea685f865c96cc85553905fa0 SHA1 be32cbfb28dae1f1e083cdba16e22e4df856e87e SHA256 376b15648aa35047e1253f2aca10b3e918331b70e14ec202b86af0c1e97b79cd
-MD5 91ed01a459cd07805cd562731c40c014 ChangeLog 6412
-RMD160 c87d8b4ca4fe4ccea685f865c96cc85553905fa0 ChangeLog 6412
-SHA256 376b15648aa35047e1253f2aca10b3e918331b70e14ec202b86af0c1e97b79cd ChangeLog 6412
+EBUILD openttd-0.5.1.ebuild 5709 RMD160 6d5c3059dbf6104f6df14466b57bbf16f377a62b SHA1 91c02cf167be7c3ec961e2225426166d395ab3cb SHA256 c9ffba092564aeba2ccdd71d06d67d3c5c40b20a4c82aa29f9954390a5591a0b
+MD5 6e063b522d9586f1754f72a063680ed5 openttd-0.5.1.ebuild 5709
+RMD160 6d5c3059dbf6104f6df14466b57bbf16f377a62b openttd-0.5.1.ebuild 5709
+SHA256 c9ffba092564aeba2ccdd71d06d67d3c5c40b20a4c82aa29f9954390a5591a0b openttd-0.5.1.ebuild 5709
+MISC ChangeLog 6571 RMD160 284dd59478be44f0e99286639b0c3ba547535cd9 SHA1 029548e1d6a7868e4aa1324c0e8e2f8a4fc33126 SHA256 a52f88aa3e5872f25c41a9b4dfc178d34f4b83e8d70b685bb3798d87d333d762
+MD5 8aa7969ca25f63ef38f4f807a5a0dd15 ChangeLog 6571
+RMD160 284dd59478be44f0e99286639b0c3ba547535cd9 ChangeLog 6571
+SHA256 a52f88aa3e5872f25c41a9b4dfc178d34f4b83e8d70b685bb3798d87d333d762 ChangeLog 6571
 MISC metadata.xml 379 RMD160 58e5ec6d6482e2b60f3bdd99a26cb68ff16e0a3e SHA1 8b42b16535813e370be26ed1be6c97e947aca724 SHA256 8ba83d4305e1fa7698ab48d81f15053607da61690be4ec95e9c6a2aa499160c3
 MD5 255758e5fa9c77c52b49ed29dc311262 metadata.xml 379
 RMD160 58e5ec6d6482e2b60f3bdd99a26cb68ff16e0a3e metadata.xml 379
@@ -35,10 +36,13 @@ SHA256 9c2a511409d19728dee9a737ca130fe715d43bd9f35ec4a34e8ca46b6c1cd3f3 files/di
 MD5 464ec2332efae8aaeb57be72eac16c9c files/digest-openttd-0.5.0 542
 RMD160 0a65e8c56965a3b632603d00d03e28b7d4fc02bc files/digest-openttd-0.5.0 542
 SHA256 e49429770c514de35d18847899c2a2539e8ac507e4a2da2a450f0984d0228ec4 files/digest-openttd-0.5.0 542
+MD5 9cf5ea4d78624866d5487a5cd9c2131e files/digest-openttd-0.5.1 819
+RMD160 c9ffa680658d7dcb7520a4bba3cb4a8f847d67f1 files/digest-openttd-0.5.1 819
+SHA256 5a3aabe2424aab72789685d6eb754f2bc002d57b36f66fc8acabb8abe01bed71 files/digest-openttd-0.5.1 819
 -----BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.2 (GNU/Linux)
+Version: GnuPG v1.4.6 (GNU/Linux)
 
-iD8DBQFF6tkyp5vW4rUFj5oRAianAJ0ZqfAGC/dMuAhkI3WpePY9LmO3IgCfRg3J
-t8+tmazRrefliM44Sj0XTjk=
-=wFgW
+iD8DBQFGKfqb6IPkARlRZfQRAjEyAJ9SH9hnsTBu8ZdUAEdogYNbJRqdaACeNH4K
+06as1xiqtRaDN+Ma0LWxIiw=
+=mXMj
 -----END PGP SIGNATURE-----
diff --git a/games-simulation/openttd/files/digest-openttd-0.5.1 b/games-simulation/openttd/files/digest-openttd-0.5.1
new file mode 100644 (file)
index 0000000..fcf7a30
--- /dev/null
@@ -0,0 +1,9 @@
+MD5 34e8cb13ce1d4e6b5b24887c628c1ac8 openttd-0.4.8-scenarios.tar.bz2 5000799
+RMD160 a6c2fa9f81e4e4628adb9c3932dec46ab4789777 openttd-0.4.8-scenarios.tar.bz2 5000799
+SHA256 61788035bd78a3c0e393d5992432c37e0b6036d19a960543f26d43a46e39e6ca openttd-0.4.8-scenarios.tar.bz2 5000799
+MD5 37892f1fdded957f956766642a9e877d openttd-0.5.0-scenarios.tar.bz2 917117
+RMD160 f6ea4a4004bb0c90de9283a92b14da4bd99bc33c openttd-0.5.0-scenarios.tar.bz2 917117
+SHA256 c89e652aca1a9ad9f0f4936dd99cd8a9c96f4c53450990ff87d87483f8e74a31 openttd-0.5.0-scenarios.tar.bz2 917117
+MD5 6f517a28c866f4a9029c0c005d868502 openttd-0.5.1-source.tar.bz2 3033665
+RMD160 e3faad8b8ed697aeb705af90d673b61370e02b6f openttd-0.5.1-source.tar.bz2 3033665
+SHA256 476eed7f6a45c06b193cdf5143e33056272f8bc197aa7903d17403f34a0faf5f openttd-0.5.1-source.tar.bz2 3033665
diff --git a/games-simulation/openttd/files/openttd-0.4.0.1-buffer-checks.patch b/games-simulation/openttd/files/openttd-0.4.0.1-buffer-checks.patch
deleted file mode 100644 (file)
index ffebb6c..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-Fix remote buffer overflows and format string attacks.
-
-Patch by Alexey Dobriyan, diffs taken from upstream svn.
-
-http://svn.openttd.org/cgi-bin/viewcvs.cgi?rev=2899&view=rev
-http://bugs.gentoo.org/show_bug.cgi?id=102631
-
-Log Message:
-Fix: Several format string vulnerabilities and buffer overflows in the network code
-
---- /trunk/console_cmds.c      2005/08/28 10:59:34     2898
-+++ trunk/console_cmds.c       2005/08/28 12:24:57     2899
-@@ -1132,7 +1132,7 @@
-                       SEND_COMMAND(PACKET_CLIENT_SET_NAME)(_network_player_name);
-               } else {
-                       if (NetworkFindName(_network_player_name)) {
--                              NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, _network_player_name);
-+                              NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, "%s", _network_player_name);
-                               ttd_strlcpy(ci->client_name, _network_player_name, sizeof(ci->client_name));
-                               NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
-                       }
---- /trunk/network.c   2005/08/28 10:59:34     2898
-+++ trunk/network.c    2005/08/28 12:24:57     2899
-@@ -100,7 +100,7 @@
-       char temp[1024];
-       va_start(va, str);
--      vsprintf(buf, str, va);
-+      vsnprintf(buf, lengthof(buf), str, va);
-       va_end(va);
-       switch (action) {
-@@ -499,7 +499,7 @@
-               GetString(str, STR_NETWORK_ERR_CLIENT_GENERAL + errorno);
--              NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, client_name, str);
-+              NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, client_name, "%s", str);
-               // Inform other clients of this... strange leaving ;)
-               FOR_ALL_CLIENTS(new_cs) {
---- /trunk/network_client.c    2005/08/28 10:59:34     2898
-+++ trunk/network_client.c     2005/08/28 12:24:57     2899
-@@ -349,7 +349,7 @@
-       if (ci != NULL) {
-               if (playas == ci->client_playas && strcmp(name, ci->client_name) != 0) {
-                       // Client name changed, display the change
--                      NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, name);
-+                      NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, "%s", name);
-               } else if (playas != ci->client_playas) {
-                       // The player changed from client-player..
-                       // Do not display that for now
-@@ -666,7 +666,7 @@
-       ci = NetworkFindClientInfoFromIndex(index);
-       if (ci != NULL) {
--              NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, ci->client_name, str);
-+              NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, ci->client_name, "%s", str);
-               // The client is gone, give the NetworkClientInfo free
-               ci->client_index = NETWORK_EMPTY_INDEX;
-@@ -684,11 +684,11 @@
-       NetworkClientInfo *ci;
-       index = NetworkRecv_uint16(MY_CLIENT, p);
--      NetworkRecv_string(MY_CLIENT, p, str, 100);
-+      NetworkRecv_string(MY_CLIENT, p, str, lengthof(str));
-       ci = NetworkFindClientInfoFromIndex(index);
-       if (ci != NULL) {
--              NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, ci->client_name, str);
-+              NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, ci->client_name, "%s", str);
-               // The client is gone, give the NetworkClientInfo free
-               ci->client_index = NETWORK_EMPTY_INDEX;
---- /trunk/network_server.c    2005/08/28 10:59:34     2898
-+++ trunk/network_server.c     2005/08/28 12:24:57     2899
-@@ -162,7 +162,7 @@
-               DEBUG(net, 2)("[NET] %s made an error (%s) and his connection is closed", client_name, str);
--              NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, client_name, str);
-+              NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, client_name, "%s", str);
-               FOR_ALL_CLIENTS(new_cs) {
-                       if (new_cs->status > STATUS_AUTH && new_cs != cs) {
-@@ -904,7 +904,7 @@
-       DEBUG(net, 2)("[NET] %s reported an error and is closing his connection (%s)", client_name, str);
--      NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, client_name, str);
-+      NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, client_name, "%s", str);
-       FOR_ALL_CLIENTS(new_cs) {
-               if (new_cs->status > STATUS_AUTH) {
-@@ -929,11 +929,11 @@
-               return;
-       }
--      NetworkRecv_string(cs, p, str, 100);
-+      NetworkRecv_string(cs, p, str, lengthof(str));
-       NetworkGetClientName(client_name, sizeof(client_name), cs);
--      NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, client_name, str);
-+      NetworkTextMessage(NETWORK_ACTION_LEAVE, 1, false, client_name, "%s", str);
-       FOR_ALL_CLIENTS(new_cs) {
-               if (new_cs->status > STATUS_AUTH) {
-@@ -1108,7 +1108,7 @@
-       if (ci != NULL) {
-               // Display change
-               if (NetworkFindName(client_name)) {
--                      NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, client_name);
-+                      NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, 1, false, ci->client_name, "%s", client_name);
-                       ttd_strlcpy(ci->client_name, client_name, sizeof(ci->client_name));
-                       NetworkUpdateClientInfo(ci->client_index);
-               }
---- /trunk/texteff.c   2005/08/28 10:59:34     2898
-+++ trunk/texteff.c    2005/08/28 12:24:57     2899
-@@ -62,7 +62,7 @@
-       int length;
-       va_start(va, message);
--      vsprintf(buf, message, va);
-+      vsnprintf(buf, lengthof(buf), message, va);
-       va_end(va);
-       /* Special color magic */
---- openttd/os2.c
-+++ openttd/os2.c
-@@ -642,7 +642,7 @@ static long CDECL MidiSendCommand(const 
-       va_list va;
-       char buf[512];
-       va_start(va, cmd);
--      vsprintf(buf, cmd, va);
-+      vsnprintf(buf, sizeof(buf), cmd, va);
-       va_end(va);
-       return mciSendString(buf, NULL, 0, NULL, 0);
- }
---- openttd/strgen/strgen.c
-+++ openttd/strgen/strgen.c
-@@ -84,7 +84,7 @@ void warning(const char *s, ...) {
-       char buf[1024];
-       va_list va;
-       va_start(va, s);
--      vsprintf(buf, s, va);
-+      vsnprintf(buf, sizeof(buf), s, va);
-       va_end(va);
-       fprintf(stderr, "%d: ERROR: %s\n", _cur_line, buf);
-       _warnings = true;
-@@ -94,7 +94,7 @@ void NORETURN error(const char *s, ...) 
-       char buf[1024];
-       va_list va;
-       va_start(va, s);
--      vsprintf(buf, s, va);
-+      vsnprintf(buf, sizeof(buf), s, va);
-       va_end(va);
-       fprintf(stderr, "%d: FATAL: %s\n", _cur_line, buf);
-       exit(1);
---- openttd/ttd.c
-+++ openttd/ttd.c
-@@ -70,7 +70,7 @@ void CDECL error(const char *s, ...) {
-       va_list va;
-       char buf[512];
-       va_start(va, s);
--      vsprintf(buf, s, va);
-+      vsnprintf(buf, sizeof(buf), s, va);
-       va_end(va);
-       ShowOSErrorBox(buf);
-@@ -86,7 +86,7 @@ void CDECL ShowInfoF(const char *str, ..
-       va_list va;
-       char buf[1024];
-       va_start(va, str);
--      vsprintf(buf, str, va);
-+      vsnprintf(buf, sizeof(buf), str, va);
-       va_end(va);
-       ShowInfo(buf);
- }
-@@ -99,7 +99,7 @@ char * CDECL str_fmt(const char *str, ..
-       char *p;
-       va_start(va, str);
--      len = vsprintf(buf, str, va);
-+      len = vsnprintf(buf, sizeof(buf), str, va);
-       va_end(va);
-       p = malloc(len + 1);
-       if (p)
---- openttd/win32.c
-+++ openttd/win32.c
-@@ -841,7 +841,7 @@ static long CDECL MidiSendCommand(const 
-       char buf[512];
-       va_start(va, cmd);
--      vsprintf(buf, cmd, va);
-+      vsnprintf(buf, sizeof(buf), cmd, va);
-       va_end(va);
-       return mciSendStringA(buf, NULL, 0, 0);
- }
diff --git a/games-simulation/openttd/openttd-0.5.1.ebuild b/games-simulation/openttd/openttd-0.5.1.ebuild
new file mode 100644 (file)
index 0000000..9bc1bec
--- /dev/null
@@ -0,0 +1,189 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/games-simulation/openttd/openttd-0.5.1.ebuild,v 1.1 2007/04/21 11:50:51 pylon Exp $
+
+inherit eutils games
+
+SCENARIOS_048="${PN}-0.4.8-scenarios.tar.bz2"
+SCENARIOS_050="${PN}-0.5.0-scenarios.tar.bz2"
+
+DESCRIPTION="OpenTTD is a clone of Transport Tycoon Deluxe"
+HOMEPAGE="http://www.openttd.com/"
+SB="mirror://sourceforge/openttd"
+SRC_URI="${SB}/${P}-source.tar.bz2
+               scenarios? ( ${SB}/${SCENARIOS_048}
+                       ${SB}/${SCENARIOS_050} )"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~ppc64"
+IUSE="alsa debug dedicated png scenarios timidity unicode zlib"
+
+DEPEND="!dedicated? ( media-libs/libsdl >=media-libs/fontconfig-2.3.2 )
+       png? ( media-libs/libpng )
+       zlib? ( sys-libs/zlib )
+       unicode? ( virtual/libiconv )"
+RDEPEND="${DEPEND}
+       !dedicated? (
+               timidity? ( media-sound/timidity++ )
+               !timidity? ( alsa? ( media-sound/alsa-utils ) )
+       )"
+
+pkg_setup() {
+       if ! use dedicated && ! built_with_use media-libs/libsdl X ; then
+               die "Please emerge media-libs/libsdl with USE=X"
+       fi
+       games_pkg_setup
+}
+
+src_unpack() {
+       unpack ${P}-source.tar.bz2
+       if use scenarios ; then
+               cd ${S}/scenario/
+               unpack ${SCENARIOS_048}
+               unpack ${SCENARIOS_050}
+       fi
+       cd ${S}
+       # Don't pre-strip binaries (bug #137822)
+       sed -i -e '/+= -s$/s/-s//' Makefile || die "sed failed"
+       # Don't install into prefixed DATA_DIR
+       sed -i -e \
+               's#DATA_DIR_PREFIXED:=$(PREFIX)/$(DATA_DIR)#DATA_DIR_PREFIXED:=$(DATA_DIR)#' \
+               Makefile || die "sed failed"
+}
+
+src_compile() {
+       local myopts=""
+       use debug && myopts="${myopts} DEBUG=1"
+       use dedicated && myopts="${myopts} DEDICATED=1"
+       use png && myopts="${myopts} WITH_PNG=1"
+       use zlib && myopts="${myopts} WITH_ZLIB=1"
+       use unicode && myopts="${myopts} WITH_ICONV=1"
+       if ! use dedicated ; then
+               myopts="${myopts} WITH_SDL=1"
+               if ! use timidity; then
+                       use alsa && myopts="${myopts} MIDI=/usr/bin/aplaymidi"
+               fi
+       fi
+
+       # parallel build not supported
+       emake -j1 \
+               MANUAL_CONFIG=1 \
+               UNIX=1 \
+               WITH_NETWORK=1 \
+               INSTALL=1 \
+               RELEASE=${PV} \
+               USE_HOMEDIR=1 \
+               DEST_DIR=${D} \
+               PERSONAL_DIR=.openttd \
+               PREFIX=${GAMES_PREFIX} \
+               DATA_DIR=${GAMES_DATADIR}/${PN} \
+               CUSTOM_LANG_DIR=${GAMES_DATADIR}/${PN}/lang \
+               ${myopts} \
+               || die "emake failed"
+}
+
+src_install() {
+       dogamesbin openttd || die "dogamesbin failed"
+
+       insinto "${GAMES_DATADIR}/${PN}/data"
+       doins data/* || die "doins failed (data)"
+
+       insinto "${GAMES_DATADIR}/${PN}/lang"
+       doins lang/*.lng || die "doins failed (lang)"
+
+       if use scenarios ; then
+               insinto "${GAMES_DATADIR}/${PN}/scenario"
+               doins scenario/*.scn || die "doins failed (scenario)"
+               doins scenario/*/*.scn || die "doins failed (scenario)"
+       fi
+
+       insinto "${GAMES_DATADIR}/${PN}/scripts"
+       doins scripts/*.example || die "doins failed (scripts)"
+
+       for i in {16,32,48,64,128}; do
+               insinto /usr/share/icons/hicolor/${i}x${i}/apps
+               newins media/openttd.${i}.png openttd.png
+       done
+
+       if ! use dedicated ; then
+               if use timidity || use alsa ; then
+                       make_desktop_entry "openttd -m extmidi" "OpenTTD" openttd
+               else
+                       make_desktop_entry openttd "OpenTTD" openttd
+               fi
+       else
+               newinitd "${FILESDIR}"/openttd.initd openttd
+       fi
+
+       dodoc readme.txt known-bugs.txt changelog.txt docs/Manual.txt docs/console.txt docs/multiplayer.txt
+       dohtml -a html,gif,png,svg docs/*
+       newdoc scripts/readme.txt readme_scripts.txt
+       doman docs/openttd.6
+       prepgamesdirs
+}
+
+pkg_postinst() {
+       games_pkg_postinst
+
+       echo
+       einfo "In order to play, you must copy the following 6 files from "
+       einfo "a version of TTD to ${GAMES_DATADIR}/${PN}/data/."
+       echo
+       einfo "From the WINDOWS version you need: "
+       einfo "  sample.cat trg1r.grf trgcr.grf trghr.grf trgir.grf trgtr.grf"
+       einfo "OR from the DOS version you need: "
+       einfo "  SAMPLE.CAT TRG1.GRF TRGC.GRF TRGH.GRF TRGI.GRF TRGT.GRF"
+       echo
+       einfo "File names are case sensitive so make sure they are "
+       einfo "correct for whichever version you have."
+       echo
+
+       if ! use scenarios ; then
+               einfo "Scenarios are now included in a seperate package. To "
+               einfo "install them as well please remerge with the "
+               einfo "\"scenarios\" USE flag."
+               echo
+       else
+               einfo "Scenarios are installed to ${GAMES_DATADIR}/${PN}/scenario,"
+               einfo "you will have to symlink them to ~/.openttd/scenario in order"
+               einfo "to use them."
+               einfo "Example:"
+               einfo "  mkdir -p ~/.openttd/scenario"
+               einfo "  ln -s ${GAMES_DATADIR}/${PN}/scenario/* ~/.openttd/scenario/"
+               echo
+       fi
+
+       if use dedicated ; then
+               einfo "You have chosen the dedicated USE flag which builds a "
+               einfo "version of OpenTTD to be used as a game server which "
+               einfo "does not require SDL. You will not be able to play the "
+               einfo "game, but if you don't pass this flag you can still use "
+               einfo "it as a server in the same way, but SDL will be required."
+               echo
+               ewarn "Warning: The init script will kill all running openttd"
+               ewarn "processes when run, including any running client sessions!"
+               echo
+       else
+               if use timidity || use alsa ; then
+                       einfo "If you want music, you must copy the gm/ directory"
+                       einfo "to ${GAMES_DATADIR}/${PN}/"
+                       einfo "You can enable MIDI by running:"
+                       einfo "  openttd -m extmidi"
+                       echo
+                       if use timidity ; then
+                               einfo "You also need soundfonts for timidity, if you don't"
+                               einfo "know what that is, do:"
+                               echo
+                               einfo "emerge media-sound/timidity-eawpatches"
+                       else
+                               einfo "You have emerged with 'aplaymidi' for playing MIDI."
+                               einfo "You have to set the environment variable ALSA_OUTPUT_PORTS."
+                               einfo "Available ports can be listed by using 'aplaymidi -l'."
+                       fi
+               else
+                       einfo "timidity and/or alsa not in USE so music will not be played during the game."
+               fi
+               echo
+       fi
+}