games-emulation/zsnes: Stop using games.eclass
authorPacho Ramos <pacho@gentoo.org>
Sun, 29 Apr 2018 12:37:02 +0000 (14:37 +0200)
committerPacho Ramos <pacho@gentoo.org>
Sun, 29 Apr 2018 13:06:40 +0000 (15:06 +0200)
Package-Manager: Portage-2.3.31, Repoman-2.3.9

games-emulation/zsnes/files/zsnes-1.51-arch.patch
games-emulation/zsnes/files/zsnes-1.51-archopt-july-23-update.patch
games-emulation/zsnes/files/zsnes-1.51-buffer.patch
games-emulation/zsnes/files/zsnes-1.51-cross-compile.patch
games-emulation/zsnes/files/zsnes-1.51-gcc47.patch
games-emulation/zsnes/files/zsnes-1.51-libao-thread.patch
games-emulation/zsnes/files/zsnes-1.51-libpng.patch
games-emulation/zsnes/files/zsnes-1.51-stack-align.patch
games-emulation/zsnes/zsnes-1.51-r6.ebuild [new file with mode: 0644]

index 2c8b690587be81578a510c908580f1cac03b37b7..b39549871b7fcce18b0a8fe5bf9208431aced506 100644 (file)
@@ -1,5 +1,5 @@
---- configure.in.orig
-+++ configure.in
+--- a/configure.in.orig
++++ b/configure.in
 @@ -233,72 +233,8 @@
    debug=no)
  AC_MSG_CHECKING(if you want gdb friendly executable)
index ba118878a2bd74865c2a910424a62e44926cfc6c..b3e466036f22f8d12d0e0341e3601e04a8a47352 100644 (file)
@@ -1,5 +1,5 @@
---- tools/archopt.c.old
-+++ tools/archopt.c
+--- a/tools/archopt.c.old
++++ b/tools/archopt.c
 @@ -1,8 +1,30 @@
 +/*
 +Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com )
index 5f3049b315eda8be56eda49eb890434bb23fbc01..eb463682196d05c1a34f72ee602b6983665439d2 100644 (file)
@@ -1,5 +1,5 @@
---- zsnes_1_51/src/initc.c.fortify
-+++ zsnes_1_51/src/initc.c
+--- src/initc.c.fortify
++++ src/initc.c
 @@ -1464,8 +1464,8 @@
    clearmem2();
  }
@@ -38,8 +38,8 @@
  
      if (yesoutofmemory) { asm_call(outofmemfix); }
      asm_call(GUIDoReset);
---- zsnes_1_51/src/zstate.c.fortify
-+++ zsnes_1_51/src/zstate.c
+--- src/zstate.c.fortify
++++ src/zstate.c
 @@ -99,15 +99,15 @@
    copy_func(buffer, &cycpbl, 4);
    copy_func(buffer, &cycpblt, 4);
@@ -68,8 +68,8 @@
      }
      */
    }
---- zsnes_1_51/src/gblvars.h.fortify
-+++ zsnes_1_51/src/gblvars.h
+--- src/gblvars.h.fortify
++++ src/gblvars.h
 @@ -33,9 +33,9 @@
  extern unsigned int SfxR0, *setaramdata, ramsize, *sram, nmiprevaddrh;
  extern unsigned int tempesi, tempedi, tempedx, tempebp;
index 5823c6aa6aded6fb93c546f75b1c04ac303aba63..5c412e3e649b3b3934a5bc517a83f46b40dbc4c0 100644 (file)
@@ -1,5 +1,5 @@
---- a/src/acinclude.m4
-+++ b/src/acinclude.m4
+--- src/acinclude.m4
++++ src/acinclude.m4
 @@ -107,7 +107,7 @@ int main (int argc, char *argv[])
    with_zlib=yes,
    with_zlib=no,
@@ -18,8 +18,8 @@
    ZLIB_CFLAGS=""
    ZLIB_LIBS=""
    ZLIB_VERSION=""
---- a/src/Makefile.in
-+++ b/src/Makefile.in
+--- src/Makefile.in
++++ src/Makefile.in
 @@ -103,8 +103,10 @@ main: makefile.dep $(Z_OBJS)
        @ZC@ -o @ZSNESEXE@ $(Z_OBJS) @ZCFLAGS@ @LDFLAGS@
        rm -f version.o
index e581024152122a1ed657601cd35fd8eb620f7f16..b3250fee679b43455ddee7acc47aae09da9f2a35 100644 (file)
@@ -3,8 +3,8 @@ Bug #419635
 https://bugs.gentoo.org/show_bug.cgi?id=419635
 Submitted by Nikos Chantziaras
 
---- a/src/tools/depbuild.cpp
-+++ b/src/tools/depbuild.cpp
+--- src/tools/depbuild.cpp
++++ src/tools/depbuild.cpp
 @@ -25,6 +25,7 @@
  #include <string>
  #include <cstdio>
index 880e08c698fe80f9846a55bf98208b1463acf373..1ae0a1467b3e4c03da0e05bc7c9bbfdd60882ae3 100644 (file)
@@ -1,5 +1,5 @@
---- linux/audio.c.old   2007-01-09 20:19:12.000000000 -0500 
-+++ linux/audio.c   2007-12-30 20:33:07.000000000 -0500 
+--- a/linux/audio.c.old   2007-01-09 20:19:12.000000000 -0500 
++++ b/linux/audio.c   2007-12-30 20:33:07.000000000 -0500 
 @@ -177,11 +177,7 @@ 
    }
    else
index 4e49054c097298d4e1622abcdbe3c0c988ca9d5d..fd974e799e302b29f9a45855adea585bc3ed22c1 100644 (file)
@@ -1,5 +1,5 @@
---- acinclude.m4
-+++ acinclude.m4
+--- a/acinclude.m4
++++ b/acinclude.m4
 @@ -163,21 +163,21 @@
    libpng_prefix="")
  
index 32136643caec3e17dd965ab5cd0f023582f305ab..5dcbf3ad9ebc90771e07080d85f089a7a2fa0bdb 100644 (file)
@@ -1,5 +1,5 @@
---- zsnes_1_51/src/linux/sdllink.c.old
-+++ zsnes_1_51/src/linux/sdllink.c
+--- src/linux/sdllink.c.old
++++ src/linux/sdllink.c
 @@ -773,11 +773,11 @@ BOOL InitInput()
  {
    InitJoystickInput();
diff --git a/games-emulation/zsnes/zsnes-1.51-r6.ebuild b/games-emulation/zsnes/zsnes-1.51-r6.ebuild
new file mode 100644 (file)
index 0000000..bf19342
--- /dev/null
@@ -0,0 +1,117 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit autotools desktop flag-o-matic toolchain-funcs pax-utils
+
+DESCRIPTION="SNES (Super Nintendo) emulator that uses x86 assembly"
+HOMEPAGE="http://www.zsnes.com/ http://ipherswipsite.com/zsnes/"
+SRC_URI="mirror://sourceforge/zsnes/${PN}${PV//./}src.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="-* ~amd64 ~x86 ~x86-fbsd ~amd64-linux ~x86-linux"
+IUSE="ao custom-cflags +debug opengl pax_kernel png"
+
+RDEPEND="
+       media-libs/libsdl[sound,video,abi_x86_32(-)]
+       >=sys-libs/zlib-1.2.3-r1[abi_x86_32(-)]
+       ao? ( media-libs/libao[abi_x86_32(-)] )
+       debug? ( sys-libs/ncurses:0=[abi_x86_32(-)] )
+       opengl? ( virtual/opengl[abi_x86_32(-)] )
+       png? ( media-libs/libpng:0=[abi_x86_32(-)] )
+"
+DEPEND="${RDEPEND}
+       dev-lang/nasm
+       debug? ( virtual/pkgconfig )
+"
+
+S="${WORKDIR}/${PN}_${PV//./_}/src"
+
+src_prepare() {
+       default
+
+       # Fixing compilation without libpng installed
+       # Fix bug #186111
+       # Fix bug #214697
+       # Fix bug #170108
+       # Fix bug #260247
+       # Fix compability with libpng15 wrt #378735
+       # Fix buffer overwrite #257963
+       # Fix gcc47 compile #419635
+       # Fix stack alignment issue #503138
+       eapply \
+               "${FILESDIR}"/${P}-libpng.patch \
+               "${FILESDIR}"/${P}-archopt-july-23-update.patch \
+               "${FILESDIR}"/${P}-gcc43.patch \
+               "${FILESDIR}"/${P}-libao-thread.patch \
+               "${FILESDIR}"/${P}-depbuild.patch \
+               "${FILESDIR}"/${P}-CC-quotes.patch \
+               "${FILESDIR}"/${P}-libpng15.patch \
+               "${FILESDIR}"/${P}-buffer.patch \
+               "${FILESDIR}"/${P}-gcc47.patch \
+               "${FILESDIR}"/${P}-stack-align.patch \
+               "${FILESDIR}"/${P}-cross-compile.patch \
+               "${FILESDIR}"/${P}-arch.patch
+
+       # The sdl detection logic uses AC_PROG_PATH instead of
+       # AC_PROG_TOOL, so force the var to get set the way we
+       # need for things to work correctly.
+       tc-is-cross-compiler && export ac_cv_path_SDL_CONFIG=${CHOST}-sdl-config
+
+       sed -i -e '67i#define OF(x) x' zip/zunzip.h || die
+
+       # Remove hardcoded CFLAGS and LDFLAGS
+       sed -i \
+               -e '/^CFLAGS=.*local/s:-pipe.*:-Wall -I.":' \
+               -e '/^LDFLAGS=.*local/d' \
+               -e '/\w*CFLAGS=.*fomit/s:-O3.*$STRIP::' \
+               -e '/lncurses/s:-lncurses:`pkg-config ncurses --libs`:' \
+               -e '/lcurses/s:-lcurses:`pkg-config ncurses --libs`:' \
+               configure.in || die
+       sed -i \
+               -e 's/configure.in/configure.ac/' \
+               Makefile.in || die
+       mv configure.in configure.ac || die
+       eautoreconf
+}
+
+src_configure() {
+       tc-export CC
+       export BUILD_CXX=$(tc-getBUILD_CXX)
+       export NFLAGS=-O1
+       use amd64 && multilib_toolchain_setup x86
+       use custom-cflags || strip-flags
+
+       append-cppflags -U_FORTIFY_SOURCE       #257963
+
+       econf \
+               $(use_enable ao libao) \
+               $(use_enable debug debugger) \
+               $(use_enable png libpng) \
+               $(use_enable opengl) \
+               --disable-debug \
+               --disable-cpucheck
+}
+
+src_compile() {
+       emake makefile.dep
+       emake
+}
+
+src_install() {
+       dobin zsnes
+       if use pax_kernel; then
+               pax-mark m "${D}""${GAMES_BINDIR}"/zsnes || die
+       fi
+
+       newman linux/zsnes.1 zsnes.6
+
+       dodoc \
+               ../docs/{readme.1st,authors.txt,srcinfo.txt,stdards.txt,support.txt,thanks.txt,todo.txt,README.LINUX} \
+               ../docs/readme.txt/*
+       HTML_DOCS="../docs/readme.htm/*" einstalldocs
+
+       make_desktop_entry zsnes ZSNES
+       newicon icons/48x48x32.png ${PN}.png
+}