commit:     6dc125c2ae1f5c17673d877c740b6818386ecc4e
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 15 08:25:56 2018 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Sun Apr 15 09:11:09 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6dc125c2

games-arcade/abe: Apply Fedora fixes and drop games.eclass usage

Package-Manager: Portage-2.3.28, Repoman-2.3.9

 games-arcade/abe/abe-1.1-r1.ebuild                 | 64 ++++++++++++++++
 games-arcade/abe/files/abe-1.1-doublefree.patch    | 11 +++
 .../abe/files/abe-1.1-format-security.patch        | 87 ++++++++++++++++++++++
 games-arcade/abe/files/abe-1.1-format.patch        | 11 +++
 4 files changed, 173 insertions(+)

diff --git a/games-arcade/abe/abe-1.1-r1.ebuild 
b/games-arcade/abe/abe-1.1-r1.ebuild
new file mode 100644
index 00000000000..25fb312e3b5
--- /dev/null
+++ b/games-arcade/abe/abe-1.1-r1.ebuild
@@ -0,0 +1,64 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit desktop toolchain-funcs
+
+DESCRIPTION="A scrolling, platform-jumping, key-collecting, ancient pyramid 
exploring game"
+HOMEPAGE="http://abe.sourceforge.net/";
+SRC_URI="mirror://sourceforge/abe/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86 ~x86-fbsd"
+IUSE=""
+
+DEPEND="media-libs/libsdl[sound,video]
+       x11-libs/libXi
+       media-libs/sdl-mixer[vorbis]"
+RDEPEND=${DEPEND}
+
+src_unpack() {
+       unpack ${A}
+       cd "${S}"
+       unpack ./images/images.tar
+}
+
+PATCHES=(
+       # From Fedora:
+       # Enable changing the video settings.  Sent upstream 2 Apr 2006:
+       # 
https://sourceforge.net/tracker/?func=detail&aid=1463202&group_id=70141&atid=526743
+       "${FILESDIR}"/${P}-settings.patch
+
+       # Fix a double free() bug.  Sent upstream 15 Mar 2011:
+       # 
https://sourceforge.net/tracker/?func=detail&aid=3214269&group_id=70141&atid=526745
+       "${FILESDIR}"/${P}-doublefree.patch
+
+       # Fix an incorrect printf format specifier.  Sent upstream 15 Mar 2011:
+       # 
https://sourceforge.net/tracker/?func=detail&aid=3214270&group_id=70141&atid=526745
+       "${FILESDIR}"/${P}-format.patch
+
+       # Fix build failure with -Werror=format-security
+       "${FILESDIR}"/${P}-format-security.patch
+)
+
+src_prepare() {
+       default
+       sed -i \
+               -e "/^TR_CFLAGS/d" \
+               -e "/^TR_CXXFLAGS/d" \
+               configure || die
+}
+
+src_configure() {
+       econf --with-data-dir=/usr/share/${PN}
+}
+
+src_install() {
+       dobin src/abe
+       insinto /usr/share/${PN}
+       doins -r images sounds maps
+       newicon tom1.bmp abe.bmp
+       make_desktop_entry abe "Abe's Amazing Adventure" 
/usr/share/pixmaps/abe.bmp
+       einstalldocs
+}

diff --git a/games-arcade/abe/files/abe-1.1-doublefree.patch 
b/games-arcade/abe/files/abe-1.1-doublefree.patch
new file mode 100644
index 00000000000..ce7389d9710
--- /dev/null
+++ b/games-arcade/abe/files/abe-1.1-doublefree.patch
@@ -0,0 +1,11 @@
+--- a/src/Main.c.orig  2005-03-05 09:20:04.000000000 -0700
++++ b/src/Main.c       2011-03-14 10:08:31.846413904 -0600
+@@ -35,8 +35,6 @@
+     for(i = 0; modes[i]; ++i)
+       printf("\t%d x %d\n", modes[i]->w, modes[i]->h);
+   }
+-
+-  free(modes);
+ }
+ 
+ void

diff --git a/games-arcade/abe/files/abe-1.1-format-security.patch 
b/games-arcade/abe/files/abe-1.1-format-security.patch
new file mode 100644
index 00000000000..ad88b4b6048
--- /dev/null
+++ b/games-arcade/abe/files/abe-1.1-format-security.patch
@@ -0,0 +1,87 @@
+--- ./src/Game.c.orig  2005-03-05 09:20:04.000000000 -0700
++++ ./src/Game.c       2013-11-20 12:30:00.000000000 -0700
+@@ -6,21 +6,14 @@ Game game;
+ 
+ // path_sprintf should not be used by other .c files, as it does not fit for 
them.
+ static void
+-path_sprintf(char *path, char *formatted_name, int version)
++path_sprintf(char *path, const char *name, int version)
+ {
+-
+-  int len;
+-
+-  printf("path_sprintf (%p, %s, %d)\n", path, formatted_name, version);
+-
+-  strcpy(path, getSaveGameDir());
+-
+-  len = strlen(path);
+-
+   if(1 == version) {
+-    sprintf(path + len, formatted_name);
++    printf("path_sprintf (%p, %s.dat, %d)\n", path, name, version);
++    sprintf(path, "%s%s.dat", getSaveGameDir(), name);
+   } else {
+-    sprintf(path + len, formatted_name, version);
++    printf("path_sprintf (%p, %s%d.dat, %d)\n", path, name, version, version);
++    sprintf(path, "%s%s%d.dat", getSaveGameDir(), name, version);
+   }
+ 
+ }
+@@ -30,14 +23,14 @@ deleteSavedGame()
+ {
+   char path[PATH_SIZE];
+   // version 2
+-  path_sprintf(path, "save%d.dat", GAME_VERSION);
++  path_sprintf(path, "save", GAME_VERSION);
+   remove(path);
+-  path_sprintf(path, "savedmap%d.dat", GAME_VERSION);
++  path_sprintf(path, "savedmap", GAME_VERSION);
+   remove(path);
+   // version 1
+-  path_sprintf(path, "save.dat", 1);
++  path_sprintf(path, "save", 1);
+   remove(path);
+-  path_sprintf(path, "savedmap.dat", 1);
++  path_sprintf(path, "savedmap", 1);
+   remove(path);
+ }
+ 
+@@ -51,7 +44,7 @@ saveGame()
+ 
+   mkshuae();
+ 
+-  path_sprintf(path, "save%d.dat", GAME_VERSION);
++  path_sprintf(path, "save", GAME_VERSION);
+ 
+   if(!(fp = fopen(path, "wb"))) {
+     err = strerror(errno);
+@@ -79,7 +72,7 @@ saveGame()
+   SDL_RWclose(rwop);
+ 
+   // save the map
+-  path_sprintf(path, "savedmap%d.dat", GAME_VERSION);
++  path_sprintf(path, "savedmap", GAME_VERSION);
+   saveMapPath(path);
+ }
+ 
+@@ -96,7 +89,7 @@ loadGame()
+   version = (int) GAME_VERSION;
+ 
+   // load the map
+-  path_sprintf(path, "savedmap%d.dat", GAME_VERSION);
++  path_sprintf(path, "savedmap", GAME_VERSION);
+   if(!loadMapPath(path, 0)) {
+     // if can't find saved map load static map
+     fprintf(stderr,
+@@ -112,9 +105,9 @@ loadGame()
+   // try to find a saved game of any version
+   while(version > 0) {
+     if(version > 1) {
+-      path_sprintf(path, "save%d.dat", version);
++      path_sprintf(path, "save", version);
+     } else {                    // By Pedro: version==1
+-      path_sprintf(path, "save.dat", version);
++      path_sprintf(path, "save", version);
+     }
+     fprintf(stderr, "Trying to load saved game: %s\n", path);
+     fflush(stderr);

diff --git a/games-arcade/abe/files/abe-1.1-format.patch 
b/games-arcade/abe/files/abe-1.1-format.patch
new file mode 100644
index 00000000000..52953474571
--- /dev/null
+++ b/games-arcade/abe/files/abe-1.1-format.patch
@@ -0,0 +1,11 @@
+--- a/src/MapIO.c.orig 2005-03-05 09:20:04.000000000 -0700
++++ b/src/MapIO.c      2011-03-14 10:15:33.166949366 -0600
+@@ -93,7 +93,7 @@
+   // compression step 1: read compressed data from disk
+   // FIXME: what would be nicer is to only allocate as much mem as used on 
disk.
+   size = LEVEL_COUNT * map.w * map.h;
+-  printf("size %u\n", size);
++  printf("size %zu\n", size);
+   fflush(stdout);
+   if(!(read_buff = (Uint16 *) malloc(sizeof(Uint16) * size))) {
+     fprintf(stderr, "Out of memory on map read.");

Reply via email to