summaryrefslogtreecommitdiff
path: root/games-emulation/zsnes
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /games-emulation/zsnes
reinit the tree, so we can have metadata
Diffstat (limited to 'games-emulation/zsnes')
-rw-r--r--games-emulation/zsnes/Manifest17
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-CC-quotes.patch20
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-arch.patch77
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-archopt-july-23-update.patch502
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-buffer.patch85
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-cross-compile.patch34
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-depbuild.patch24
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-gcc43.patch48
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-gcc47.patch15
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-libao-thread.patch25
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-libpng.patch33
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-libpng15.patch12
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-stack-align.patch15
-rw-r--r--games-emulation/zsnes/metadata.xml15
-rw-r--r--games-emulation/zsnes/zsnes-1.51-r4.ebuild112
15 files changed, 1034 insertions, 0 deletions
diff --git a/games-emulation/zsnes/Manifest b/games-emulation/zsnes/Manifest
new file mode 100644
index 000000000000..146cfb82e5dd
--- /dev/null
+++ b/games-emulation/zsnes/Manifest
@@ -0,0 +1,17 @@
+AUX zsnes-1.51-CC-quotes.patch 740 SHA256 73f4cfa22b93c9633bb5e748054bbabb75a03634988cddea0f1c4c8f6bca71bc SHA512 2347910158934a7c8b90a6739f923d7a1f94e963515dca42d45eb97e6165c5f80c30d28fd151537a7a80bba16d2462568ff1c1dac93a855990f0418aaf059776 WHIRLPOOL 6c8d0bfc63a7e0de53efb3881e37d15a27d614ce5bc69c55ccc5245db1d7be707c31807c3e0e0054cc5ab7136cd525c45b91e03837acda248097defd63d7b6db
+AUX zsnes-1.51-arch.patch 2480 SHA256 380ff481d232dfe467fa362652de6ac9481b72788a56fa258cd3d57a4e011b2b SHA512 669e6a68978dc0ad27268dece47ff0a2027586534ce88ef08eeb51464137026afcb51ef4c1222013a75bcd430dfa022919aad0dce932035479ebb72408971eb8 WHIRLPOOL 59c2858e4dc94d4b0547ebd6827076cf86f6206d47fa1df2314d1e32ca9f098a0bf7620f3bf50aae29d970346efe6871658c261330e1ec5670590c4e65e01cad
+AUX zsnes-1.51-archopt-july-23-update.patch 12668 SHA256 6d134d3cc8682ed71fc287023cb5e234aa9bbbd162d4a9de69ff6e3ff549f645 SHA512 a02ba164e2f06915b7de92032b7757f90b545e2afd4275805ea3466ddb6f1f9f0973fbc838c690441a10bbc70fb9be12fc95e5fde19c0505f4264cae2721c944 WHIRLPOOL 9f17c365befa0dc31177f6afe3610a6cc5ae71c89a37998067e29b439c9e45ff8424720155a2f1a6314e2fd94b4e6dd19b8fad365bb89ccc53b61a0c852617dc
+AUX zsnes-1.51-buffer.patch 3157 SHA256 177fb1df4ecddf1e120cc7cb788d76ac8a18078edc2c9818691a6f7919f3ac2c SHA512 b9a18c288f59413a7bd7f25622774440124de8ab356bfa48ea29b0db39ec6380d7df715eaca031bcff0fcb4f94dfc6f3b1f0770bf29cc9324e096ee5a6876f47 WHIRLPOOL 303683c6410a3de8c6557e4a2292a61e76f9934ac0f8432e903525fc017964720c9eeddc81b79b9492c46e04c9215b1a47cbbe62565836c084caae0ad584ecdd
+AUX zsnes-1.51-cross-compile.patch 942 SHA256 76c5925b5725ce7bcfb7bf071f75938928c5c70370eb57134a96ec434e161b35 SHA512 3059c466f32b74f3a6d583fb425c3f23f7a295800474baa49c4baee69fc047ff5f49107225f3a9917aed76697b50ff07e474a2fe666402d1bcd032e00959e7be WHIRLPOOL 58b01465c89abfa202a7ae5549547335c0d444a1a310f02003834ef0479091a55290ffc9addefa0e6213b6f9cc670c2fa026a678fa12169fabeb32458ce184bd
+AUX zsnes-1.51-depbuild.patch 559 SHA256 2e6e0bb1fbccee7635f30174f1607db7a11036c8af26e8c25b4aa78204da6f22 SHA512 46955153ec6d2ecd5a295117c3ecc911a566de69f29f4d29decc98867d03e4a53a980a3c75d8ff19bbd1655eb291069fbbd598e002a73ebdbdc94c135f852c6e WHIRLPOOL 0896f33b9d482286336a4679035289bb5a4f3b9d8c055f4f6e88a40447c02fed33ce3db79a99968e8fc3bae5e005d68ff9fa6bdb854e8b66209e2f260f098d70
+AUX zsnes-1.51-gcc43.patch 913 SHA256 9eb0aff2be2b303295b0d0a76240facd13dca170b97fe3ee827a6c26d89d53de SHA512 8684b9b8c01d2d9f27bf27a86e4705b3408a2891347045266040397b649eb162962e8384746930c9837ac9b21bfd626d6e241d8a6c73b46a0e348274dd8688d3 WHIRLPOOL 2024f3c0d611c7cb489e06b8a1458bf4d78f216f34d176f692c79a5420c933440f911e7439c980ecb801e413c6a335b766b0c5ea0023e8d4af331b82dbaa6e96
+AUX zsnes-1.51-gcc47.patch 316 SHA256 ccd1343e51a294c425e14dfc2a9a4f519111630a0e8dfb6a33438fd336693e38 SHA512 3e9adecac963fd2769edcb979dde262ed54247f8d7f63b34d2f5f472e5d6eeb7bc3879de24210d312c5d1d4694abc32aeb9e853d3ab2ec7b7bad6794716e4da4 WHIRLPOOL a75bae4cab301cfbf9455bcf9ffad5bd83670ceaeb9d826867eeb81fd6aea531619332e110e61ddf57c7eaa83ef17913550ea46c639f16917112e39f106035c5
+AUX zsnes-1.51-libao-thread.patch 663 SHA256 71be0bbb8b683edc7c7780b68a43e54be7a8c341bf9b2a01e5cceb53834b1a73 SHA512 3b7dab3e8f7e55b5295ad728279aa116b0e1f63a9bfad398b55a2d7f5ba55c806311952311f3f3ac91803d903e91b724f6ceea53a15b5fe485a7b3c2e5dafbab WHIRLPOOL c0cf4462f0ca48859af7832dbcc3e41f947eb73b56cb28703d553826ac19462ed0b6d6190d8fa7bb08ec1a9dea61231047da95424ddaec1f409b906de5c2089c
+AUX zsnes-1.51-libpng.patch 854 SHA256 8fa8614c9dd4360c05fb4c581a8c8aba89195dc4da0c087daa18845b7ab499be SHA512 210dcba006bdf6c18bb55e106e8bb2fcb9691deb89874fd4f9e034f2aaf9e8e96543b2177d31b94c121a811b80de6352b7b420fa8d0760055dc1d4df43bbaa68 WHIRLPOOL c1e1a97a9ec17a1934c493194028c640a7318eb60f9da564c9da34c6925a3deb65fb403adcd8ae6834a6b9afc76d85852c3c0168f3bea14f519d8c52232a8187
+AUX zsnes-1.51-libpng15.patch 510 SHA256 c9636e76441ae1624c8ddc92e47facc20b43871fb0f55fd50d526b10944c6560 SHA512 4191987cad2f8dd7d7fd1d4f8f0c60de07059f18a60cb9bb94f1e5c35c06122032de9887762ebcf2d255f24c3e90aa5b4f6a7540a8e4dbdc4ce5f7d3b3e3b532 WHIRLPOOL 4c8e6565a8b1d2d040f545f57dda751bcf387828c3153cf71459bdd72252ac62d66317dd3fef51cba10cfce372391aba7d4bfb5e2fdce7782484fce2a4b7c6c2
+AUX zsnes-1.51-stack-align.patch 305 SHA256 27334a55c6502ab257284a952c403de99976493f306f69960d2fb69f2fef5962 SHA512 632016ee78c62b02266f81ddde77c06ffaaffbbaa95d56a28b7830aec1befa2dd6a836a589ff6785a9971608a212868bf73a6a41bef2b348ab138cd03834f37b WHIRLPOOL 3dc5d066ad81a5746567e7a7ec6deffbc57b9e958ff723dbe5efe8713d7875bd62dca8b5c87ef60172ada19ea01c18685ffdf9a9260502c96f969c12a03a68b0
+DIST zsnes151src.tar.bz2 1071712 SHA256 eb013f824f5a9814a714cf0daaea3ea68a1c74fd741e5b0979fcb7964236a866 SHA512 2cec9ad7762fc7a257c6b1d3e190b0ed53565dbafe42e1dee9eb182644392b7dd2c57faa846f63cd30ac079e5c05354d26ce0612d20481a1f54d760d62d95353 WHIRLPOOL a023003bcad23dc1da20338dc6adaf6a4061f70f9968a436c5ffeb3263ead85786909b1c2225c0762cd8f0f0a0757c52773326ad2c800f38fcc714f40e4b2162
+EBUILD zsnes-1.51-r4.ebuild 3233 SHA256 028337974971f404bc485678de8d4a9422e86d256208ad83998490255f82bc8d SHA512 140db768b2719ee45394e568eeb0eecd0652e19dfe224cc860ff19036e144e392c33a6d26c07e518ae3dfa78711dbb8a9ac18c9ad919afc8f573927670705a1a WHIRLPOOL 457eccd78a22bf5b6ba86013e10bc20eb17393651760c8f8edcca56352f20e4ef969f6015081823ea6cdec163713d3b422d7aafc712e4ec9adabbee0905003a0
+MISC ChangeLog 3230 SHA256 05cc7a6a36adf61027ce4f8048dd0882fc65529dd294e299d0c9b009d4ec7b05 SHA512 41f25a69de510351d122afaa5c2d8728da3c792024f276de701b43b32a78cf5c0dcab87cf123270bc64bb783c73117af13e5e95a66ed246a529bec7a5e385210 WHIRLPOOL a93c5ab34415074819878b89444b1a18bbbb13c17232962106478c1bdc05d21396212186b4bb78424f339e454ff60bed7c320fbf8e057e8e8704fd02719ed769
+MISC ChangeLog-2015 12178 SHA256 2a46988cf3a061d0d5856c4950a672fdc12bfef4c22b087b0f735a30a1ed69b1 SHA512 55d81d4dfdee1efd691b66d306df4327b3b40bc7efdf5b328499a7e25998631c89f3c94b3406d2a39a742dbb264c49544db92313d15083e7b43b965d26e6f40a WHIRLPOOL dcd445faadc8ea8ae79dce10fc7a8a7481a0bef416803c7f205ad2fcb512f39779201503a9a0dcba6a47ac78bcceed80b2d5b86a0dd5f2716e6db4eccb62352f
+MISC metadata.xml 484 SHA256 0ee62ef9e4412202371ae0b69f37423cd9b9a65fafcee2e3d9ae7da13207a9a8 SHA512 02318871d54bfa7d9c4ba2a64f3ed7c83bf45b04a5c66dda5659d935b943a2415e6eaad124ac34e3c4235ba57f21c1189b03fec4f622c19eec1873531727a622 WHIRLPOOL 9778a82039d95f7149a107df369c906b036584d8b063511b3c1d584da38dfaecde0fa0a4f783182d88519d85aa59114d26b3b8929da88968eda03d43eca855ae
diff --git a/games-emulation/zsnes/files/zsnes-1.51-CC-quotes.patch b/games-emulation/zsnes/files/zsnes-1.51-CC-quotes.patch
new file mode 100644
index 000000000000..d3230d6d70d5
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-CC-quotes.patch
@@ -0,0 +1,20 @@
+--- src/Makefile.in.orig
++++ src/Makefile.in
+@@ -95,7 +95,7 @@
+ %.o: %.cpp
+ @CXX@ @CXXFLAGS@ -o $@ -c $<
+ %.o %.h: %.psr $(PSR)
+- ./$(PSR) @PSRFLAGS@ -gcc @CC@ -compile -flags "@CFLAGS@ -O1" -cheader $*.h -fname $* $*.o $<
++ ./$(PSR) @PSRFLAGS@ -gcc "@CC@" -compile -flags "@CFLAGS@ -O1" -cheader $*.h -fname $* $*.o $<
+
+ default: main
+ all: main tools--- zsnes_1_51/src/Makefile.in.orig 2009-02-25 18:02:07.000000000 +0100
+@@ -133,7 +133,7 @@
+
+ include makefile.dep
+ makefile.dep: $(TOOL_D)/depbuild Makefile
+- $(TOOL_D)/depbuild @CC@ "@CFLAGS@" @NASMPATH@ "@NFLAGS@" $(Z_OBJS) > makefile.dep
++ $(TOOL_D)/depbuild "@CC@" "@CFLAGS@" @NASMPATH@ "@NFLAGS@" $(Z_OBJS) > makefile.dep
+
+ Makefile: Makefile.in config.status
+ ./config.status
diff --git a/games-emulation/zsnes/files/zsnes-1.51-arch.patch b/games-emulation/zsnes/files/zsnes-1.51-arch.patch
new file mode 100644
index 000000000000..2c8b690587be
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-arch.patch
@@ -0,0 +1,77 @@
+--- configure.in.orig
++++ configure.in
+@@ -233,72 +233,8 @@
+ debug=no)
+ AC_MSG_CHECKING(if you want gdb friendly executable)
+ AC_MSG_RESULT($debug)
+-if test x$debug = xyes; then
+-dnl - It is easier to debug zsnes with no optimization enabled.
+- ZSNESEXE="zsnesd"
+- PSR_TEMP=""
+- CFLAGS="$CFLAGS -Wall -W -DDEBUG -O0 -fno-omit-frame-pointer -gstabs3"
+- NFLAGS="$NFLAGS -DDEBUG -g -F stabs -s -O0"
+-else
+- ZSNESEXE="zsnes"
+- PSR_TEMP=" rm -f t_\$*.c"
+-
+- CFLAGSBAK="$CFLAGS"
+- AC_ARG_VAR(force_arch, [Force architecture to optimize GCC/G++ for])
+- AC_MSG_CHECKING(which cpu architecture to optimize for)
+- if test x$force_arch != x; then
+- CFLAGS="$CFLAGS -march=$force_arch"
+- AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]])],
+- [AC_MSG_RESULT(forcing $force_arch)],
+- [AC_MSG_RESULT($force_arch ??)
+- AC_MSG_WARN(incorrect force_arch parameter)
+- force_arch=""
+- CFLAGS="$CFLAGSBAK"
+- AC_MSG_CHECKING(for autodetected architecture)])
+- else
+- if test x$ARCH_INFO = x; then
+- case x$target in
+- i686-*-*)
+- AC_MSG_RESULT(guessing i686)
+- CFLAGS="$CFLAGS -march=i686"
+- ;;
+- i586-*-*)
+- AC_MSG_RESULT(guessing i586)
+- CFLAGS="$CFLAGS -march=i586"
+- ;;
+- i486-*-*)
+- AC_MSG_RESULT(guessing i486)
+- CFLAGS="$CFLAGS -march=i486"
+- ;;
+- *)
+- AC_MSG_RESULT(guessing i386)
+- CFLAGS="$CFLAGS -march=i386"
+- AC_MSG_WARN([This is not what you want, use --target or force-arch])
+- ;;
+- esac
+- else
+- AC_MSG_RESULT($ARCH_INFO)
+- CFLAGS="$CFLAGS -march=$ARCH_INFO"
+- fi
+- fi
+-
+- AC_ARG_ENABLE(release,
+- [ --enable-release Build ultra-optimized release binary (zsnes)],
+- release=$enableval,
+- release=no)
+- AC_MSG_CHECKING(if you want crazy optimizations)
+- AC_MSG_RESULT($release)
+- if test x$release = xyes; then
+- if test x$force_arch = x; then
+- AC_MSG_WARN([If you intend to distribute this binary, make sure you use force_arch and set to i586 (or whichever CPU Arch you intend for)])
+- fi
+- CFLAGS="$CFLAGS -O3 -fomit-frame-pointer -fprefetch-loop-arrays -fforce-addr $STRIP -D__RELEASE__"
+- NFLAGS="$NFLAGS -O99999999 -D__RELEASE__"
+- else
+- CFLAGS="$CFLAGS -O3 -fomit-frame-pointer $STRIP"
+- NFLAGS="$NFLAGS -O1"
+- fi
+-fi
++ZSNESEXE="zsnes"
++PSR_TEMP=" rm -f t_\$*.c"
+ CXXFLAGS="$CFLAGS -fno-rtti"
+
+ if test x$enable_jma != xno; then
diff --git a/games-emulation/zsnes/files/zsnes-1.51-archopt-july-23-update.patch b/games-emulation/zsnes/files/zsnes-1.51-archopt-july-23-update.patch
new file mode 100644
index 000000000000..ba118878a2bd
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-archopt-july-23-update.patch
@@ -0,0 +1,502 @@
+--- tools/archopt.c.old
++++ tools/archopt.c
+@@ -1,8 +1,30 @@
++/*
++Copyright (C) 2005-2007 Nach, grinvader ( http://www.zsnes.com )
++
++This program is free software; you can redistribute it and/or
++modify it under the terms of the GNU General Public License
++version 2 as published by the Free Software Foundation.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++*/
++
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <ctype.h>
+
++#ifdef _M_X64
++#define __x86_64__
++#endif
++
++#ifdef __GNUC__
+ #ifdef __x86_64__
+ #define cpuid(in, a, b, c, d) asm volatile("cpuid": "=a" (a), "=b" (b), "=c" (c), "=d" (d) : "a" (in));
+ #else
+@@ -13,6 +35,22 @@
+ movl %%ebx,%%edi;\
+ popl %%ebx": "=a" (a), "=D" (b), "=c" (c), "=d" (d) : "a" (in));
+ #endif
++#else
++char cpubuf[256];
++int z_in, z_a, z_b, z_c, z_d;
++void cpuid_run()
++{
++ _asm {
++ mov eax,z_in
++ cpuid
++ mov z_a,eax
++ mov z_b,ebx
++ mov z_c,ecx
++ mov z_d,edx
++ };
++}
++#define cpuid(in, a, b, c, d) z_in = in; cpuid_run(); a = z_a; b = z_b; c = z_c; d = z_d;
++#endif
+
+ char *x86_flags[] =
+ { "fpu", "vme", "de", "pse", "tsc", "msr", "pae", "mce",
+@@ -62,6 +100,7 @@
+ {
+ int have = 0x200000;
+ #ifndef __x86_64__
++ #ifdef __GNUC__
+ asm volatile
+ (
+ " pushfl;"
+@@ -76,6 +115,23 @@
+ : "=a" (have)
+ : "c" (have)
+ );
++ #else
++ z_c = have;
++ _asm {
++ mov ecx,z_c
++ pushfd
++ pop eax
++ mov edx,eax
++ xor eax,ecx
++ push eax
++ popfd
++ pushfd
++ pop eax
++ xor eax,edx
++ mov z_a,eax
++ };
++ have = z_a;
++ #endif
+ #endif
+ return(have);
+ }
+@@ -196,238 +252,268 @@
+ cpu = "native";
+ #endif
+ #endif
+-
+- if (!cpu && *cpu_family && *vendor_id)
++ if (!cpu)
+ {
+- if (!strcmp(vendor_id, "AuthenticAMD") || strstr(model_name, "AMD"))
++ if (!cpu && *cpu_family && *vendor_id)
+ {
+- if (strstr(flags, " mmx "))
++ #ifdef __GNUC__
++ if (!strcmp(vendor_id, "AuthenticAMD") || strstr(model_name, "AMD"))
+ {
+- #if __GNUC__ > 2
+- if (strstr(flags, " 3dnow "))
++ if (strstr(flags, " mmx "))
+ {
+- if (strstr(flags, " 3dnowext ") && (atoi(cpu_family) > 5))
++ #if __GNUC__ > 2
++ if (strstr(flags, " 3dnow "))
+ {
+- #if __GNUC__ > 3 || __GNUC_MINOR__ > 0
+- if (strstr(flags, " sse "))
++ if (strstr(flags, " 3dnowext ") && (atoi(cpu_family) > 5))
+ {
+- #if __GNUC__ > 3 || __GNUC_MINOR__ > 3
+- if (strstr(flags, " sse2 ") && strstr(flags, " lm ")) //Need two checks to protect Semprons
++ #if __GNUC__ > 3 || __GNUC_MINOR__ > 0
++ if (strstr(flags, " sse "))
+ {
+- if (strstr(model_name, "Opteron"))
+- {
+- cpu = "opteron";
+- }
+- else if (strstr(model_name, "Athlon(tm) 64")) //Also athlon-fx
++ #if __GNUC__ > 3 || __GNUC_MINOR__ > 3
++ if (strstr(flags, " sse2 ") && strstr(flags, " lm ")) //Need two checks to protect Semprons
+ {
+- cpu = "athlon64";
++ if (strstr(model_name, "Opteron"))
++ {
++ cpu = "opteron";
++ }
++ else if (strstr(model_name, "Athlon(tm) 64")) //Also athlon-fx
++ {
++ cpu = "athlon64";
++ }
++ else
++ {
++ cpu = "k8";
++ }
+ }
+- else
++ #endif
++ if (!cpu)
+ {
+- cpu = "k8";
++ if (strstr(model_name, "Athlon(tm) 4"))
++ {
++ cpu = "athlon-4";
++ }
++ else if (strstr(model_name, "Athlon(tm) MP"))
++ {
++ cpu = "athlon-mp";
++ }
++ else
++ {
++ cpu = "athlon-xp";
++ }
+ }
+ }
++
++ if (!cpu && (atoi(model) > 3))
++ {
++ cpu = "athlon-tbird";
++ }
+ #endif
++
+ if (!cpu)
+ {
+- if (strstr(model_name, "Athlon(tm) 4"))
+- {
+- cpu = "athlon-4";
+- }
+- else if (strstr(model_name, "Athlon(tm) MP"))
+- {
+- cpu = "athlon-mp";
+- }
+- else
+- {
+- cpu = "athlon-xp";
+- }
++ cpu = "athlon";
+ }
+ }
+
+- if (!cpu && (atoi(model) > 3))
+- {
+- cpu = "athlon-tbird";
+- }
+- #endif
+-
++ #if __GNUC__ > 3 || __GNUC_MINOR__ > 0
+ if (!cpu)
+ {
+- cpu = "athlon";
++ int model_num = atoi(model);
++ if ((model_num == 9) || (model_num >= 13))
++ {
++ cpu = "k6-3";
++ }
++ else
++ {
++ cpu = "k6-2";
++ }
+ }
++ #endif
+ }
++ #endif
+
+- #if __GNUC__ > 3 || __GNUC_MINOR__ > 0
+ if (!cpu)
+ {
+- int model_num = atoi(model);
+- if ((model_num == 9) || (model_num >= 13))
+- {
+- cpu = "k6-3";
+- }
+- else
+- {
+- cpu = "k6-2";
+- }
++ cpu = "k6";
+ }
+- #endif
+- }
+- #endif
+-
+- if (!cpu)
+- {
+- cpu = "k6";
+ }
+ }
+- }
+- else if (!strcmp(vendor_id, "GenuineIntel") || strstr(model_name, "Intel"))
+- {
+- #if __GNUC__ > 2
+- if (strstr(flags, " mmx "))
++ else if (!strcmp(vendor_id, "GenuineIntel") || strstr(model_name, "Intel"))
+ {
+- if (strstr(flags, " sse "))
++ #if __GNUC__ > 2
++ if (strstr(flags, " mmx "))
+ {
+- if (strstr(flags, " sse2 "))
++ if (strstr(flags, " sse "))
+ {
+- #if __GNUC__ > 3 || __GNUC_MINOR__ > 2
+- if (strstr(flags, " pni ") && strcmp(cpu_family, "6"))
++ if (strstr(flags, " sse2 "))
+ {
+- if (strstr(flags, " lm "))
++ #if __GNUC__ > 3 || __GNUC_MINOR__ > 2
++ if (strstr(flags, " pni ") && strcmp(cpu_family, "6"))
+ {
+- cpu = "nocona";
++ if (strstr(flags, " lm "))
++ {
++ cpu = "nocona";
++ }
++ else
++ {
++ cpu = "prescott";
++ }
+ }
+- else
++ #endif
++
++ if (!cpu)
+ {
+- cpu = "prescott";
++ if (!strcmp(cpu_family, "6"))
++ {
++ #if __GNUC__ > 3 || __GNUC_MINOR__ > 3
++ cpu = "pentium-m";
++ #else
++ cpu = "pentium3";
++ #endif
++ }
++ else
++ {
++ #if __GNUC__ > 3 || __GNUC_MINOR__ > 3
++ if (strstr(model_name, "Mobile"))
++ {
++ cpu = "pentium4m";
++ }
++ #endif
++
++ if (!cpu)
++ {
++ cpu = "pentium4";
++ }
++ }
+ }
+ }
+- #endif
+-
+- if (!cpu)
++ else
+ {
+- if (!strcmp(cpu_family, "6"))
++ #if __GNUC__ > 3 || __GNUC_MINOR__ > 3
++ if (strstr(model_name, "Mobile"))
+ {
+- #if __GNUC__ > 3 || __GNUC_MINOR__ > 3
+- cpu = "pentium-m";
+- #else
+- cpu = "pentium3";
+- #endif
++ cpu = "pentium3m";
+ }
+- else
+- {
+- #if __GNUC__ > 3 || __GNUC_MINOR__ > 3
+- if (strstr(model_name, "Mobile"))
+- {
+- cpu = "pentium4m";
+- }
+- #endif
++ #endif
+
+- if (!cpu)
+- {
+- cpu = "pentium4";
+- }
++ if (!cpu)
++ {
++ cpu = "pentium3";
+ }
+ }
+ }
+ else
+ {
+- #if __GNUC__ > 3 || __GNUC_MINOR__ > 3
+- if (strstr(model_name, "Mobile"))
++ if (!strcmp(cpu_family, "6"))
+ {
+- cpu = "pentium3m";
++ cpu = "pentium2";
+ }
+- #endif
+-
+- if (!cpu)
++ else
+ {
+- cpu = "pentium3";
++ cpu = "pentium-mmx";
+ }
+ }
+ }
+- else
++ #endif
++
++ if (!cpu)
++ {
++ int family = atoi(cpu_family);
++ if (family > 5)
++ {
++ cpu = "pentiumpro";
++ }
++ else if (family == 5)
++ {
++ cpu = "pentium";
++ }
++ }
++ }
++ #if __GNUC__ > 2
++ #if __GNUC__ > 3 || __GNUC_MINOR__ > 2
++ else if (!strcmp(vendor_id, "CentaurHauls") && strstr(flags, " mmx "))
++ {
++ if (strstr(flags, " 3dnow "))
+ {
+- if (!strcmp(cpu_family, "6"))
++ if (atoi(cpu_family) > 5)
+ {
+- cpu = "pentium2";
++ cpu = "c3";
+ }
+ else
+ {
+- cpu = "pentium-mmx";
++ cpu = "winchip2";
+ }
+ }
++ #if __GNUC__ > 3 || __GNUC_MINOR__ > 3
++ else if (strstr(flags, " sse "))
++ {
++ cpu = "c3-2";
++ }
++ #endif
++
++ if (!cpu)
++ {
++ cpu = "winchip-c6";
++ }
+ }
+ #endif
++ #endif
+
+ if (!cpu)
+ {
+ int family = atoi(cpu_family);
+ if (family > 5)
+ {
+- cpu = "pentiumpro";
++ cpu = "i686";
+ }
+ else if (family == 5)
+ {
+- cpu = "pentium";
++ cpu = "i586";
+ }
+- }
+- }
+- #if __GNUC__ > 2
+- #if __GNUC__ > 3 || __GNUC_MINOR__ > 2
+- else if (!strcmp(vendor_id, "CentaurHauls") && strstr(flags, " mmx "))
+- {
+- if (strstr(flags, " 3dnow "))
+- {
+- if (atoi(cpu_family) > 5)
++ else if (family == 4)
+ {
+- cpu = "c3";
++ cpu = "i486";
+ }
+ else
+ {
+- cpu = "winchip2";
++ cpu = "i386";
+ }
+ }
+- #if __GNUC__ > 3 || __GNUC_MINOR__ > 3
++ #else //MSVC
++ cpu = cpubuf;
++ *cpu = 0;
++
++ if (strstr(flags, " sse2 "))
++ {
++ strcat(cpu, " /arch:SSE2");
++ }
+ else if (strstr(flags, " sse "))
+ {
+- cpu = "c3-2";
++ strcat(cpu, " /arch:SSE");
+ }
+- #endif
+
+- if (!cpu)
++ #ifdef __x86_64__
++ if (strstr(flags, " lm ")) //64 bit
+ {
+- cpu = "winchip-c6";
++ if (!strcmp(vendor_id, "AuthenticAMD") || strstr(model_name, "AMD"))
++ {
++ strcat(cpu, " /favor:AMD64");
++ }
++ else if (!strcmp(vendor_id, "GenuineIntel") || strstr(model_name, "Intel"))
++ {
++ strcat(cpu, " /favor:EM64T");
++ }
+ }
++ #endif
++ #endif
+ }
+- #endif
+- #endif
+-
+- if (!cpu)
++ else
+ {
+- int family = atoi(cpu_family);
+- if (family > 5)
+- {
+- cpu = "i686";
+- }
+- else if (family == 5)
+- {
+- cpu = "i586";
+- }
+- else if (family == 4)
+- {
+- cpu = "i486";
+- }
+- else
+- {
+- cpu = "i386";
+- }
++ puts("Could not open /proc/cpuinfo, and CPUID instruction not available.");
++ return(1);
+ }
+- puts(cpu);
+- }
+- else
+- {
+- puts("Could not open /proc/cpuinfo, and CPUID instruction not available.");
+- return(1);
+ }
++ puts(cpu);
+
+ return(0);
+ }
diff --git a/games-emulation/zsnes/files/zsnes-1.51-buffer.patch b/games-emulation/zsnes/files/zsnes-1.51-buffer.patch
new file mode 100644
index 000000000000..5f3049b315ed
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-buffer.patch
@@ -0,0 +1,85 @@
+--- zsnes_1_51/src/initc.c.fortify
++++ zsnes_1_51/src/initc.c
+@@ -1464,8 +1464,8 @@
+ clearmem2();
+ }
+
+-extern unsigned char BRRBuffer[32];
+-extern unsigned char echoon0;
++extern unsigned char BRRBuffer[];
++extern unsigned char echoon0[];
+ extern unsigned int PHdspsave;
+ extern unsigned int PHdspsave2;
+ unsigned char echobuf[90000];
+@@ -1479,7 +1479,7 @@
+ memset(vidmemch4, 0, 4096);
+ memset(vidmemch8, 0, 4096);
+ memset(BRRBuffer, 0, PHdspsave);
+- memset(&echoon0, 0, PHdspsave2);
++ memset(echoon0, 0, PHdspsave2);
+ memset(echobuf, 0, 90000);
+ memset(spcBuffera, 0, 65536*4+4096);
+ memset(DSPMem, 0, 256);
+@@ -1822,7 +1822,7 @@
+
+ extern unsigned int nmiprevaddrl, nmiprevaddrh, nmirept, nmiprevline, nmistatus;
+ extern unsigned char spcnumread, yesoutofmemory;
+-extern unsigned char NextLineCache, sramsavedis, sndrot, regsbackup[3019];
++extern unsigned char NextLineCache, sramsavedis, sndrot[], regsbackup[3019];
+ extern unsigned int Voice0Freq, Voice1Freq, Voice2Freq, Voice3Freq;
+ extern unsigned int Voice4Freq, Voice5Freq, Voice6Freq, Voice7Freq;
+ extern unsigned int dspPAdj;
+@@ -2621,7 +2621,7 @@
+ }
+
+ sramsavedis = 0;
+- memcpy(&sndrot, regsbackup, 3019);
++ memcpy(sndrot, regsbackup, 3019);
+
+ if (yesoutofmemory) { asm_call(outofmemfix); }
+ asm_call(GUIDoReset);
+--- zsnes_1_51/src/zstate.c.fortify
++++ zsnes_1_51/src/zstate.c
+@@ -99,15 +99,15 @@
+ copy_func(buffer, &cycpbl, 4);
+ copy_func(buffer, &cycpblt, 4);
+ //SNES PPU Register status
+- copy_func(buffer, &sndrot, 3019);
++ copy_func(buffer, sndrot, 3019);
+ }
+
+ static void copy_spc_data(unsigned char **buffer, void (*copy_func)(unsigned char **, void *, size_t))
+ {
+ //SPC stuff, DSP stuff
+ copy_func(buffer, SPCRAM, PHspcsave);
+- copy_func(buffer, &BRRBuffer, PHdspsave);
+- copy_func(buffer, &DSPMem, sizeof(DSPMem));
++ copy_func(buffer, BRRBuffer, PHdspsave);
++ copy_func(buffer, DSPMem, sizeof(DSPMem));
+ }
+
+ static void copy_extra_data(unsigned char **buffer, void (*copy_func)(unsigned char **, void *, size_t))
+@@ -156,7 +156,7 @@
+ /*
+ if (buffer) //Rewind stuff
+ {
+- copy_func(&buffer, &echoon0, PHdspsave2);
++ copy_func(&buffer, echoon0, PHdspsave2);
+ }
+ */
+ }
+--- zsnes_1_51/src/gblvars.h.fortify
++++ zsnes_1_51/src/gblvars.h
+@@ -33,9 +33,9 @@
+ extern unsigned int SfxR0, *setaramdata, ramsize, *sram, nmiprevaddrh;
+ extern unsigned int tempesi, tempedi, tempedx, tempebp;
+ extern unsigned int SPCMultA, PHnum2writespc7110reg, PHdspsave2;
+-extern unsigned char sndrot, SPCRAM[65472], DSPMem[256], SA1Status, *SA1RAMArea;
+-extern unsigned char DSP1Enable, DSP1COp, prevoamptr, BRRBuffer[32], *romdata;
+-extern unsigned char curcyc, echoon0, spcnumread, NextLineCache, HIRQNextExe;
++extern unsigned char sndrot[], SPCRAM[65472], DSPMem[256], SA1Status, *SA1RAMArea;
++extern unsigned char DSP1Enable, DSP1COp, prevoamptr, BRRBuffer[], *romdata;
++extern unsigned char curcyc, echoon0[], spcnumread, NextLineCache, HIRQNextExe;
+ extern unsigned char vidmemch4[4096], vidmemch8[4096], vidmemch2[4096];
+
+ extern bool C4Enable, SFXEnable, SA1Enable, SPC7110Enable, SETAEnable, DSP4Enable, spcon;
diff --git a/games-emulation/zsnes/files/zsnes-1.51-cross-compile.patch b/games-emulation/zsnes/files/zsnes-1.51-cross-compile.patch
new file mode 100644
index 000000000000..5823c6aa6ade
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-cross-compile.patch
@@ -0,0 +1,34 @@
+--- a/src/acinclude.m4
++++ b/src/acinclude.m4
+@@ -107,7 +107,7 @@ int main (int argc, char *argv[])
+ with_zlib=yes,
+ with_zlib=no,
+ [AC_MSG_RESULT(cross-compiling)
+- with_zlib=""
++ with_zlib="cross"
+ AC_MSG_WARN(Assuming zlib is available)])
+
+ if test x$with_zlib != x; then
+@@ -116,7 +116,7 @@ fi
+ if test x$with_zlib = xyes; then
+ ZLIB_VERSION=$(<conf.zlibtest)
+ ifelse([$2], , :, [$2])
+-else
++elif test x$with_zlib != xcross; then
+ ZLIB_CFLAGS=""
+ ZLIB_LIBS=""
+ ZLIB_VERSION=""
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -103,8 +103,10 @@ main: makefile.dep $(Z_OBJS)
+ @ZC@ -o @ZSNESEXE@ $(Z_OBJS) @ZCFLAGS@ @LDFLAGS@
+ rm -f version.o
+
++BUILD_CXX ?= g++
++BUILD_CXXFLAGS ?= -O2 -pipe
+ $(PSR): parsegen.cpp
+- @CXX@ @CXXFLAGS@ -o $@ $< -lz
++ $(BUILD_CXX) $(BUILD_CXXFLAGS) -o $@ $< -lz
+
+ TOOLSEXE=$(TOOL_D)/archopt $(TOOL_D)/cutrtype $(TOOL_D)/extraext\
+ $(TOOL_D)/macroll $(TOOL_D)/minwhite $(TOOL_D)/nreplace\
diff --git a/games-emulation/zsnes/files/zsnes-1.51-depbuild.patch b/games-emulation/zsnes/files/zsnes-1.51-depbuild.patch
new file mode 100644
index 000000000000..2dbb5f558a46
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-depbuild.patch
@@ -0,0 +1,24 @@
+--- src/tools/depbuild.cpp.orig
++++ src/tools/depbuild.cpp
+@@ -130,7 +130,20 @@
+ void dependency_calculate_asm(const char *filename)
+ {
+ string command = nasm + " " + nflags + " -M " + filename;
+- system(command.c_str());
++ FILE *fp = popen(command.c_str(), "r");
++ if (fp)
++ {
++ char line[256];
++ while (fgets(line, sizeof(line), fp)) //Process all lines of output
++ {
++ cout << line;
++ }
++ pclose(fp);
++ }
++ else
++ {
++ cerr << "Failed on: " << filename << "\n";
++ }
+ }
+
+ void dependency_calculate_psr(const char *filename)
diff --git a/games-emulation/zsnes/files/zsnes-1.51-gcc43.patch b/games-emulation/zsnes/files/zsnes-1.51-gcc43.patch
new file mode 100644
index 000000000000..4650bc12a7d1
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-gcc43.patch
@@ -0,0 +1,48 @@
+--- src/parsegen.cpp
++++ src/parsegen.cpp
+@@ -31,6 +31,7 @@
+ #include <sstream>
+ #include <set>
+ #include <stack>
++#include <cstring>
+ using namespace std;
+
+ #include <errno.h>
+@@ -1828,7 +1829,7 @@
+ }
+ }
+
+-int main(size_t argc, const char **argv)
++int main(int argc, const char **argv)
+ {
+ const char *cheader_file = 0;
+ bool compile = false;
+--- src/tools/depbuild.cpp
++++ src/tools/depbuild.cpp
+@@ -24,6 +24,7 @@
+ #include <iostream>
+ #include <string>
+ #include <cstdio>
++#include <cstdlib>
+ using namespace std;
+
+ #include "fileutil.h"
+@@ -183,7 +184,7 @@
+ }
+ }
+
+-int main(size_t argc, const char *const *const argv)
++int main(int argc, const char *const *const argv)
+ {
+ if (argc < 5)
+ {
+--- src/tools/strutil.h
++++ src/tools/strutil.h
+@@ -25,6 +25,7 @@
+ #include <string>
+ #include <vector>
+ #include <cctype>
++#include <cstring>
+
+ struct ci_char_traits : public std::char_traits<char>
+ {
diff --git a/games-emulation/zsnes/files/zsnes-1.51-gcc47.patch b/games-emulation/zsnes/files/zsnes-1.51-gcc47.patch
new file mode 100644
index 000000000000..e58102415212
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-gcc47.patch
@@ -0,0 +1,15 @@
+Fix compile with gcc47
+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
+@@ -25,6 +25,7 @@
+ #include <string>
+ #include <cstdio>
+ #include <cstdlib>
++#include <unistd.h>
+ using namespace std;
+
+ #include "fileutil.h"
diff --git a/games-emulation/zsnes/files/zsnes-1.51-libao-thread.patch b/games-emulation/zsnes/files/zsnes-1.51-libao-thread.patch
new file mode 100644
index 000000000000..880e08c698fe
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-libao-thread.patch
@@ -0,0 +1,25 @@
+--- linux/audio.c.old 2007-01-09 20:19:12.000000000 -0500
++++ linux/audio.c 2007-12-30 20:33:07.000000000 -0500
+@@ -177,11 +177,7 @@
+ }
+ else
+ {
+- if (pthread_create(&audio_thread, 0, SoundThread_ao, 0))
+- {
+- puts("pthread_create() failed.");
+- }
+- else if (pthread_mutex_init(&audio_mutex, 0))
++ if (pthread_mutex_init(&audio_mutex, 0))
+ {
+ puts("pthread_mutex_init() failed.");
+ }
+@@ -189,6 +185,10 @@
+ {
+ puts("pthread_cond_init() failed.");
+ }
++ else if (pthread_create(&audio_thread, 0, SoundThread_ao, 0))
++ {
++ puts("pthread_create() failed.");
++ }
+ InitSampleControl();
+ }
diff --git a/games-emulation/zsnes/files/zsnes-1.51-libpng.patch b/games-emulation/zsnes/files/zsnes-1.51-libpng.patch
new file mode 100644
index 000000000000..4e49054c0972
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-libpng.patch
@@ -0,0 +1,33 @@
+--- acinclude.m4
++++ acinclude.m4
+@@ -163,21 +163,21 @@
+ libpng_prefix="")
+
+ min_libpng_version=ifelse([$1], ,1.2.0,$1)
+-tempLIBS="$LIBS"
+-tempCFLAGS="$CFLAGS"
+-if test x$libpng_prefix != x ; then
+- LIBPNG_LIBS="-L$libpng_prefix"
+- LIBPNG_CFLAGS="-I$libpng_prefix"
+-fi
+-LIBPNG_LIBS="$LIBPNG_LIBS -lpng -lm"
+-LIBS="$LIBS $LIBPNG_LIBS"
+-CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
+
+ AC_MSG_CHECKING(for libpng - version >= $min_libpng_version)
+
+ dnl <--- disable for no user choice part #2
+ if test x$enable_libpng != xno; then
+ dnl --->
++ tempLIBS="$LIBS"
++ tempCFLAGS="$CFLAGS"
++ if test x$libpng_prefix != x ; then
++ LIBPNG_LIBS="-L$libpng_prefix"
++ LIBPNG_CFLAGS="-I$libpng_prefix"
++ fi
++ LIBPNG_LIBS="$LIBPNG_LIBS -lpng -lm"
++ LIBS="$LIBS $LIBPNG_LIBS"
++ CFLAGS="$CFLAGS $LIBPNG_CFLAGS"
+
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
+ #include <png.h>
diff --git a/games-emulation/zsnes/files/zsnes-1.51-libpng15.patch b/games-emulation/zsnes/files/zsnes-1.51-libpng15.patch
new file mode 100644
index 000000000000..b32c30967547
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-libpng15.patch
@@ -0,0 +1,12 @@
+Use existing png_set_IHDR() and stop accessing PNG structure members directly
+
+--- src/zip/zpng.c
++++ src/zip/zpng.c
+@@ -129,7 +129,6 @@
+ png_set_IHDR(png_ptr, info_ptr, width, height, 8,
+ PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE,
+ PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
+- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
+
+ //Allocate an array of scanline pointers
+ row_pointers = (png_bytep*)malloc(height*sizeof(png_bytep));
diff --git a/games-emulation/zsnes/files/zsnes-1.51-stack-align.patch b/games-emulation/zsnes/files/zsnes-1.51-stack-align.patch
new file mode 100644
index 000000000000..32136643caec
--- /dev/null
+++ b/games-emulation/zsnes/files/zsnes-1.51-stack-align.patch
@@ -0,0 +1,15 @@
+--- zsnes_1_51/src/linux/sdllink.c.old
++++ zsnes_1_51/src/linux/sdllink.c
+@@ -773,11 +773,11 @@ BOOL InitInput()
+ {
+ InitJoystickInput();
+ return TRUE;
+ }
+
+-int startgame()
++int __attribute__((force_align_arg_pointer)) startgame()
+ {
+ static bool ranonce = false;
+ int status;
+
+ if (!ranonce)
diff --git a/games-emulation/zsnes/metadata.xml b/games-emulation/zsnes/metadata.xml
new file mode 100644
index 000000000000..8eb5529c51c4
--- /dev/null
+++ b/games-emulation/zsnes/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>games@gentoo.org</email>
+ <name>Gentoo Games Project</name>
+ </maintainer>
+ <use>
+ <flag name="debug">Enable the builtin debugger</flag>
+ <flag name="pax_kernel">Triggers a paxmarking of the binary</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">zsnes</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/zsnes/zsnes-1.51-r4.ebuild b/games-emulation/zsnes/zsnes-1.51-r4.ebuild
new file mode 100644
index 000000000000..64f551b5bcc3
--- /dev/null
+++ b/games-emulation/zsnes/zsnes-1.51-r4.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit eutils autotools flag-o-matic toolchain-funcs multilib pax-utils games
+
+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 )
+ amd64? ( >=sys-apps/portage-2.1 )"
+
+S=${WORKDIR}/${PN}_${PV//./_}/src
+
+src_prepare() {
+ # 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
+ epatch \
+ "${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-flags -U_FORTIFY_SOURCE #257963
+
+ egamesconf \
+ $(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() {
+ dogamesbin 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/*
+ dohtml -r ../docs/readme.htm/*
+ make_desktop_entry zsnes ZSNES
+ newicon icons/48x48x32.png ${PN}.png
+ prepgamesdirs
+}