summaryrefslogtreecommitdiff
path: root/games-emulation/snes9x
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/snes9x
reinit the tree, so we can have metadata
Diffstat (limited to 'games-emulation/snes9x')
-rw-r--r--games-emulation/snes9x/Manifest11
-rw-r--r--games-emulation/snes9x/files/snes9x-1.53-build.patch70
-rw-r--r--games-emulation/snes9x/files/snes9x-1.53-cross-compile.patch38
-rw-r--r--games-emulation/snes9x/files/snes9x-1.54.1-build.patch55
-rw-r--r--games-emulation/snes9x/files/snes9x-1.54.1-system-zlib.patch307
-rw-r--r--games-emulation/snes9x/metadata.xml16
-rw-r--r--games-emulation/snes9x/snes9x-1.53.ebuild119
-rw-r--r--games-emulation/snes9x/snes9x-1.54.1.ebuild123
8 files changed, 739 insertions, 0 deletions
diff --git a/games-emulation/snes9x/Manifest b/games-emulation/snes9x/Manifest
new file mode 100644
index 000000000000..bb4711351e6d
--- /dev/null
+++ b/games-emulation/snes9x/Manifest
@@ -0,0 +1,11 @@
+AUX snes9x-1.53-build.patch 2515 SHA256 fb4a34f90041dac78984d9e9548595073731bfd3a8becd865bffca7392c9805b SHA512 8b8059b1d7b92b91463a5bebfde80cacda4cf9749bd1b96cf1658fe1f04e00ef61a932458f425d336fdd77ff123ed53ae01ee33f02a6245776bc52c2d5645921 WHIRLPOOL b86a03b84a58f4a2a61c1f57d31c2642892d8937bc386411561697c1349471e624102cc67f3b73f321b6b822d515fcfa23513325d807986b10ff5d8eb84fb21c
+AUX snes9x-1.53-cross-compile.patch 892 SHA256 a00273a5c272503b33a7f9e6755271c9859dfd0eb487b8ed096229ee36166b79 SHA512 4867b9a3e3f2a65684157b26e4b0b63971d37ad5abb16125567e89bc4116482488416ca51d30f639ef63886b05431c56b75978fe073a4755c48988f5ea9eaee5 WHIRLPOOL 6579e26e0e29174560ffcc9bc8a6154f9c5f70940a7e514a8814a3a0dc4bf38ac2c2ccdad35af07a777dec97aaf99d104cbaf3595e443e78576eb9e710e0cbfa
+AUX snes9x-1.54.1-build.patch 1525 SHA256 52830df70a40b86ca961766ca237533562c11bd94c2f1003ce44a6717c5ef28d SHA512 846b72f0733c13d2f7fb943f670943d20963a9f7666c016fc7e8f4e62afeb1ad479523cfc14fa93752f175b8cd44d599e300ace7a981d604b0284052d0914d12 WHIRLPOOL 1c63f44c9b1c4f99277e6c6db48f7b751d9c08c066141b4ad239b109f2b0639045464a2da7698b48770217fc8647197866b02252a2edc3e735ce798aec60a117
+AUX snes9x-1.54.1-system-zlib.patch 7925 SHA256 ec54fb6e73d78677f50b4a32b467cf856cdfe8476c72ca3224c408b5024eabe6 SHA512 02026d5e59f7e016583d15996694aac41fb777541dcf426c8266a9136b59c022c3f13ea211473408d01c76b040af78d70cc5bba9d94a945823674d7f68beb482 WHIRLPOOL 0c7b99ff2025ff1c8a97753e2dfff46fe47e980b29e1f5f5325420cfe92c4bafa256c39196c91be2097f955d2ee7466bbd9c2bf19019b072c5aa99362ec0987d
+DIST snes9x-1.53-src.tar.bz2 1838746 SHA256 9f7c5d2d0fa3fe753611cf94e8879b73b8bb3c0eab97cdbcb6ab7376efa78dc3 SHA512 3ded506d1b3b6cff4e8e3de77ad557d97981eb97ea23ffc68ce5abbbd4677aca819776f1d11b9aa47f5b1a785b19455acf6ad4dbc536d3581d62c192ebdfbd8c WHIRLPOOL 482f0b2c476753b5ffb6ff30b1e5ccb9f50bd0dbe05c7147d5e1c073cd15ce7edd99dc4ea9c14bb50d0bd3cec7edda26e1c54b1b7e0c77b0eb26f9aa09e25f52
+DIST snes9x-1.54.1.tar.gz 2186737 SHA256 85862a22498bc418c37bd7c81a3089d9cc00af279b91e5f7fa8bea05e2e3027b SHA512 2a8fddc0b9044c0b7e10711b35c06555e280c93ddde3c101c4084f859079947acb209f2632ca08937fa2ca47932094040c4a7a60b6188354fd92f72dbdf854ed WHIRLPOOL 8ef309a14646c0250e81f6d2ede48da65144830247cb7cf17eccc6b94dffdd128f1b75d27258ae0d923b580c612984cef27c5237066c98a613b0a00faa3ad90b
+EBUILD snes9x-1.53.ebuild 2723 SHA256 7a6fa6dd1c70c148924e7e43dbcc9bf007449b84c926a7eec4c490534e682044 SHA512 714838286c2e9371dc03297673995e423210e8b8152a0fc689b1bcd9151133630d081f34140d6e2ad922e8df66efa593ae675efb7a2bc0ab30662ff9e5c3c852 WHIRLPOOL 5fbe8aed31d47ef2be5279838ce1b7fe0fbd5dc04846e569445b4f6c9f2df9515a208a3ca606a0a38fc1db3ea9a12da0e51e2396b80d6078cf9d1e3c9ba23289
+EBUILD snes9x-1.54.1.ebuild 2676 SHA256 f507f59988d1cb258a77da5013b6e6c50004ab0e5c52a9f98bed85d377ddcc84 SHA512 47e9442b43a733d77b98401063ec64584a678b87789453e62d552cf1cee327952fe57f7bbb38958b098f142c60810228d806c8734fff46e9708a24c5afdc4713 WHIRLPOOL 0bb4b069c7f777f36a012c629842dc54f5410d774f79aa23d04dfe179aab64fc29d95fec76c937f7fc4fb9bac03ac799b30a0adde69047f4b6dc4f3b2dbdb18f
+MISC ChangeLog 3232 SHA256 735cbea7057d757fa3a4e4e6189dcf519808cb1646622e0ddb7f29fcec7e8eec SHA512 c509ec2d3462c4c34826d774a3d3cbb9f54e0ebdd2d62bc412cb3137c6f6d27718d128661d7ac2f647a99663b6248f549ce9438adba14cf94e97000e2dc91db2 WHIRLPOOL 82c0a6513dc62ebefd4f86399c0490589f2227f990def5f699a24ce9c77ab1235ed98f0d9f47df270410b4bf302988808a414dd3e71d4984f8b788a09e77d43e
+MISC ChangeLog-2015 10237 SHA256 d995e56a01b91fae40fec2f74326e321323dca79cfdf03544ef6a9e45b2c8b2d SHA512 87075dbbeba0b9f36b4a03b4cd5592e06823a412baa50b0f178649c6be110ce0e31db50c955cdf1d1b087f303f8ada72cca2566fa39528501f1f662ee8ebbd88 WHIRLPOOL 50f8439eb855c93cb3dad4d7709aee2cd2acc9bb0d80675370a7ee6513c5eb45be88d6d959cd17b5c42da29d57273f657d839dd2e83fac9a57818a44c1f64ea0
+MISC metadata.xml 560 SHA256 746ed4c062c75e47c3dc0113a6651617b65079589b4736038b20dfe22a928e26 SHA512 3922d16510b8818739e582c8faf84287dc265f810df5957dc923efab912e20f95b7fb9fc84023d481b44ce6c653f2bc00e83d6a150d9294feeb60dc8c3a2eeca WHIRLPOOL edd3247c8fb2b5a0e67b034df3fe93f1bab8d671ed414d57659eaae8161f28b4e6c50440727a0b3ac7d6ba7e9311d6700a3ab045d7a992cd3017e502fca8b559
diff --git a/games-emulation/snes9x/files/snes9x-1.53-build.patch b/games-emulation/snes9x/files/snes9x-1.53-build.patch
new file mode 100644
index 000000000000..c46e5f238549
--- /dev/null
+++ b/games-emulation/snes9x/files/snes9x-1.53-build.patch
@@ -0,0 +1,70 @@
+diff -ru snes9x-1.53-src.orig/gtk/configure.ac snes9x-1.53-src/gtk/configure.ac
+--- snes9x-1.53-src.orig/gtk/configure.ac 2011-04-24 09:38:10.000000000 -0400
++++ snes9x-1.53-src/gtk/configure.ac 2011-09-26 16:06:46.746352405 -0400
+@@ -29,7 +29,7 @@
+
+ AM_GLIB_GNU_GETTEXT
+
+-snes9xlocaledir='${prefix}/${DATADIRNAME}/locale'
++snes9xlocaledir='/usr/share/locale'
+ AC_SUBST(snes9xlocaledir)
+
+ AC_ARG_WITH(debug,
+diff -ru snes9x-1.53-src.orig/gtk/po/Makefile.in.in snes9x-1.53-src/gtk/po/Makefile.in.in
+--- snes9x-1.53-src.orig/gtk/po/Makefile.in.in 2011-04-24 16:12:50.000000000 -0400
++++ snes9x-1.53-src/gtk/po/Makefile.in.in 2011-09-26 16:07:05.844485532 -0400
+@@ -34,7 +34,7 @@
+ datarootdir = @datarootdir@
+ libdir = @libdir@
+ DATADIRNAME = @DATADIRNAME@
+-itlocaledir = $(prefix)/$(DATADIRNAME)/locale
++itlocaledir = /usr/share/locale
+ subdir = po
+ install_sh = @install_sh@
+ # Automake >= 1.8 provides @mkdir_p@.
+diff -ru snes9x-1.53-src.orig/unix/Makefile.in snes9x-1.53-src/unix/Makefile.in
+--- snes9x-1.53-src.orig/unix/Makefile.in 2011-04-24 09:38:10.000000000 -0400
++++ snes9x-1.53-src/unix/Makefile.in 2011-09-26 16:06:46.746352405 -0400
+@@ -47,7 +47,7 @@
+ exit 1
+
+ snes9x: $(OBJECTS)
+- $(CCC) $(INCLUDES) -o $@ $(OBJECTS) -lm @S9XLIBS@
++ $(CCC) $(LDFLAGS) $(INCLUDES) -o $@ $(OBJECTS) -lm @S9XLIBS@
+
+ ../jma/s9x-jma.o: ../jma/s9x-jma.cpp
+ $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
+diff -ru snes9x-1.53-src.orig/unix/configure.ac snes9x-1.53-src/unix/configure.ac
+--- snes9x-1.53-src.orig/unix/configure.ac 2011-04-24 09:38:10.000000000 -0400
++++ snes9x-1.53-src/unix/configure.ac 2011-09-26 16:06:46.747352203 -0400
+@@ -56,20 +56,6 @@
+ # *** Execution begins here ***
+ # *****************************
+
+-# Remove -g and -O2 flags manually.
+-
+-if test "x$CFLAGS" != "x"; then
+- CFLAGS="`echo \"$CFLAGS\" | sed -e 's/-g//'`"
+- CFLAGS="`echo \"$CFLAGS\" | sed -e 's/-O2//'`"
+-fi
+-
+-if test "x$CXXFLAGS" != "x"; then
+- CXXFLAGS="`echo \"$CXXFLAGS\" | sed -e 's/-g//'`"
+- CXXFLAGS="`echo \"$CXXFLAGS\" | sed -e 's/-O2//'`"
+-fi
+-
+-# Test what compiler flags we should use.
+-
+ AC_ARG_ENABLE([debug],
+ [AS_HELP_STRING([--enable-debug],
+ [leave debug information in the final binary (default: no)])],
+@@ -79,9 +65,6 @@
+ AC_S9X_COMPILER_FLAG([-g], [g])
+ AC_S9X_COMPILER_FLAG([-O0], [o0])
+ else
+- AC_S9X_COMPILER_FLAG([-O3], [o3], [
+- AC_S9X_COMPILER_FLAG([-O2], [o2], [
+- AC_S9X_COMPILER_FLAG([-O1], [o1])])])
+ AC_S9X_COMPILER_FLAG([-fomit-frame-pointer], [omit_frame_pointer])
+ fi
+
diff --git a/games-emulation/snes9x/files/snes9x-1.53-cross-compile.patch b/games-emulation/snes9x/files/snes9x-1.53-cross-compile.patch
new file mode 100644
index 000000000000..7a0fe8a8bde8
--- /dev/null
+++ b/games-emulation/snes9x/files/snes9x-1.53-cross-compile.patch
@@ -0,0 +1,38 @@
+--- a/unix/configure.ac
++++ b/unix/configure.ac
+@@ -4,7 +4,7 @@ AC_REVISION([$Revision: 1.1 $])
+
+ AC_CONFIG_SRCDIR([unix.cpp])
+
+-AC_CANONICAL_TARGET
++AC_CANONICAL_HOST
+
+ AC_PROG_CC
+ AC_PROG_CXX
+@@ -38,7 +38,7 @@ AC_DEFUN([AC_S9X_COMPILER_FLAG],
+ return (argc);
+ }
+ ],
+- [snes9x_cv_option_$2="yes"], [snes9x_cv_option_$2="no"])
++ [snes9x_cv_option_$2="yes"], [snes9x_cv_option_$2="no"], [snes9x_cv_option_$2="yes"])
+ ])
+
+ CXXFLAGS="[$]OLD_CXXFLAGS"
+@@ -94,7 +94,7 @@ AC_MSG_CHECKING([whether the OS is Linux])
+
+ AC_CACHE_VAL([snes9x_cv_linux_os],
+ [
+- case "$target" in
++ case "$host" in
+ *-*-linux*)
+ snes9x_cv_linux_os="yes"
+ ;;
+@@ -332,7 +332,7 @@ AC_DEFUN([AC_S9X_CHECK_SAR],
+ return (i < 0 ? 0 : 1);
+ }
+ ],
+- [snes9x_sar_$1="yes"], [snes9x_sar_$1="no"])
++ [snes9x_sar_$1="yes"], [snes9x_sar_$1="no"], [snes9x_sar_$1=$GCC])
+
+ CXXFLAGS="[$]OLD_CXXFLAGS"
+
diff --git a/games-emulation/snes9x/files/snes9x-1.54.1-build.patch b/games-emulation/snes9x/files/snes9x-1.54.1-build.patch
new file mode 100644
index 000000000000..945b5f1890b2
--- /dev/null
+++ b/games-emulation/snes9x/files/snes9x-1.54.1-build.patch
@@ -0,0 +1,55 @@
+--- snes9x-1.54.1/gtk/configure.ac
++++ snes9x-1.54.1/gtk/configure.ac
+@@ -33,7 +33,7 @@
+
+ AM_GLIB_GNU_GETTEXT
+
+-snes9xlocaledir='${prefix}/${DATADIRNAME}/locale'
++snes9xlocaledir='/usr/share/locale'
+ AC_SUBST(snes9xlocaledir)
+
+ AC_ARG_WITH(debug,
+--- snes9x-1.54.1/unix/configure.ac
++++ snes9x-1.54.1/unix/configure.ac
+@@ -56,20 +56,6 @@
+ # *** Execution begins here ***
+ # *****************************
+
+-# Remove -g and -O2 flags manually.
+-
+-if test "x$CFLAGS" != "x"; then
+- CFLAGS="`echo \"$CFLAGS\" | sed -e 's/-g//'`"
+- CFLAGS="`echo \"$CFLAGS\" | sed -e 's/-O2//'`"
+-fi
+-
+-if test "x$CXXFLAGS" != "x"; then
+- CXXFLAGS="`echo \"$CXXFLAGS\" | sed -e 's/-g//'`"
+- CXXFLAGS="`echo \"$CXXFLAGS\" | sed -e 's/-O2//'`"
+-fi
+-
+-# Test what compiler flags we should use.
+-
+ AC_ARG_ENABLE([debug],
+ [AS_HELP_STRING([--enable-debug],
+ [leave debug information in the final binary (default: no)])],
+@@ -79,9 +65,6 @@
+ AC_S9X_COMPILER_FLAG([-g], [g])
+ AC_S9X_COMPILER_FLAG([-O0], [o0])
+ else
+- AC_S9X_COMPILER_FLAG([-O3], [o3], [
+- AC_S9X_COMPILER_FLAG([-O2], [o2], [
+- AC_S9X_COMPILER_FLAG([-O1], [o1])])])
+ AC_S9X_COMPILER_FLAG([-fomit-frame-pointer], [omit_frame_pointer])
+ fi
+
+--- snes9x-1.54.1/unix/Makefile.in
++++ snes9x-1.54.1/unix/Makefile.in
+@@ -47,7 +47,7 @@
+ exit 1
+
+ snes9x: $(OBJECTS)
+- $(CCC) $(INCLUDES) -o $@ $(OBJECTS) -lm @S9XLIBS@
++ $(CCC) $(LDFLAGS) $(INCLUDES) -o $@ $(OBJECTS) -lm @S9XLIBS@
+
+ ../jma/s9x-jma.o: ../jma/s9x-jma.cpp
+ $(CCC) $(INCLUDES) -c $(CCFLAGS) -fexceptions $*.cpp -o $@
diff --git a/games-emulation/snes9x/files/snes9x-1.54.1-system-zlib.patch b/games-emulation/snes9x/files/snes9x-1.54.1-system-zlib.patch
new file mode 100644
index 000000000000..26025829442c
--- /dev/null
+++ b/games-emulation/snes9x/files/snes9x-1.54.1-system-zlib.patch
@@ -0,0 +1,307 @@
+From def3936a5353924fb7b9ffa30b8c1c96c9175ca7 Mon Sep 17 00:00:00 2001
+From: Lars Wendler <polynomial-c@gentoo.org>
+Date: Fri, 11 Nov 2016 17:52:07 +0100
+Subject: [PATCH] Introduce --with-system-zip configure flag to use system zip
+ (minizip)
+
+if available.
+---
+ conffile.h | 6 +++++-
+ gtk/Makefile.am | 6 +++++-
+ gtk/configure.ac | 28 +++++++++++++++++++++++++++-
+ loadzip.cpp | 4 ++++
+ memmap.cpp | 6 +++++-
+ stream.cpp | 6 +++++-
+ stream.h | 7 +++++--
+ unix/Makefile.in | 9 +++++++--
+ unix/configure.ac | 47 +++++++++++++++++++++++++++++++++++++++--------
+ 9 files changed, 102 insertions(+), 17 deletions(-)
+
+diff --git a/conffile.h b/conffile.h
+index ed8a13b..366706f 100644
+--- a/conffile.h
++++ b/conffile.h
+@@ -197,7 +197,11 @@
+ #include <string>
+
+ #ifdef UNZIP_SUPPORT
+-#include "unzip/unzip.h"
++# ifdef SYSTEM_ZIP
++# include <minizip/unzip.h>
++# else
++# include "unzip/unzip.h"
++# endif
+ #endif
+ #include "snes9x.h"
+
+diff --git a/gtk/Makefile.am b/gtk/Makefile.am
+index fad1cf2..57f00fb 100644
+--- a/gtk/Makefile.am
++++ b/gtk/Makefile.am
+@@ -196,12 +196,16 @@ snes9x_gtk_SOURCES += \
+ ../server.cpp
+ endif
+
++
+ # Zip support is nonconfigurable.
+ snes9x_gtk_SOURCES += \
+- ../loadzip.cpp \
++ ../loadzip.cpp
++if ! SYSTEM_ZIP
++snes9x_gtk_SOURCES += \
+ ../unzip/unzip.c \
+ ../unzip/ioapi.c \
+ ../unzip/zip.c
++endif
+ UNZIPDEFINES=-DUNZIP_SUPPORT
+
+ if JMA
+diff --git a/gtk/configure.ac b/gtk/configure.ac
+index 4d21792..e3bab4e 100644
+--- a/gtk/configure.ac
++++ b/gtk/configure.ac
+@@ -138,6 +138,12 @@ AC_ARG_WITH(zlib,
+ [],
+ [with_zlib=yes])
+
++AC_ARG_WITH(system-zip,
++ [AS_HELP_STRING([--with(out)-system-zip],
++ [Use system zip])],
++ [],
++ [system_zip=check])
++
+ AC_ARG_WITH(screenshot,
+ [AS_HELP_STRING([--with(out)-screenshot],
+ [Screenshot support through libpng if available (default: with)])],
+@@ -313,6 +319,25 @@ if test yes = "$with_screenshot"; then
+ ])
+ fi
+
++SYSTEM_ZIP=0
++SYSTEM_ZIP_CFLAGS=""
++SYSTEM_ZIP_LIBS=""
++ZIP_CFLAGS="-I../unzip"
++if test no != "$with_system_zip" && test yes = "$with_zlib" ; then
++ PKG_CHECK_MODULES([SYSTEM_ZIP],[minizip],[
++ ZIP_CFLAGS=""
++ SYSTEM_ZIP=yes
++ CFLAGS="$CFLAGS $SYSTEM_ZIP_CFLAGS -DSYSTEM_ZIP"
++ LIBS="$LIBS $SYSTEM_ZIP_LIBS"
++ ],[
++ if test check = "$with_system_zip"; then
++ AC_MSG_WARN(Cannot find SYSTEM_ZIP)
++ else
++ AC_MSG_ERROR(--with-system-zip given but cannot find proper zlib)
++ fi
++ ])
++fi
++
+ if test yes = "$with_hq2x" ; then
+ HQ2X=yes
+ CFLAGS="$CFLAGS -DUSE_HQ2X"
+@@ -440,7 +465,7 @@ if test $ac_cv_my_sar_int8 = yes && \
+ CFLAGS="$CFLAGS -DRIGHTSHIFT_IS_SAR"
+ fi
+
+-CFLAGS="$CFLAGS -DUNZIP_SUPPORT -DSPC700_C -I. -I.. -I../unzip"
++CFLAGS="$CFLAGS -DUNZIP_SUPPORT -DSPC700_C -I. -I.. $ZIP_CFLAGS"
+
+ CXXFLAGS="$CFLAGS"
+
+@@ -462,6 +487,7 @@ AM_CONDITIONAL(ALSA, [test yes = "$ALSA"])
+ AM_CONDITIONAL(PULSEAUDIO, [test yes = "$PULSEAUDIO"])
+ AM_CONDITIONAL(HQ2X, [test yes = "$HQ2X"])
+ AM_CONDITIONAL(XBRZ, [test yes = "$XBRZ"])
++AM_CONDITIONAL(SYSTEM_ZIP, [test yes = "$SYSTEM_ZIP"])
+
+ AC_SUBST(NASM)
+ AC_SUBST(NASM_FLAGS)
+diff --git a/loadzip.cpp b/loadzip.cpp
+index 024bc79..dab2504 100644
+--- a/loadzip.cpp
++++ b/loadzip.cpp
+@@ -192,7 +192,11 @@
+
+ #include <assert.h>
+ #include <ctype.h>
++#ifdef SYSTEM_ZIP
++#include <minizip/unzip.h>
++#else
+ #include "unzip/unzip.h"
++#endif
+ #include "snes9x.h"
+ #include "memmap.h"
+
+diff --git a/memmap.cpp b/memmap.cpp
+index 19df95c..98de319 100644
+--- a/memmap.cpp
++++ b/memmap.cpp
+@@ -193,7 +193,11 @@
+ #include <assert.h>
+
+ #ifdef UNZIP_SUPPORT
+-#include "unzip/unzip.h"
++# ifdef SYSTEM_ZIP
++# include <minizip/unzip.h>
++# else
++# include "unzip/unzip.h"
++# endif
+ #endif
+
+ #ifdef JMA_SUPPORT
+diff --git a/stream.cpp b/stream.cpp
+index 37051c3..bb64113 100644
+--- a/stream.cpp
++++ b/stream.cpp
+@@ -192,7 +192,11 @@
+
+ #include <string>
+ #ifdef UNZIP_SUPPORT
+-#include "unzip.h"
++# ifdef SYSTEM_ZIP
++# include <minizip/unzip.h>
++# else
++# include "unzip.h"
++# endif
+ #endif
+ #include "snes9x.h"
+ #include "stream.h"
+diff --git a/stream.h b/stream.h
+index b03dea9..ea22df0 100644
+--- a/stream.h
++++ b/stream.h
+@@ -229,8 +229,11 @@ class fStream : public Stream
+ };
+
+ #ifdef UNZIP_SUPPORT
+-
+-#include "unzip.h"
++# ifdef SYSTEM_ZIP
++# include <minizip/unzip.h>
++# else
++# include "unzip.h"
++# endif
+
+ #define unz_BUFFSIZ 1024
+
+diff --git a/unix/Makefile.in b/unix/Makefile.in
+index 5849568..aecad31 100644
+--- a/unix/Makefile.in
++++ b/unix/Makefile.in
+@@ -2,6 +2,7 @@
+ @S9XNETPLAY@
+ @S9XZIP@
+ @S9XJMA@
++@S9X_SYSTEM_ZIP@
+
+ # Fairly good and special-char-safe descriptor of the os being built on.
+ OS = `uname -s -r -m|sed \"s/ /-/g\"|tr \"[A-Z]\" \"[a-z]\"|tr \"/()\" \"___\"`
+@@ -19,7 +20,11 @@ OBJECTS += ../netplay.o ../server.o
+ endif
+
+ ifdef S9XZIP
+-OBJECTS += ../loadzip.o ../unzip/ioapi.o ../unzip/unzip.o
++OBJECTS += ../loadzip.o
++ifndef SYSTEM_ZIP
++OBJECTS += ../unzip/ioapi.o ../unzip/unzip.o
++INCLUDES = -I../unzip/
++endif
+ endif
+
+ ifdef S9XJMA
+@@ -29,7 +34,7 @@ endif
+ CCC = @CXX@
+ CC = @CC@
+ GASM = @CXX@
+-INCLUDES = -I. -I.. -I../apu/ -I../apu/bapu -I../unzip/ -I../jma/ -I../filter/
++INCLUDES += -I. -I.. -I../apu/ -I../apu/bapu -I../jma/ -I../filter/
+
+ CCFLAGS = @S9XFLGS@ @S9XDEFS@ $(DEFS)
+ CFLAGS = $(CCFLAGS)
+diff --git a/unix/configure.ac b/unix/configure.ac
+index 3c851dc..47f3780 100644
+--- a/unix/configure.ac
++++ b/unix/configure.ac
+@@ -201,16 +201,43 @@ AC_ARG_ENABLE([zip],
+ [enable ZIP support through zlib (default: yes)])],
+ [], [enable_zip="yes"])
+
++S9X_SYSTEM_ZIP="#SYSTEM_ZIP=1"
++
++AC_ARG_WITH([system-zip],
++ [AS_HELP_STRING([--with-system-zip],
++ [Use system zip (default: check)])],
++ [], [with_system_zip="check"])
++
+ if test "x$enable_zip" = "xyes"; then
+- if test "x$snes9x_cv_zlib" = "xyes"; then
+- S9XZIP="S9XZIP=1"
+- S9XDEFS="$S9XDEFS -DUNZIP_SUPPORT"
+- if test "x$enable_gzip" = "xno"; then
+- S9XLIBS="$S9XLIBS -lz"
+- fi
++ if test "x$with_system_zip" != "xno"; then
++ PKG_CHECK_MODULES(
++ SYSTEM_ZIP,
++ minizip,
++ S9XZIP="S9XZIP=1"
++ S9XDEFS="$S9XDEFS -DUNZIP_SUPPORT"
++ S9X_SYSTEM_ZIP="SYSTEM_ZIP=1"
++ S9XLIBS="$S9XLIBS $SYSTEM_ZIP_LIBS"
++ if test "x$enable_gzip" = "xno"; then
++ S9XLIBS="$S9XLIBS -lz"
++ fi
++ S9XDEFS="$S9XDEFS -DSYSTEM_ZIP",
++ if test "x${with_system_zip}" != "xcheck"; then
++ AC_MSG_ERROR([--with-system-zip requested but no proper zlib found.])
++ else
++ AC_MSG_WARN([zlib not found. Build without SYSTEM_ZIP support.])
++ fi
++ )
+ else
+- AC_MSG_WARN([zlib not found. Build without ZIP support.])
+- enable_zip="no"
++ if test "x$snes9x_cv_zlib" = "xyes"; then
++ S9XZIP="S9XZIP=1"
++ S9XDEFS="$S9XDEFS -DUNZIP_SUPPORT"
++ if test "x$enable_gzip" = "xno"; then
++ S9XLIBS="$S9XLIBS -lz"
++ fi
++ else
++ AC_MSG_WARN([zlib not found. Build without ZIP support.])
++ enable_zip="no"
++ fi
+ fi
+ fi
+
+@@ -427,9 +454,11 @@ S9XLIBS="$LIBS $S9XLIBS"
+ S9XFLGS="`echo \"$S9XFLGS\" | sed -e 's/ */ /g'`"
+ S9XDEFS="`echo \"$S9XDEFS\" | sed -e 's/ */ /g'`"
+ S9XLIBS="`echo \"$S9XLIBS\" | sed -e 's/ */ /g'`"
++S9X_SYSTEM_ZIP="`echo \"$S9X_SYSTEM_ZIP\" | sed -e 's/ */ /g'`"
+ S9XFLGS="`echo \"$S9XFLGS\" | sed -e 's/^ *//'`"
+ S9XDEFS="`echo \"$S9XDEFS\" | sed -e 's/^ *//'`"
+ S9XLIBS="`echo \"$S9XLIBS\" | sed -e 's/^ *//'`"
++S9X_SYSTEM_ZIP="`echo \"$S9X_SYSTEM_ZIP\" | sed -e 's/^ *//'`"
+
+ AC_SUBST(S9XFLGS)
+ AC_SUBST(S9XDEFS)
+@@ -439,6 +468,7 @@ AC_SUBST(S9XDEBUGGER)
+ AC_SUBST(S9XNETPLAY)
+ AC_SUBST(S9XZIP)
+ AC_SUBST(S9XJMA)
++AC_SUBST(S9X_SYSTEM_ZIP)
+
+ rm config.info 2>/dev/null
+
+@@ -459,6 +489,7 @@ netplay support...... $enable_netplay
+ gamepad support...... $enable_gamepad
+ GZIP support......... $enable_gzip
+ ZIP support.......... $enable_zip
++SYSTEM_ZIP........... $with_system_zip
+ JMA support.......... $enable_jma
+ debugger............. $enable_debugger
+
+--
+2.10.2
+
diff --git a/games-emulation/snes9x/metadata.xml b/games-emulation/snes9x/metadata.xml
new file mode 100644
index 000000000000..197a5fc2e9d4
--- /dev/null
+++ b/games-emulation/snes9x/metadata.xml
@@ -0,0 +1,16 @@
+<?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="netplay">Enable playing ROMs over the network (not recommended)</flag>
+ <flag name="xrandr">Enable support for the X xrandr extension</flag>
+ </use>
+ <upstream>
+ <remote-id type="google-code">snes9x-gtk</remote-id>
+ <remote-id type="github">snes9xgit/snes9x</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/snes9x/snes9x-1.53.ebuild b/games-emulation/snes9x/snes9x-1.53.ebuild
new file mode 100644
index 000000000000..ac5a1659915f
--- /dev/null
+++ b/games-emulation/snes9x/snes9x-1.53.ebuild
@@ -0,0 +1,119 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit autotools eutils flag-o-matic multilib gnome2-utils games
+
+DESCRIPTION="Super Nintendo Entertainment System (SNES) emulator"
+HOMEPAGE="https://code.google.com/p/snes9x-gtk/"
+SRC_URI="https://snes9x-gtk.googlecode.com/files/${P}-src.tar.bz2"
+
+LICENSE="Snes9x GPL-2 GPL-2+ LGPL-2.1 LGPL-2.1+ ISC MIT ZLIB Info-ZIP"
+SLOT="0"
+KEYWORDS="amd64 ppc64 x86 ~x86-fbsd"
+IUSE="alsa debug gtk joystick multilib netplay nls opengl oss png pulseaudio portaudio +xv +xrandr zlib"
+RESTRICT="bindist"
+
+RDEPEND="x11-libs/libX11
+ x11-libs/libXext
+ png? ( >=media-libs/libpng-1.2.43:0 )
+ gtk? ( >=x11-libs/gtk+-2.10:2
+ x11-misc/xdg-utils
+ portaudio? ( >=media-libs/portaudio-19_pre )
+ joystick? ( >=media-libs/libsdl-1.2.12[joystick] )
+ opengl? ( virtual/opengl )
+ xv? ( x11-libs/libXv )
+ xrandr? ( x11-libs/libXrandr )
+ alsa? ( media-libs/alsa-lib )
+ pulseaudio? ( media-sound/pulseaudio ) )"
+DEPEND="${RDEPEND}
+ x11-proto/xproto
+ gtk? ( virtual/pkgconfig
+ xv? ( x11-proto/videoproto ) )
+ nls? ( dev-util/intltool )"
+
+S=${WORKDIR}/${P}-src/unix
+
+pkg_setup() {
+ games_pkg_setup
+}
+
+src_prepare() {
+ cd "${WORKDIR}"/${P}-src
+ sed -i -e '/pedantic/d' {gtk,unix}/configure.ac || die
+ sed -i -e '75i#define OF(x) x' unzip/{un,}zip.h || die
+ sed -i -e '22i#define OF(x) x' unzip/ioapi.h || die
+ epatch "${FILESDIR}"/${P}-build.patch
+ epatch "${FILESDIR}"/${P}-cross-compile.patch
+ cd unix
+ eautoreconf
+ if use gtk; then
+ cd ../gtk
+ eautoreconf
+ fi
+}
+
+src_configure() {
+ append-ldflags -Wl,-z,noexecstack
+
+ egamesconf \
+ $(use_enable joystick gamepad) \
+ $(use_enable debug debugger) \
+ $(use_enable netplay) \
+ $(use_enable zlib gzip) \
+ $(use_enable zlib zip) \
+ $(use_enable png screenshot)
+
+ if use gtk; then
+ cd ../gtk
+ egamesconf \
+ --datadir=/usr/share \
+ $(use_enable nls) \
+ $(use_with opengl) \
+ $(use_with joystick) \
+ $(use_with xv) \
+ $(use_with xrandr) \
+ $(use_with netplay) \
+ $(use_with zlib) \
+ $(use_with alsa) \
+ $(use_with oss) \
+ $(use_with pulseaudio) \
+ $(use_with portaudio) \
+ $(use_with png screenshot)
+ fi
+}
+
+src_compile() {
+ games_src_compile
+ if use gtk; then
+ emake -C ../gtk
+ fi
+}
+
+src_install() {
+ dogamesbin ${PN}
+
+ dohtml {.,..}/docs/*.html
+ dodoc ../docs/{snes9x.conf.default,{changes,control-inputs,controls,snapshots}.txt}
+
+ if use gtk; then
+ emake -C ../gtk DESTDIR="${D}" install
+ dodoc ../gtk/{AUTHORS,doc/README}
+ fi
+
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ games_pkg_preinst
+ use gtk && gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ use gtk && gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ use gtk && gnome2_icon_cache_update
+}
diff --git a/games-emulation/snes9x/snes9x-1.54.1.ebuild b/games-emulation/snes9x/snes9x-1.54.1.ebuild
new file mode 100644
index 000000000000..ecaef4861cd0
--- /dev/null
+++ b/games-emulation/snes9x/snes9x-1.54.1.ebuild
@@ -0,0 +1,123 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+inherit autotools eutils flag-o-matic multilib gnome2-utils
+
+DESCRIPTION="Super Nintendo Entertainment System (SNES) emulator"
+HOMEPAGE="https://github.com/snes9xgit/snes9x"
+SRC_URI="https://github.com/snes9xgit/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="Snes9x GPL-2 GPL-2+ LGPL-2.1 LGPL-2.1+ ISC MIT ZLIB Info-ZIP"
+SLOT="0"
+KEYWORDS="amd64 ppc64 x86 ~x86-fbsd"
+IUSE="alsa debug gtk joystick multilib netplay nls opengl oss png pulseaudio portaudio +xv +xrandr"
+RESTRICT="bindist"
+
+RDEPEND="
+ sys-libs/zlib[minizip]
+ x11-libs/libX11
+ x11-libs/libXext
+ png? ( >=media-libs/libpng-1.2.43:0 )
+ gtk? ( >=x11-libs/gtk+-2.10:2
+ x11-misc/xdg-utils
+ portaudio? ( >=media-libs/portaudio-19_pre )
+ joystick? ( >=media-libs/libsdl-1.2.12[joystick] )
+ opengl? ( virtual/opengl )
+ xv? ( x11-libs/libXv )
+ xrandr? ( x11-libs/libXrandr )
+ alsa? ( media-libs/alsa-lib )
+ pulseaudio? ( media-sound/pulseaudio ) )
+"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ x11-proto/xproto
+ gtk? ( virtual/pkgconfig
+ xv? ( x11-proto/videoproto ) )
+ nls? ( dev-util/intltool )"
+
+S="${WORKDIR}/${P}/unix"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.54.1-build.patch
+ "${FILESDIR}"/${PN}-1.53-cross-compile.patch
+ "${FILESDIR}"/${PN}-1.54.1-system-zlib.patch
+)
+
+src_prepare() {
+ cd "${WORKDIR}"/${P} || die
+ rm -r unzip || die
+ default
+ cd unix
+ eautoreconf
+ if use gtk; then
+ cd ../gtk || die
+ eautoreconf
+ fi
+}
+
+src_configure() {
+ append-ldflags -Wl,-z,noexecstack
+
+ # build breaks when zlib/zip support is disabled
+ econf \
+ --enable-gzip \
+ --enable-zip \
+ --with-system-zip \
+ $(use_enable joystick gamepad) \
+ $(use_enable debug debugger) \
+ $(use_enable netplay) \
+ $(use_enable png screenshot)
+
+ if use gtk; then
+ cd ../gtk || die
+ econf \
+ --datadir=/usr/share \
+ --with-zlib \
+ --with-system-zip \
+ $(use_enable nls) \
+ $(use_with opengl) \
+ $(use_with joystick) \
+ $(use_with xv) \
+ $(use_with xrandr) \
+ $(use_with netplay) \
+ $(use_with alsa) \
+ $(use_with oss) \
+ $(use_with pulseaudio) \
+ $(use_with portaudio) \
+ $(use_with png screenshot)
+ fi
+}
+
+src_compile() {
+ emake
+ if use gtk; then
+ emake -C ../gtk
+ fi
+}
+
+src_install() {
+ dobin ${PN}
+
+ dodoc ../docs/{snes9x.conf.default,{changes,control-inputs,controls,snapshots}.txt}
+
+ if use gtk; then
+ emake -C ../gtk DESTDIR="${D}" install
+ dodoc ../gtk/{AUTHORS,doc/README}
+ fi
+
+ docinto html
+ dodoc {.,..}/docs/*.html
+}
+
+pkg_preinst() {
+ use gtk && gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ use gtk && gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ use gtk && gnome2_icon_cache_update
+}