From 8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 14 Jul 2018 21:03:06 +0100 Subject: gentoo resync : 14.07.2018 --- games-emulation/zsnes/Manifest | 17 + .../zsnes/files/zsnes-1.51-CC-quotes.patch | 20 + games-emulation/zsnes/files/zsnes-1.51-arch.patch | 77 ++++ .../files/zsnes-1.51-archopt-july-23-update.patch | 502 +++++++++++++++++++++ .../zsnes/files/zsnes-1.51-buffer.patch | 85 ++++ .../zsnes/files/zsnes-1.51-cross-compile.patch | 34 ++ .../zsnes/files/zsnes-1.51-depbuild.patch | 24 + games-emulation/zsnes/files/zsnes-1.51-gcc43.patch | 48 ++ games-emulation/zsnes/files/zsnes-1.51-gcc47.patch | 15 + .../zsnes/files/zsnes-1.51-libao-thread.patch | 25 + .../zsnes/files/zsnes-1.51-libpng.patch | 33 ++ .../zsnes/files/zsnes-1.51-libpng15.patch | 12 + .../zsnes/files/zsnes-1.51-stack-align-v2.patch | 56 +++ .../zsnes/files/zsnes-1.51-stack-align.patch | 15 + games-emulation/zsnes/metadata.xml | 15 + games-emulation/zsnes/zsnes-1.51-r6.ebuild | 117 +++++ games-emulation/zsnes/zsnes-1.51-r7.ebuild | 122 +++++ 17 files changed, 1217 insertions(+) create mode 100644 games-emulation/zsnes/Manifest create mode 100644 games-emulation/zsnes/files/zsnes-1.51-CC-quotes.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-arch.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-archopt-july-23-update.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-buffer.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-cross-compile.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-depbuild.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-gcc43.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-gcc47.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-libao-thread.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-libpng.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-libpng15.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-stack-align-v2.patch create mode 100644 games-emulation/zsnes/files/zsnes-1.51-stack-align.patch create mode 100644 games-emulation/zsnes/metadata.xml create mode 100644 games-emulation/zsnes/zsnes-1.51-r6.ebuild create mode 100644 games-emulation/zsnes/zsnes-1.51-r7.ebuild (limited to 'games-emulation/zsnes') diff --git a/games-emulation/zsnes/Manifest b/games-emulation/zsnes/Manifest new file mode 100644 index 000000000000..c24684152b52 --- /dev/null +++ b/games-emulation/zsnes/Manifest @@ -0,0 +1,17 @@ +AUX zsnes-1.51-CC-quotes.patch 740 BLAKE2B f41e66a5d2f9b54c8ed4f17fafc7afdd73e35202c083d1db375b26b89f03b991d36d279d10c7c17076f31b87d1fbad276e5c5c4ce333d2cb0f0fc7641b562845 SHA512 2347910158934a7c8b90a6739f923d7a1f94e963515dca42d45eb97e6165c5f80c30d28fd151537a7a80bba16d2462568ff1c1dac93a855990f0418aaf059776 +AUX zsnes-1.51-arch.patch 2484 BLAKE2B 036f749d832efc976a7225e47d6b7ac5e1b69af235a4196e9706fe46d447793a1e3f88e49fe34229cd71353b987b7ef123bbebf7c822ca32025c60b0c9813b57 SHA512 cc75584780e442d7fbcd4e26a9395d8e85570883f93f63b1fcb604d601acde88295861e15a6cee1d50bca836fc52efd4f5df9c84fb73fbe04fa76ec34ae3b4a1 +AUX zsnes-1.51-archopt-july-23-update.patch 12672 BLAKE2B d12246a4913d2355a7c2c26686714e61ff3791c29f93f473619225b9bd180d329c48d07123141d657faf3fe75de4e49d31b80b4577f9a646a531774abba24b4a SHA512 ac30370957721ccc4bc8681dc00110bd68dee6d65a2c3daa39df2fe45a4fa7106f9c3097b2bd9cc3dbc83e3c6344811e8719f48ba6e4896768c17357730c5719 +AUX zsnes-1.51-buffer.patch 3091 BLAKE2B a87e0b6547aeaa9f585d76a8ee080895573015fe42b0df2161268754ff01c046fd234997000ef484f66710dfd30e145d9d4db2f373a568e99deec2a8637db285 SHA512 0faf34338ff3fd85985dc16d2a58aa9e2ac1887db8d26bc210fc6965f6cc743c6c56b8b58bea72341d8ee1fed59c438db801000be5ae6bf4e26789e9bed89d25 +AUX zsnes-1.51-cross-compile.patch 934 BLAKE2B be18829454407c99aba00cb8126573f5f3e3ed8e18b2bb50811b855ba81137a16b90601c28cab9fce8d865e522cb66bb797d46a22090dd994c71aef672be99f2 SHA512 ece4a9f51314c7318babaf689fb44c1502ec5bc32808613211865daf1368cc1069b70ad4c1c4ec7b127cf707a0b093c356a8b50e5357099894656c78cf28738f +AUX zsnes-1.51-depbuild.patch 559 BLAKE2B 38309177599aee8dafcbded6a027d66b991e85aac4c77fda0485b7777467c056386797041223a556b3cfff4b926e5a0b4004baae4264a765354a6dc2cb39ac75 SHA512 46955153ec6d2ecd5a295117c3ecc911a566de69f29f4d29decc98867d03e4a53a980a3c75d8ff19bbd1655eb291069fbbd598e002a73ebdbdc94c135f852c6e +AUX zsnes-1.51-gcc43.patch 913 BLAKE2B 7ac3d5b8f556d577c1a1065bbe4e275742fdde0486411cc82f2dc552e8d90b82eb7dceefcdd87252633154b8249213f9dfe6724f4f0ee4eef3f8f691081355c7 SHA512 8684b9b8c01d2d9f27bf27a86e4705b3408a2891347045266040397b649eb162962e8384746930c9837ac9b21bfd626d6e241d8a6c73b46a0e348274dd8688d3 +AUX zsnes-1.51-gcc47.patch 312 BLAKE2B 927c6179fbbcd3fb161b5b18e025090acce178eae0586b7c20e48cdba091572d30c224aa80bb8a49c16d29fb9045c0207b26692651a15a53c2b4b90780c3f0c2 SHA512 aa9f111359e96118729e684562618d72231c5c475e736c53862cfe9d21b8c4db29056ec0476dcc7e50dd501a77619671fb8834be093086c7e752100c917060fc +AUX zsnes-1.51-libao-thread.patch 667 BLAKE2B 76bc0abf16f68c9752a727817cff209daa2c0c29f31e6045441e202083f47559cb50c1a6a998c12621a298fa3901bc1d52701b176b8fd594ca116f990d3c5208 SHA512 43c28d4539df5c8ea4d3d0415c65afec3eb9215971a5ff0532b3b147b2fa3f870aadf07eb1e643e986c39d56760c0292447d467418865826ddc8c7aea64cc005 +AUX zsnes-1.51-libpng.patch 858 BLAKE2B f0ad46176cf5729d0a5be9e4307a28628e38c3d18043f0ff897dfd1cf901f0f9fb7ff80d25095fdaa9b6b1be52fe3c95f4e28b65042b4c4aad33a27125c7eb02 SHA512 2c25fb3294357a38ed8e119d4b4d60f7bd6f28724b2274a620465962e96e008f2a29273f46d4813e91b9128879218f401bb91b1a6df4c156b9ff7856b26657b0 +AUX zsnes-1.51-libpng15.patch 510 BLAKE2B 6281a27c6029ee94947b282fe5c06a67e7670d3168d5f4ae90573d12e8e6d5c467a9691cdd161158f117e341466bc7a3e99d516b95624534773027279aba4f7a SHA512 4191987cad2f8dd7d7fd1d4f8f0c60de07059f18a60cb9bb94f1e5c35c06122032de9887762ebcf2d255f24c3e90aa5b4f6a7540a8e4dbdc4ce5f7d3b3e3b532 +AUX zsnes-1.51-stack-align-v2.patch 1451 BLAKE2B b4570fa9d614d516375f1b7d2a9b3b7c9bf432f453425d2ee3035e78d8d946355551044d712528907c3a1f29b3531034b5949224398801e04270df85ada5ab00 SHA512 c3be01f36973615c55c643d1d916742f8e3a34e9957b42d1d7224a99790713025bb154e5e8c2833fd1e8d26240c6251a70c8a9f36fefe661480077b1b06871c8 +AUX zsnes-1.51-stack-align.patch 283 BLAKE2B 2ae8aaf28975f0f88ed77eafb3977706bd662215a7e286c32ce6a138993bda00c05012bc92bd106b6607d524990ccccf094e647c44a350babf3755c2dc6bf3a6 SHA512 543876c459d7448bb7707677de432dd0140320ab77752f1d9fbee4f58ea34158f1e223f46d5aa9e2858b902513a915517f27e86e51f2263f667a6baea608fb55 +DIST zsnes151src.tar.bz2 1071712 BLAKE2B e942c699bd227942563deb23b105339aa9ffd8a5623200ca142a777508b4ebaf47859170016490f53a3af2bfb15293c17a99a7658e1f3f0afd7df8cd63200b9a SHA512 2cec9ad7762fc7a257c6b1d3e190b0ed53565dbafe42e1dee9eb182644392b7dd2c57faa846f63cd30ac079e5c05354d26ce0612d20481a1f54d760d62d95353 +EBUILD zsnes-1.51-r6.ebuild 3198 BLAKE2B cf8d5505e5eef6c3d864cddc82dfd9af86ce32780c651536547994218e55658450ce8fb507126850ff16541fa342a6a99d13bf25d550d46072f07c338f8c14e0 SHA512 4a9a696fdfbc4f31c95fe5e81fd6a27b569771d8fe36b24a088594f0a36fbf13a6c30dc562e57a7e4842569b9b4a15a459f17bd24101f685160650232ccaddb6 +EBUILD zsnes-1.51-r7.ebuild 3173 BLAKE2B c0ae44e8340ddce0d6a7cd4e5f7ce56e7b6b0b142194874f0f3f1681fbb3eb9a92fa149f2ce7edbbebe6136b5940b2601c4be4be360f574c83644a1af97ad094 SHA512 e5acf4bce2632ff23550c37e0f27c602240e1f9ac3ef0287d81b4a35f80a33557728f9d4721d62985c19e64d9b392f8283edb58c22131c0ee74e6d78bbd94aac +MISC metadata.xml 484 BLAKE2B ad2da7cec97ca32be7ae42000312cdebd1c5dc5fce4ccc6f99fd16e69208350a5e714201e0bc258e8d4eb980357fe2517cc9b177e3ad74507b44d31ecdc8fe27 SHA512 02318871d54bfa7d9c4ba2a64f3ed7c83bf45b04a5c66dda5659d935b943a2415e6eaad124ac34e3c4235ba57f21c1189b03fec4f622c19eec1873531727a622 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..b39549871b7f --- /dev/null +++ b/games-emulation/zsnes/files/zsnes-1.51-arch.patch @@ -0,0 +1,77 @@ +--- a/configure.in.orig ++++ b/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..b3e466036f22 --- /dev/null +++ b/games-emulation/zsnes/files/zsnes-1.51-archopt-july-23-update.patch @@ -0,0 +1,502 @@ +--- a/tools/archopt.c.old ++++ b/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 + #include + #include + #include + ++#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..eb463682196d --- /dev/null +++ b/games-emulation/zsnes/files/zsnes-1.51-buffer.patch @@ -0,0 +1,85 @@ +--- src/initc.c.fortify ++++ 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); +--- src/zstate.c.fortify ++++ 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); + } + */ + } +--- 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; + 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..5c412e3e649b --- /dev/null +++ b/games-emulation/zsnes/files/zsnes-1.51-cross-compile.patch @@ -0,0 +1,34 @@ +--- src/acinclude.m4 ++++ 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=$( + #include + #include ++#include + using namespace std; + + #include +@@ -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 + #include + #include ++#include + 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 + #include + #include ++#include + + struct ci_char_traits : public std::char_traits + { 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..b3250fee679b --- /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 + +--- src/tools/depbuild.cpp ++++ src/tools/depbuild.cpp +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + 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..1ae0a1467b3e --- /dev/null +++ b/games-emulation/zsnes/files/zsnes-1.51-libao-thread.patch @@ -0,0 +1,25 @@ +--- 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 + { +- 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..fd974e799e30 --- /dev/null +++ b/games-emulation/zsnes/files/zsnes-1.51-libpng.patch @@ -0,0 +1,33 @@ +--- a/acinclude.m4 ++++ b/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 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-v2.patch b/games-emulation/zsnes/files/zsnes-1.51-stack-align-v2.patch new file mode 100644 index 000000000000..35613a953596 --- /dev/null +++ b/games-emulation/zsnes/files/zsnes-1.51-stack-align-v2.patch @@ -0,0 +1,56 @@ +zsnes call C initialization code from assembler. + +Example backtrace: + + Thread 1 "zsnes" received signal SIGSEGV, Segmentation fault. + => 0xf7550275 <+37>: vmovdqa (%esp),%xmm1 + ... + #13 0x5699ef82 in InitSound () at linux/audio.c:336 + #14 0x569a25af in initwinvideo () at linux/sdllink.c:1080 + #15 0x5699fc13 in initvideo () at linux/sdllink.c:1298 + #16 0x56f9d5bc in regptwa () + #17 0x56a34b50 in SA1tableG () + #18 0x56f84788 in selcB800 () + ... + +Call to 'initwinvideo' (first C function) looks like that: + NEWSYM InitPreGame ; Executes before starting/continuing a game + mov byte[pressed+1],2 + pushad + call Start60HZ + %ifdef __OPENGL__ + call drawscreenwin + %endif + call initwinvideo + +Note: pushad / call does not 16-byte maintain stack alignment +and breaks i386 ABI. + +We apply realignment attribute to all functions noticed by users. +Bug: https://bugs.gentoo.org/503138 +--- src/linux/sdllink.c.old ++++ 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) +--- a/linux/sdllink.c ++++ b/linux/sdllink.c +@@ -897,7 +897,7 @@ bool OGLModeCheck() + return(cvidmode > 4); + } + +-void initwinvideo(void) ++void __attribute__((force_align_arg_pointer)) initwinvideo(void) + { + DWORD newmode = 0; + 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..5dcbf3ad9ebc --- /dev/null +++ b/games-emulation/zsnes/files/zsnes-1.51-stack-align.patch @@ -0,0 +1,15 @@ +--- src/linux/sdllink.c.old ++++ 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 @@ + + + + + games@gentoo.org + Gentoo Games Project + + + Enable the builtin debugger + Triggers a paxmarking of the binary + + + zsnes + + diff --git a/games-emulation/zsnes/zsnes-1.51-r6.ebuild b/games-emulation/zsnes/zsnes-1.51-r6.ebuild new file mode 100644 index 000000000000..bf1934226ab9 --- /dev/null +++ b/games-emulation/zsnes/zsnes-1.51-r6.ebuild @@ -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 +} diff --git a/games-emulation/zsnes/zsnes-1.51-r7.ebuild b/games-emulation/zsnes/zsnes-1.51-r7.ebuild new file mode 100644 index 000000000000..9613a4888e85 --- /dev/null +++ b/games-emulation/zsnes/zsnes-1.51-r7.ebuild @@ -0,0 +1,122 @@ +# 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" + +PATCHES=( + # Fixing compilation without libpng installed + "${FILESDIR}"/${P}-libpng.patch + + # Fix bug #186111 + # Fix bug #214697 + # Fix bug #170108 + # Fix bug #260247 + "${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 + + # Fix compability with libpng15 wrt #378735 + "${FILESDIR}"/${P}-libpng15.patch + + # Fix buffer overwrite #257963 + "${FILESDIR}"/${P}-buffer.patch + # Fix gcc47 compile #419635 + "${FILESDIR}"/${P}-gcc47.patch + # Fix stack alignment issue #503138 + "${FILESDIR}"/${P}-stack-align-v2.patch + + "${FILESDIR}"/${P}-cross-compile.patch + "${FILESDIR}"/${P}-arch.patch +) + +src_prepare() { + default + + # 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 +} -- cgit v1.2.3