summaryrefslogtreecommitdiff
path: root/games-emulation/mednafen
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/mednafen
reinit the tree, so we can have metadata
Diffstat (limited to 'games-emulation/mednafen')
-rw-r--r--games-emulation/mednafen/Manifest13
-rw-r--r--games-emulation/mednafen/files/mednafen-0.9.41-remove-cflags.patch57
-rw-r--r--games-emulation/mednafen/files/mednafen-0.9.41-zlib.patch30
-rw-r--r--games-emulation/mednafen/mednafen-0.9.41.ebuild70
-rw-r--r--games-emulation/mednafen/mednafen-0.9.45.1.ebuild109
-rw-r--r--games-emulation/mednafen/mednafen-0.9.45.ebuild109
-rw-r--r--games-emulation/mednafen/mednafen-0.9.46.ebuild115
-rw-r--r--games-emulation/mednafen/metadata.xml15
8 files changed, 518 insertions, 0 deletions
diff --git a/games-emulation/mednafen/Manifest b/games-emulation/mednafen/Manifest
new file mode 100644
index 000000000000..fe6ae63b3761
--- /dev/null
+++ b/games-emulation/mednafen/Manifest
@@ -0,0 +1,13 @@
+AUX mednafen-0.9.41-remove-cflags.patch 2398 SHA256 b452e317d68292681651cd6a15cd7aa414b373bed5167dd409969e5a5eb53b26 SHA512 005404787759e088de0059432611354b068a3b13dd0d42580f96550bb48773badaa1176f810924b7ecb29547033f37c6340908ddf9793c949f8428cf7ddabff6 WHIRLPOOL 976c32ee2b11dd57bc3efd5ef175710a883ec6a68d4ba92e6fe40c68530e6e31e962892b04e810e2d6f8efdfc6b67762d2848bbe1706d5b1a058ad4e755e1dbe
+AUX mednafen-0.9.41-zlib.patch 1212 SHA256 1d56702f10ec8b7bbaa09bfc883cc30704702a1d9a65756ec7c28f11f8381882 SHA512 fa8ee911934107a1a4bdcdec599a7239b1a8d64307650c9d070f6b78d0ceadd83e6670b69950e4f38778b5901b33b576a05b04da9874a0b061d69a489596dacd WHIRLPOOL df7f2a6f9c8a499d72a0362d89d429b80e0ae73121167613adc71fc52efcf45ef0a24a85401858d2cfa578ac5cea23d4c33f3e70af9259825eeb4243751bf637
+DIST mednafen-0.9.41.tar.xz 3148348 SHA256 74736b9b52a7ba6270b67ae8e6c876a887e0e26a00a7d96bdd49af17992aac47 SHA512 d3c7707874eabbec41e5b725813d16e599f3ad89ecbd9c8e1264184d74ab2bf7a21a3f6fe177b6bc429f7bd56f9eea17a9a6fefce8e70b82e87a93d75f5d39c9 WHIRLPOOL f754a45f46a5cd18117b1b710dd7fed5ebcfb311bf4ed4b7961c99636c13559db75f83cf7b34122fb403b7794ddeec6af79469bb7743cb60a7840ffe807fa2d7
+DIST mednafen-0.9.45.1.tar.xz 3183380 SHA256 f95f68acc14f9b30b201e15b8205d85ac9dc7e581ea6b61e225e990491f01e69 SHA512 b49b7638166dfb20d43c3278e7084e99e535dc9c2c1e3ecad82ebf41a1dddbeca9350dfcc26eb43d1661cbe5aa3ba4cde3010ca5680ae9398dc160cbe11d6726 WHIRLPOOL b63568d3a6a4aa055c6a1a576ad74d9bdd4ffcb8fdb41a44dedf390a591eb2f21a382d638df7343927b1a95f236ef9ab505cbc7cb0bb2f1c25406730252223bc
+DIST mednafen-0.9.45.tar.xz 3184340 SHA256 49715544a5eb7a678f7f01994f38aa14e2192f00d201684184665665073a600e SHA512 d2d61eef0a5ab2c3109fb3c4fbdb2509504c61ffaab14a51e413204f08a622e47c116c7333866a3406a1fa7ac4bf68349c0212bc9fcb544d4953898b03a2fb71 WHIRLPOOL 3e8466852d8c04207a307ac2d74c5d9b76b51d0f9cd2c0ae16f59d57ae884dec8fd8d62454996c574f25a530ac568f7a2c884657b2f6b85d0810dc1fb51ad9e0
+DIST mednafen-0.9.46.tar.xz 3187988 SHA256 674faf42bdb0ad5649aea65da266b0be3428995caaa7be183fc6d3ed7732467a SHA512 ea624f076922570001393d5d04cc1b20b3d005d31de4095ee5c7a985be2b61e8d3aa5e78c64e751e8233adc89a31be955372caeb2818d0a5cc71ba9380931620 WHIRLPOOL f3e02ea2c4511206987c7c1d500d573ec4e166a03db1c35ae12ddadffb5644ce2e26e336b6c27d3a3a7fc4edbbd5b0c34aa3ce5d941d222afb16ab2601701578
+EBUILD mednafen-0.9.41.ebuild 1471 SHA256 6da821849a3b78a70a433e760e893c47565de7a102d83f5fd320d7e211ae093d SHA512 d9f32e6163c71fcbf177c93da872c8ee3ecf260ed662b9e5ae3753750775f250ebd67429c3ea234595e305d84e655a8adebe8f8b6b176bf5d081de61cfb104bc WHIRLPOOL 97779a4185189c5a86eceb852cc8d871c231f56170649b15487934be7571456f306e1634a84e4cb8bfbde2959910c87d84beea747cbc34cf192d36e18d73f322
+EBUILD mednafen-0.9.45.1.ebuild 3109 SHA256 b5a7593368f1227b966925e03f4c70f601408815232d98c114e1e16b3a82e9d4 SHA512 6b94e1fdd8555df9f4da4ca67688ae15a73712b6053c10b1c4ea1fbabd2c0f6144f0a3503641821988faeb894429faa97c52ac6542114b03f1a5b14c74cf3ca4 WHIRLPOOL 6ab6f94cfa1143d3638437795a24761048240fdadb2fbfd56134a7ac80d434e0bbf2d87e9995b737c3a794a8066f0f177de6b659258fdf4add7113e3a4dfd04a
+EBUILD mednafen-0.9.45.ebuild 3102 SHA256 5bceb8e6c583a8da68e861055b2a12e908f849f028df0a08b338d56934882449 SHA512 b63de103ffa58b2dc67ed6d13fb6d934f5d036b7451d8724361fc41395b7a2b41e2e78e651b9dd1342f03f681960c75560f40fa671a59ebaae46916024f299ad WHIRLPOOL e4f2f555b567844be3f581f67acfa7c953a8c6e5ec79b337e01c9856e0102c95cad5e6205e20300a8b5fd42dc575d15dcdfdba3fea93ce27a5455566ca5004f2
+EBUILD mednafen-0.9.46.ebuild 3367 SHA256 f6ff0fb13b21080ba2073874a032743d34ea1ccfc47a20b837f2c0862377e65c SHA512 3dc665af4a7a96d244d40d01897c53311a55c626f04ace5b1e9db32708613ea816338a042790f4bca5c3d399d8d8f99e857c8f88686210ea0c828d0d70e02a0f WHIRLPOOL 7f8e37cae5af656c8d8905fd9e804047baae3b55f0db28562a581bf46cec72ae9de6a7f14c5812f015ab175e7c88ac370e7f333c596d6055fdb178179c9ba3f3
+MISC ChangeLog 3588 SHA256 70fa63fe5d5f34e2ecd3a95a041c78ccc1a3557b1c914c74face1b470679fb29 SHA512 6ac143787588ab08724f21fa25aa00667c3d74fcf38344a2073a5913075cc514109bd8112dd6d539317bca84fa13a0460c4d43f6fd4149acd1162ce71369e818 WHIRLPOOL ab64a83607629cb2680a52c372d79ad2a96cea276cf5acd63a34c84387d49acf1be85fb7d52295ad98b318878c4ced7bb2361cdc65c487bcd752ccbf306d2a6f
+MISC ChangeLog-2015 9093 SHA256 76b4fae0e9f65a65734422d348703a5440f4f80d9e3b34f2d5e89bad888a2bb6 SHA512 b148eefa5c570c2c7215022d68107d54f16c62227fe51d1cbcfd871a2da546570758f2b852936e064d7d3945a8f92249108f36201d19799b8f8a030136ace5d8 WHIRLPOOL 0be768226fb92ff2fa42f7aefad8ccd71ebd7590c977f174efa0c336a696cea3b33d160be9470f860bac213ca6004c88d8027e9d061f2cdb7d8fbdfe51e04056
+MISC metadata.xml 475 SHA256 17b402797d5cc88773c1c3a757a93ef4585f4e029954ca0d3610bc719c360694 SHA512 d13e5f6522d5150282ed8bfb44bcdef66a30c392abdd8bf142a0c04fa3d2fd9dc09395510c771fb110cc6123e4f738cc28f33f93cf75a8f5538063eef4ce8cc5 WHIRLPOOL 10fa24189b3da52402563edf64afbf12a82a85bfc66176e23e847c23e9ba96f57598e12314ef6533b2641e36c6942adade5ea5916800bb00f229d511d03ba2cb
diff --git a/games-emulation/mednafen/files/mednafen-0.9.41-remove-cflags.patch b/games-emulation/mednafen/files/mednafen-0.9.41-remove-cflags.patch
new file mode 100644
index 000000000000..a0a52997a27b
--- /dev/null
+++ b/games-emulation/mednafen/files/mednafen-0.9.41-remove-cflags.patch
@@ -0,0 +1,57 @@
+Remove flags that subvert user choice in Gentoo
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -88,21 +88,7 @@
+ AC_CHECK_LIB([z], [zlibVersion], ZLIB_LIBS="-lz", AC_MSG_ERROR([*** zlib not found!]))
+ AC_SUBST([ZLIB_LIBS])
+
+-dnl -fno-fast-math and -fno-unsafe-math-optimizations to make sure it's disabled, as the fast-math feature on certain older
+-dnl versions of gcc produces horribly broken code(and even when it's working correctly, it can have somewhat unpredictable effects).
+-dnl
+-dnl -fno-aggressive-loop-optimizations because I don't trust gcc's aggressive loop optimizations, and there miiight be old code
+-dnl in Mednafen that would cause problems.
+-dnl
+-dnl -fomit-frame-pointer is required for some x86 inline assembly to compile.
+-dnl
+ OPTIMIZER_FLAGS=""
+-AX_CFLAGS_GCC_OPTION([-fno-fast-math], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fno-unsafe-math-optimizations], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fno-aggressive-loop-optimizations], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fno-ipa-icf], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fomit-frame-pointer], OPTIMIZER_FLAGS)
+-
+ dnl
+ dnl Aggressively try to disable PIC and PIE, as it has a significant performance overhead and will
+ dnl break some code(with compile-time failures or run-time assert()s triggering).
+@@ -110,12 +95,6 @@
+ dnl Use -fwrapv instead of -fno-strict-overflow; -fno-strict-overflow is buggy on gcc and does not work as documented/implied.
+ dnl
+ CODEGEN_FLAGS=""
+-AX_CFLAGS_GCC_OPTION([-fno-pic], CODEGEN_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fno-pie], CODEGEN_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fno-PIC], CODEGEN_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fno-PIE], CODEGEN_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-nopie], CODEGEN_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-no-pie], CODEGEN_FLAGS)
+ AX_CFLAGS_GCC_OPTION([-fwrapv], CODEGEN_FLAGS)
+ AX_CFLAGS_GCC_OPTION([-fjump-tables], CODEGEN_FLAGS)
+
+@@ -139,9 +118,6 @@
+ # Used as needed in Makefile.am:
+ #
+ NO_STACK_PROTECTOR_FLAGS=""
+-AX_CFLAGS_GCC_OPTION([-fno-stack-protector], NO_STACK_PROTECTOR_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fno-stack-protector-all], NO_STACK_PROTECTOR_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fno-stack-protector-strong], NO_STACK_PROTECTOR_FLAGS)
+ AC_SUBST(NO_STACK_PROTECTOR_FLAGS)
+
+ # -----------------------------------
+@@ -165,7 +141,6 @@
+ # Begin ss flags
+ #
+ SS_EXTRA_FLAGS=""
+-AX_CFLAGS_GCC_OPTION([-mtune=haswell], SS_EXTRA_FLAGS)
+ AC_SUBST(SS_EXTRA_FLAGS)
+ #
+ # End ss flags
diff --git a/games-emulation/mednafen/files/mednafen-0.9.41-zlib.patch b/games-emulation/mednafen/files/mednafen-0.9.41-zlib.patch
new file mode 100644
index 000000000000..7f78d385d8eb
--- /dev/null
+++ b/games-emulation/mednafen/files/mednafen-0.9.41-zlib.patch
@@ -0,0 +1,30 @@
+Use system minizip instead of bundled one
+
+--- a/include/mednafen/compress/Makefile.am.inc
++++ b/include/mednafen/compress/Makefile.am.inc
+@@ -1 +1 @@
+-mednafen_SOURCES += compress/minilzo.c compress/ioapi.c compress/unzip.c compress/GZFileStream.cpp compress/ZLInflateFilter.cpp
++mednafen_SOURCES += compress/minilzo.c compress/ioapi.c compress/GZFileStream.cpp compress/ZLInflateFilter.cpp
+--- a/include/mednafen/file.cpp
++++ b/include/mednafen/file.cpp
+@@ -29,7 +29,7 @@
+ #include <errno.h>
+ #include <trio/trio.h>
+
+-#include "compress/unzip.h"
++#include <minizip/unzip.h>
+
+ #include "file.h"
+ #include "general.h"
+--- a/include/mednafen/Makefile.am
++++ b/include/mednafen/Makefile.am
+@@ -6,7 +6,7 @@
+ bin_PROGRAMS = mednafen
+
+ mednafen_SOURCES = debug.cpp error.cpp mempatcher.cpp settings.cpp endian.cpp Time.cpp mednafen.cpp git.cpp file.cpp general.cpp memory.cpp netplay.cpp state.cpp state_rewind.cpp movie.cpp player.cpp PSFLoader.cpp SSFLoader.cpp SNSFLoader.cpp SPCReader.cpp tests.cpp qtrecord.cpp Stream.cpp MemoryStream.cpp FileStream.cpp IPSPatcher.cpp
+-mednafen_LDADD = trio/libtrio.a
++mednafen_LDADD = trio/libtrio.a -lminizip
+ mednafen_DEPENDENCIES = trio/libtrio.a
+
+ if HAVE_SDL
+
diff --git a/games-emulation/mednafen/mednafen-0.9.41.ebuild b/games-emulation/mednafen/mednafen-0.9.41.ebuild
new file mode 100644
index 000000000000..197526339d1b
--- /dev/null
+++ b/games-emulation/mednafen/mednafen-0.9.41.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools flag-o-matic pax-utils
+
+DESCRIPTION="Argument-driven multi-system emulator utilizing OpenGL and SDL"
+HOMEPAGE="https://mednafen.github.io/"
+SRC_URI="https://mednafen.github.io/releases/files/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="alsa altivec cjk debugger jack nls pax_kernel"
+
+RDEPEND="
+ dev-libs/libcdio
+ media-libs/libsdl[sound,joystick,opengl,video]
+ media-libs/libsndfile
+ sys-libs/zlib[minizip]
+ virtual/opengl
+ alsa? ( media-libs/alsa-lib )
+ jack? ( media-sound/jack-audio-connection-kit )
+ nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.9.41-remove-cflags.patch
+ "${FILESDIR}"/${PN}-0.9.41-zlib.patch
+)
+
+pkg_pretend() {
+ if has ccache ${FEATURES}; then
+ ewarn
+ ewarn "If you experience build failure, try turning off ccache in FEATURES."
+ ewarn
+ fi
+}
+
+src_prepare() {
+ default
+ eautoreconf
+}
+
+src_configure() {
+ # very sensitive code (bug #539992)
+ strip-flags
+ append-flags -fomit-frame-pointer -fwrapv
+ econf \
+ $(use_enable alsa) \
+ $(use_enable altivec) \
+ $(use_enable cjk cjk-fonts) \
+ $(use_enable debugger) \
+ $(use_enable jack) \
+ $(use_enable nls)
+}
+
+src_install() {
+ default
+ dodoc Documentation/cheats.txt
+
+ if use pax_kernel; then
+ pax-mark m "${ED%/}"/bin/mednafen || die
+ fi
+}
diff --git a/games-emulation/mednafen/mednafen-0.9.45.1.ebuild b/games-emulation/mednafen/mednafen-0.9.45.1.ebuild
new file mode 100644
index 000000000000..6c135563e0e9
--- /dev/null
+++ b/games-emulation/mednafen/mednafen-0.9.45.1.ebuild
@@ -0,0 +1,109 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools flag-o-matic pax-utils
+
+DESCRIPTION="Argument-driven multi-system emulator utilizing OpenGL and SDL"
+HOMEPAGE="https://mednafen.github.io/"
+SRC_URI="https://mednafen.github.io/releases/files/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="alsa altivec cjk debugger jack nls pax_kernel"
+
+RDEPEND="
+ dev-libs/libcdio
+ >=dev-libs/lzo-2.10
+ media-libs/libsdl[sound,joystick,opengl,video]
+ media-libs/libsndfile
+ sys-libs/zlib[minizip]
+ virtual/opengl
+ alsa? ( media-libs/alsa-lib )
+ jack? ( media-sound/jack-audio-connection-kit )
+ nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}
+
+pkg_pretend() {
+ if has ccache ${FEATURES}; then
+ ewarn
+ ewarn "If you experience build failure, try turning off ccache in FEATURES."
+ ewarn
+ fi
+}
+
+src_prepare() {
+ default
+
+ # Unfortunately, upstream is insane and thinks mucking with CFLAGS is okay, if
+ # it prevents "users who don't understand the consequences of what they're doing".
+ # We use sed's here, as they're more forward-compatible than patches which need to
+ # be constantly rebased. DO NOT REPLACE THEM UNLESS YOU HAVE PERMISSION FROM GAMES.
+ sed -e '/-fno-fast-math/d' \
+ -e '/-fno-unsafe-math-optimizations/d' \
+ -e '/-fno-aggressive-loop-optimizations/d' \
+ -e '/-fno-ipa-icf/d' \
+ -e '/-fno-printf-return-value/d' \
+ -e '/-fomit-frame-pointer/d' \
+ -e '/-fno-pic/d' \
+ -e '/-fno-pie/d' \
+ -e '/-fno-PIC/d' \
+ -e '/-fno-PIE/d' \
+ -e '/-nopie/d' \
+ -e '/-no-pie/d' \
+ -e '/-fno-stack-protector/d' \
+ -e '/-fno-stack-protector-all/d' \
+ -e '/-fno-stack-protector-strong/d' \
+ -e '/-mtune=haswell/d' \
+ -i configure.ac || die
+
+ # Furthermore, upstream is also insane about bundling libraries and considers it
+ # "an aesthetics issue" and is even unwilling to make unbundling optional.
+ # Libs to unbundle: minilzo, minizip
+ sed -e '/PKG_PROG_PKG_CONFIG/a PKG_CHECK_MODULES([LZO], [lzo2])' \
+ -i configure.ac || die
+ sed -e '/bin_PROGRAMS/a mednafen_CPPFLAGS = \$(LZO_CFLAGS)' \
+ -i src/Makefile.am || die
+ sed -e 's:"compress/minilzo.h":<lzo1x.h>:' \
+ -i src/{mednafen,qtrecord}.cpp || die
+ sed -e 's:compress/ioapi.c::' \
+ -e 's:compress/unzip.c::' \
+ -e 's:compress/minilzo.c::' \
+ -i src/compress/Makefile.am.inc || die
+ sed -e 's:"compress/unzip.h":<minizip/unzip.h>:' \
+ -i src/file.cpp || die
+ sed -e 's:\(mednafen_LDADD.*trio/libtrio\.a\):\1 -lminizip \$(LZO_LIBS):' \
+ -i src/Makefile.am || die
+ # delete bundled files just to be sure...
+ rm src/compress/{ioapi.?,*lzo*,unzip.?} || die
+
+ eautoreconf
+}
+
+src_configure() {
+ # very sensitive code (bug #539992)
+ strip-flags
+ append-flags -fomit-frame-pointer -fwrapv
+ econf \
+ $(use_enable alsa) \
+ $(use_enable altivec) \
+ $(use_enable cjk cjk-fonts) \
+ $(use_enable debugger) \
+ $(use_enable jack) \
+ $(use_enable nls)
+}
+
+src_install() {
+ default
+ dodoc Documentation/cheats.txt
+
+ if use pax_kernel; then
+ pax-mark m "${ED%/}"/usr/bin/mednafen || die
+ fi
+}
diff --git a/games-emulation/mednafen/mednafen-0.9.45.ebuild b/games-emulation/mednafen/mednafen-0.9.45.ebuild
new file mode 100644
index 000000000000..d42600141e76
--- /dev/null
+++ b/games-emulation/mednafen/mednafen-0.9.45.ebuild
@@ -0,0 +1,109 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools flag-o-matic pax-utils
+
+DESCRIPTION="Argument-driven multi-system emulator utilizing OpenGL and SDL"
+HOMEPAGE="https://mednafen.github.io/"
+SRC_URI="https://mednafen.github.io/releases/files/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="alsa altivec cjk debugger jack nls pax_kernel"
+
+RDEPEND="
+ dev-libs/libcdio
+ dev-libs/lzo
+ media-libs/libsdl[sound,joystick,opengl,video]
+ media-libs/libsndfile
+ sys-libs/zlib[minizip]
+ virtual/opengl
+ alsa? ( media-libs/alsa-lib )
+ jack? ( media-sound/jack-audio-connection-kit )
+ nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}
+
+pkg_pretend() {
+ if has ccache ${FEATURES}; then
+ ewarn
+ ewarn "If you experience build failure, try turning off ccache in FEATURES."
+ ewarn
+ fi
+}
+
+src_prepare() {
+ default
+
+ # Unfortunately, upstream is insane and thinks mucking with CFLAGS is okay, if
+ # it prevents "users who don't understand the consequences of what they're doing".
+ # We use sed's here, as they're more forward-compatible than patches which need to
+ # be constantly rebased. DO NOT REPLACE THEM UNLESS YOU HAVE PERMISSION FROM GAMES.
+ sed -e '/-fno-fast-math/d' \
+ -e '/-fno-unsafe-math-optimizations/d' \
+ -e '/-fno-aggressive-loop-optimizations/d' \
+ -e '/-fno-ipa-icf/d' \
+ -e '/-fno-printf-return-value/d' \
+ -e '/-fomit-frame-pointer/d' \
+ -e '/-fno-pic/d' \
+ -e '/-fno-pie/d' \
+ -e '/-fno-PIC/d' \
+ -e '/-fno-PIE/d' \
+ -e '/-nopie/d' \
+ -e '/-no-pie/d' \
+ -e '/-fno-stack-protector/d' \
+ -e '/-fno-stack-protector-all/d' \
+ -e '/-fno-stack-protector-strong/d' \
+ -e '/-mtune=haswell/d' \
+ -i configure.ac || die
+
+ # Furthermore, upstream is also insane about bundling libraries and considers it
+ # "an aesthetics issue" and is even unwilling to make unbundling optional.
+ # Libs to unbundle: minilzo, minizip
+ sed -e '/PKG_PROG_PKG_CONFIG/a PKG_CHECK_MODULES([LZO], [lzo2])' \
+ -i configure.ac || die
+ sed -e '/bin_PROGRAMS/a mednafen_CPPFLAGS = \$(LZO_CFLAGS)' \
+ -i src/Makefile.am || die
+ sed -e 's:"compress/minilzo.h":<lzo1x.h>:' \
+ -i src/{mednafen,qtrecord}.cpp || die
+ sed -e 's:compress/ioapi.c::' \
+ -e 's:compress/unzip.c::' \
+ -e 's:compress/minilzo.c::' \
+ -i src/compress/Makefile.am.inc || die
+ sed -e 's:"compress/unzip.h":<minizip/unzip.h>:' \
+ -i src/file.cpp || die
+ sed -e 's:\(mednafen_LDADD.*trio/libtrio\.a\):\1 -lminizip \$(LZO_LIBS):' \
+ -i src/Makefile.am || die
+ # delete bundled files just to be sure...
+ rm src/compress/{ioapi.?,*lzo*,unzip.?} || die
+
+ eautoreconf
+}
+
+src_configure() {
+ # very sensitive code (bug #539992)
+ strip-flags
+ append-flags -fomit-frame-pointer -fwrapv
+ econf \
+ $(use_enable alsa) \
+ $(use_enable altivec) \
+ $(use_enable cjk cjk-fonts) \
+ $(use_enable debugger) \
+ $(use_enable jack) \
+ $(use_enable nls)
+}
+
+src_install() {
+ default
+ dodoc Documentation/cheats.txt
+
+ if use pax_kernel; then
+ pax-mark m "${ED%/}"/usr/bin/mednafen || die
+ fi
+}
diff --git a/games-emulation/mednafen/mednafen-0.9.46.ebuild b/games-emulation/mednafen/mednafen-0.9.46.ebuild
new file mode 100644
index 000000000000..a42d9936b35c
--- /dev/null
+++ b/games-emulation/mednafen/mednafen-0.9.46.ebuild
@@ -0,0 +1,115 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools flag-o-matic pax-utils
+
+DESCRIPTION="Argument-driven multi-system emulator utilizing OpenGL and SDL"
+HOMEPAGE="https://mednafen.github.io/"
+SRC_URI="https://mednafen.github.io/releases/files/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="alsa altivec cjk debugger jack nls pax_kernel"
+
+RDEPEND="
+ dev-libs/libcdio
+ >=dev-libs/lzo-2.10
+ media-libs/libsdl[sound,joystick,opengl,video]
+ media-libs/libsndfile
+ sys-libs/zlib[minizip]
+ virtual/opengl
+ alsa? ( media-libs/alsa-lib )
+ jack? ( media-sound/jack-audio-connection-kit )
+ nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${PN}
+
+pkg_pretend() {
+ if has ccache ${FEATURES}; then
+ ewarn
+ ewarn "If you experience build failure, try turning off ccache in FEATURES."
+ ewarn
+ fi
+}
+
+src_prepare() {
+ default
+
+ # Unfortunately, upstream is insane and thinks mucking with CFLAGS is okay, if
+ # it prevents "users who don't understand the consequences of what they're doing".
+ # We use sed's here, as they're more forward-compatible than patches which need to
+ # be constantly rebased. DO NOT REPLACE THEM UNLESS YOU HAVE PERMISSION FROM GAMES.
+ sed -e '/-fno-fast-math/d' \
+ -e '/-fno-unsafe-math-optimizations/d' \
+ -e '/-fno-aggressive-loop-optimizations/d' \
+ -e '/-fno-ipa-icf/d' \
+ -e '/-fno-printf-return-value/d' \
+ -e '/-fomit-frame-pointer/d' \
+ -e '/-fno-pic/d' \
+ -e '/-fno-pie/d' \
+ -e '/-fno-PIC/d' \
+ -e '/-fno-PIE/d' \
+ -e '/-nopie/d' \
+ -e '/-no-pie/d' \
+ -e '/-fno-stack-protector/d' \
+ -e '/-fno-stack-protector-all/d' \
+ -e '/-fno-stack-protector-strong/d' \
+ -e '/-mtune=haswell/d' \
+ -i configure.ac || die
+
+ # Furthermore, upstream is also insane about bundling libraries and considers it
+ # "an aesthetics issue" and is even unwilling to make unbundling optional.
+ # Libs to unbundle: minilzo, minizip
+ sed -e '/PKG_PROG_PKG_CONFIG/a PKG_CHECK_MODULES([LZO], [lzo2])' \
+ -i configure.ac || die
+ sed -e '/bin_PROGRAMS/a mednafen_CPPFLAGS = \$(LZO_CFLAGS)' \
+ -i src/Makefile.am || die
+ sed -e 's:"compress/minilzo.h":<lzo1x.h>:' \
+ -i src/{mednafen,qtrecord}.cpp || die
+ sed -e 's:compress/ioapi.c::' \
+ -e 's:compress/unzip.c::' \
+ -e 's:compress/minilzo.c::' \
+ -i src/compress/Makefile.am.inc || die
+ sed -e 's:"compress/unzip.h":<minizip/unzip.h>:' \
+ -i src/file.cpp || die
+ sed -e 's:\(mednafen_LDADD.*trio/libtrio\.a\):\1 -lminizip \$(LZO_LIBS):' \
+ -i src/Makefile.am || die
+ # delete bundled files just to be sure...
+ rm src/compress/{ioapi.?,*lzo*,unzip.?} || die
+
+ # The insanity continues... upstream now believes it needs to
+ # warn users when compiling with -fPIC/-fPIE enabled
+ sed -e '/Compiling with position-independent code generation enabled is not recommended, for performance reasons/d' \
+ -i src/types.h || die
+
+ eautoreconf
+}
+
+src_configure() {
+ # very dodgy code (bug #539992)
+ strip-flags
+ append-flags -fomit-frame-pointer -fwrapv
+
+ econf \
+ $(use_enable alsa) \
+ $(use_enable altivec) \
+ $(use_enable cjk cjk-fonts) \
+ $(use_enable debugger) \
+ $(use_enable jack) \
+ $(use_enable nls)
+}
+
+src_install() {
+ default
+ dodoc Documentation/cheats.txt
+
+ if use pax_kernel; then
+ pax-mark m "${ED%/}"/usr/bin/mednafen || die
+ fi
+}
diff --git a/games-emulation/mednafen/metadata.xml b/games-emulation/mednafen/metadata.xml
new file mode 100644
index 000000000000..0afad2b3f24e
--- /dev/null
+++ b/games-emulation/mednafen/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="debugger">Build with internal debugger</flag>
+ <flag name="pax_kernel">Triggers a paxmarking of the binary</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">mednafen</remote-id>
+ </upstream>
+</pkgmetadata>