commit:     619ceeea1e04055d825b2e9896dabc393f8ccf42
Author:     Hanno <hanno <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  7 15:58:14 2019 +0000
Commit:     Hanno Boeck <hanno <AT> gentoo <DOT> org>
CommitDate: Thu Feb  7 15:58:14 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=619ceeea

games-simulation/micropolis: Fix build with glibc 2.27.

Takes two patches from Debian to make it build on modern
systems and bump EAPI to 7.

Resolves: https://bugs.gentoo.org/650198
Signed-off-by: Hanno Boeck <hanno <AT> gentoo.org>
Package-Manager: Portage-2.3.59, Repoman-2.3.12

 .../micropolis/files/micropolis-glibc-2.27.patch   | 45 ++++++++++++++++
 .../files/micropolis-remove-matherr.patch          | 31 +++++++++++
 .../micropolis/micropolis-1.0-r2.ebuild            | 61 ++++++++++++++++++++++
 3 files changed, 137 insertions(+)

diff --git a/games-simulation/micropolis/files/micropolis-glibc-2.27.patch 
b/games-simulation/micropolis/files/micropolis-glibc-2.27.patch
new file mode 100644
index 00000000000..ee4fd33ae87
--- /dev/null
+++ b/games-simulation/micropolis/files/micropolis-glibc-2.27.patch
@@ -0,0 +1,45 @@
+From: Markus Koschany <a...@debian.org>
+Date: Tue, 13 Mar 2018 20:25:31 +0100
+Subject: glibc 2.27
+
+Remove SVID error handling to fix FTBFS with glibc 2.27.
+
+Forwarded: no
+Bug-Debian: https://bugs.debian.org/891338
+---
+ src/tclx/src/tclxfmat.c | 21 +--------------------
+ 1 file changed, 1 insertion(+), 20 deletions(-)
+
+diff --git a/src/tclx/src/tclxfmat.c b/src/tclx/src/tclxfmat.c
+index 19d42c3..2146566 100644
+--- a/src/tclx/src/tclxfmat.c
++++ b/src/tclx/src/tclxfmat.c
+@@ -119,27 +119,8 @@ static int
+ ReturnFPMathError (interp)
+     Tcl_Interp *interp;
+ {
+-    char *errorMsg;
+ 
+-    switch (G_errorType) {
+-       case DOMAIN: 
+-           errorMsg = "domain";
+-           break;
+-       case SING:
+-           errorMsg = "singularity";
+-           break;
+-       case OVERFLOW:
+-           errorMsg = "overflow";
+-           break;
+-       case UNDERFLOW:
+-           errorMsg = "underflow";
+-           break;
+-       case TLOSS:
+-       case PLOSS:
+-           errorMsg = "loss of significance";
+-           break;
+-    }
+-    Tcl_AppendResult (interp, "floating point ", errorMsg, " error",
++    Tcl_AppendResult (interp, "floating point error",
+                       (char *) NULL);
+     G_gotTclFPMathErr = FALSE;  /* Clear the flag. */
+     return TCL_ERROR;

diff --git a/games-simulation/micropolis/files/micropolis-remove-matherr.patch 
b/games-simulation/micropolis/files/micropolis-remove-matherr.patch
new file mode 100644
index 00000000000..c6bb1a1efc5
--- /dev/null
+++ b/games-simulation/micropolis/files/micropolis-remove-matherr.patch
@@ -0,0 +1,31 @@
+From: Markus Koschany <a...@debian.org>
+Date: Tue, 13 Mar 2018 21:42:31 +0100
+Subject: remove matherr
+
+Work around "tclxmerr.c:40:30: error: dereferencing pointer to incomplete type
+'struct exception'"
+
+---
+ src/tclx/src/tclxmerr.c | 9 ---------
+ 1 file changed, 9 deletions(-)
+
+diff --git a/src/tclx/src/tclxmerr.c b/src/tclx/src/tclxmerr.c
+index dc3596b..06aad3a 100644
+--- a/src/tclx/src/tclxmerr.c
++++ b/src/tclx/src/tclxmerr.c
+@@ -33,15 +33,6 @@
+  *
+  
*-----------------------------------------------------------------------------
+  */
+-int
+-matherr (except)
+-    struct exception *except;
+-{
+-    if (Tcl_MathError (except->name, except->type))
+-        return 1;
+-    else
+-        return 0;
+-}
+ 
+ #else
+ 

diff --git a/games-simulation/micropolis/micropolis-1.0-r2.ebuild 
b/games-simulation/micropolis/micropolis-1.0-r2.ebuild
new file mode 100644
index 00000000000..abf421c4d03
--- /dev/null
+++ b/games-simulation/micropolis/micropolis-1.0-r2.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+inherit eutils
+
+DESCRIPTION="Free version of the well-known city building simulation"
+HOMEPAGE="http://www.donhopkins.com/home/micropolis/";
+SRC_URI="http://www.donhopkins.com/home/micropolis/${PN}-activity-source.tgz
+       http://rmdir.de/~michael/${PN}_git.patch";
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="
+       media-libs/libsdl
+       media-libs/sdl-mixer
+       x11-libs/libX11
+       x11-libs/libXpm"
+DEPEND="${RDEPEND}
+       sys-devel/bison"
+
+S=${WORKDIR}/${PN}-activity/
+
+PATCHES=(
+       "${DISTDIR}"/${PN}_git.patch
+       "${FILESDIR}/micropolis-glibc-2.27.patch"
+       "${FILESDIR}/micropolis-remove-matherr.patch"
+)
+
+src_unpack() {
+       unpack ${PN}-activity-source.tgz
+}
+
+src_prepare() {
+       default
+
+       sed -i -e "s:-O3:${CFLAGS}:" \
+               src/tclx/config.mk src/{sim,tcl,tk}/makefile || die
+       sed -i -e "s:XLDFLAGS=:&${LDFLAGS}:" \
+               src/tclx/config.mk || die
+}
+
+src_compile() {
+       emake -C src LDFLAGS="${LDFLAGS}"
+}
+
+src_install() {
+       local dir=/usr/share/${PN}
+
+       exeinto "${dir}/res"
+       doexe src/sim/sim
+       insinto "${dir}"
+       doins -r activity cities images manual res
+
+       make_wrapper micropolis res/sim "${dir}"
+       doicon Micropolis.png
+       make_desktop_entry micropolis "Micropolis" Micropolis
+}

Reply via email to