summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /games-emulation
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
proj/gentoo: Initial commit
This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'games-emulation')
-rw-r--r--games-emulation/advancemame/Manifest1
-rw-r--r--games-emulation/advancemame/advancemame-1.2.ebuild92
-rw-r--r--games-emulation/advancemame/files/advancemame-1.2-pic.patch13
-rw-r--r--games-emulation/advancemame/files/advancemame-1.2-verboselog.patch42
-rw-r--r--games-emulation/advancemame/metadata.xml21
-rw-r--r--games-emulation/advancemenu/Manifest1
-rw-r--r--games-emulation/advancemenu/advancemenu-2.7.ebuild86
-rw-r--r--games-emulation/advancemenu/files/advancemenu-2.7-alsa-pkg-config.patch20
-rw-r--r--games-emulation/advancemenu/files/advancemenu-2.7-pic.patch13
-rw-r--r--games-emulation/advancemenu/metadata.xml8
-rw-r--r--games-emulation/advancescan/Manifest1
-rw-r--r--games-emulation/advancescan/advancescan-1.16.ebuild33
-rw-r--r--games-emulation/advancescan/files/advancescan-1.16-sys-expat.patch77
-rw-r--r--games-emulation/advancescan/metadata.xml8
-rw-r--r--games-emulation/atari800/Manifest2
-rw-r--r--games-emulation/atari800/atari800-3.1.0.ebuild95
-rw-r--r--games-emulation/atari800/files/atari800-3.1.0-tgetent-detection.patch12
-rw-r--r--games-emulation/atari800/files/atari800.cfg24
-rw-r--r--games-emulation/atari800/metadata.xml26
-rw-r--r--games-emulation/caps/Manifest4
-rw-r--r--games-emulation/caps/caps-20071115.ebuild68
-rw-r--r--games-emulation/caps/metadata.xml12
-rw-r--r--games-emulation/daphne/Manifest1
-rw-r--r--games-emulation/daphne/daphne-1.0.ebuild90
-rw-r--r--games-emulation/daphne/files/daphne-1.0-gcc43.patch12
-rw-r--r--games-emulation/daphne/files/daphne-1.0-ldflags.patch22
-rw-r--r--games-emulation/daphne/files/daphne-1.0-system-lmpeg2.patch41
-rw-r--r--games-emulation/daphne/files/daphne-1.0-typefix.patch47
-rw-r--r--games-emulation/daphne/files/daphne-1.0-underlink.patch8
-rw-r--r--games-emulation/daphne/files/daphne-1.0-vorbisfilefix.patch14
-rw-r--r--games-emulation/daphne/files/daphne-1.0-zlib.patch13
-rw-r--r--games-emulation/daphne/metadata.xml5
-rw-r--r--games-emulation/dboxfe/Manifest1
-rw-r--r--games-emulation/dboxfe/dboxfe-0.1.3.ebuild36
-rw-r--r--games-emulation/dboxfe/files/dboxfe-0.1.3-ldflags.patch20
-rw-r--r--games-emulation/dboxfe/metadata.xml8
-rw-r--r--games-emulation/desmume/Manifest3
-rw-r--r--games-emulation/desmume/desmume-0.9.10.ebuild40
-rw-r--r--games-emulation/desmume/desmume-0.9.8.ebuild36
-rw-r--r--games-emulation/desmume/desmume-0.9.9.ebuild36
-rw-r--r--games-emulation/desmume/files/desmume-fix-function-type.patch22
-rw-r--r--games-emulation/desmume/metadata.xml11
-rw-r--r--games-emulation/dgen-sdl/Manifest1
-rw-r--r--games-emulation/dgen-sdl/dgen-sdl-1.33.ebuild43
-rw-r--r--games-emulation/dgen-sdl/files/dgen-sdl-1.33-joystick.patch18
-rw-r--r--games-emulation/dgen-sdl/metadata.xml8
-rw-r--r--games-emulation/dolphin/Manifest2
-rw-r--r--games-emulation/dolphin/dolphin-4.0-r2.ebuild154
-rw-r--r--games-emulation/dolphin/dolphin-4.0.2-r7.ebuild155
-rw-r--r--games-emulation/dolphin/dolphin-9999.ebuild156
-rw-r--r--games-emulation/dolphin/files/dolphin-emu-3.5-gcc-4.8.patch211
-rw-r--r--games-emulation/dolphin/metadata.xml15
-rw-r--r--games-emulation/dosbox/Manifest1
-rw-r--r--games-emulation/dosbox/dosbox-0.74.ebuild42
-rw-r--r--games-emulation/dosbox/dosbox-9999.ebuild51
-rw-r--r--games-emulation/dosbox/files/dosbox-0.74-gcc46.patch10
-rw-r--r--games-emulation/dosbox/metadata.xml8
-rw-r--r--games-emulation/emutos/Manifest5
-rw-r--r--games-emulation/emutos/emutos-0.9.3.ebuild28
-rw-r--r--games-emulation/emutos/emutos-0.9.4.ebuild28
-rw-r--r--games-emulation/emutos/metadata.xml11
-rw-r--r--games-emulation/fakenes/Manifest1
-rw-r--r--games-emulation/fakenes/fakenes-0.5.8-r2.ebuild79
-rw-r--r--games-emulation/fakenes/files/fakenes-0.5.8-underlink.patch8
-rw-r--r--games-emulation/fakenes/files/fakenes-0.5.8-zlib.patch170
-rw-r--r--games-emulation/fakenes/metadata.xml8
-rw-r--r--games-emulation/fbzx/Manifest1
-rw-r--r--games-emulation/fbzx/fbzx-2.10.0.ebuild38
-rw-r--r--games-emulation/fbzx/files/fbzx-2.10.0-build.patch12
-rw-r--r--games-emulation/fbzx/files/fbzx-2.10.0-keyboard.patch11
-rw-r--r--games-emulation/fbzx/metadata.xml9
-rw-r--r--games-emulation/fceux/Manifest1
-rw-r--r--games-emulation/fceux/fceux-2.2.2.ebuild49
-rw-r--r--games-emulation/fceux/files/fceux-2.2.2-warnings.patch33
-rw-r--r--games-emulation/fceux/metadata.xml8
-rw-r--r--games-emulation/gambatte/Manifest1
-rw-r--r--games-emulation/gambatte/gambatte-0.5.0_p20131102.ebuild98
-rw-r--r--games-emulation/gambatte/metadata.xml5
-rw-r--r--games-emulation/gcube/Manifest1
-rw-r--r--games-emulation/gcube/files/gcube-0.4-gcc47.patch10
-rw-r--r--games-emulation/gcube/files/gcube-0.4-ldflags.patch30
-rw-r--r--games-emulation/gcube/files/gcube-0.4-underlink.patch10
-rw-r--r--games-emulation/gcube/gcube-0.4-r1.ebuild44
-rw-r--r--games-emulation/gcube/metadata.xml5
-rw-r--r--games-emulation/generator/Manifest1
-rw-r--r--games-emulation/generator/files/generator-0.35_p4-configure.patch94
-rw-r--r--games-emulation/generator/files/generator-0.35_p4-execstacks.patch12
-rw-r--r--games-emulation/generator/files/generator-0.35_p4-underlink.patch11
-rw-r--r--games-emulation/generator/generator-0.35_p4.ebuild52
-rw-r--r--games-emulation/generator/metadata.xml8
-rw-r--r--games-emulation/gens/Manifest1
-rw-r--r--games-emulation/gens/files/gens-2.15.5-as-needed.patch11
-rw-r--r--games-emulation/gens/files/gens-2.15.5-gcc34.patch46
-rw-r--r--games-emulation/gens/files/gens-2.15.5-ovflfix.patch13
-rw-r--r--games-emulation/gens/files/gens-2.15.5-romsdir.patch13
-rw-r--r--games-emulation/gens/gens-2.15.5.ebuild45
-rw-r--r--games-emulation/gens/metadata.xml8
-rw-r--r--games-emulation/gfceux/Manifest1
-rw-r--r--games-emulation/gfceux/files/gfceux-2.1.1-gentoo.patch18
-rw-r--r--games-emulation/gfceux/gfceux-2.1.1-r1.ebuild71
-rw-r--r--games-emulation/gfceux/metadata.xml8
-rw-r--r--games-emulation/gngb/Manifest1
-rw-r--r--games-emulation/gngb/files/gngb-20060309-ovflfix.patch17
-rw-r--r--games-emulation/gngb/gngb-20060309.ebuild36
-rw-r--r--games-emulation/gngb/metadata.xml5
-rw-r--r--games-emulation/gngeo/Manifest1
-rw-r--r--games-emulation/gngeo/files/gngeo-0.8-concurrentMake.patch16
-rw-r--r--games-emulation/gngeo/files/gngeo-0.8-execstacks.patch105
-rw-r--r--games-emulation/gngeo/files/gngeo-0.8-zlib.patch9
-rw-r--r--games-emulation/gngeo/gngeo-0.8.ebuild46
-rw-r--r--games-emulation/gngeo/metadata.xml5
-rw-r--r--games-emulation/gnomeboyadvance/Manifest1
-rw-r--r--games-emulation/gnomeboyadvance/gnomeboyadvance-0.1.ebuild44
-rw-r--r--games-emulation/gnomeboyadvance/metadata.xml5
-rw-r--r--games-emulation/gnuboy/Manifest1
-rw-r--r--games-emulation/gnuboy/files/gnuboy-1.0.3-exec-stack.patch27
-rw-r--r--games-emulation/gnuboy/files/gnuboy-1.0.3-include.patch14
-rw-r--r--games-emulation/gnuboy/files/gnuboy-1.0.3-linux-headers.patch93
-rw-r--r--games-emulation/gnuboy/gnuboy-1.0.3-r1.ebuild58
-rw-r--r--games-emulation/gnuboy/metadata.xml5
-rw-r--r--games-emulation/gxmame/Manifest1
-rw-r--r--games-emulation/gxmame/files/gxmame-0.35_beta2-glib-single-include.patch13
-rw-r--r--games-emulation/gxmame/files/gxmame-0.35_beta2-ovflfix.patch29
-rw-r--r--games-emulation/gxmame/gxmame-0.35_beta2.ebuild67
-rw-r--r--games-emulation/gxmame/metadata.xml8
-rw-r--r--games-emulation/handy/Manifest1
-rw-r--r--games-emulation/handy/handy-0.82.ebuild38
-rw-r--r--games-emulation/handy/metadata.xml5
-rw-r--r--games-emulation/hatari/Manifest1
-rw-r--r--games-emulation/hatari/files/hatari-1.8.0-gentoo-docdir.patch13
-rw-r--r--games-emulation/hatari/files/hatari-1.8.0-gentoo.patch112
-rw-r--r--games-emulation/hatari/hatari-1.8.0.ebuild85
-rw-r--r--games-emulation/hatari/metadata.xml5
-rw-r--r--games-emulation/higan/Manifest1
-rw-r--r--games-emulation/higan/files/higan-094-QA.patch90
-rw-r--r--games-emulation/higan/files/higan-wrapper7
-rw-r--r--games-emulation/higan/higan-094.ebuild155
-rw-r--r--games-emulation/higan/metadata.xml15
-rw-r--r--games-emulation/hugo/Manifest1
-rw-r--r--games-emulation/hugo/files/hugo-2.12-gcc41.patch11
-rw-r--r--games-emulation/hugo/hugo-2.12.ebuild36
-rw-r--r--games-emulation/hugo/metadata.xml5
-rw-r--r--games-emulation/kigb/Manifest1
-rw-r--r--games-emulation/kigb/files/kigb16
-rw-r--r--games-emulation/kigb/kigb-2.02.ebuild41
-rw-r--r--games-emulation/kigb/metadata.xml5
-rw-r--r--games-emulation/lxdream/Manifest1
-rw-r--r--games-emulation/lxdream/files/lxdream-0.9.1-glib-single-include.patch395
-rw-r--r--games-emulation/lxdream/lxdream-0.9.1-r2.ebuild63
-rw-r--r--games-emulation/lxdream/metadata.xml10
-rw-r--r--games-emulation/m64py/Manifest1
-rw-r--r--games-emulation/m64py/m64py-0.2.1-r1.ebuild72
-rw-r--r--games-emulation/m64py/m64py-0.2.1.ebuild74
-rw-r--r--games-emulation/m64py/metadata.xml15
-rw-r--r--games-emulation/mamory/Manifest1
-rw-r--r--games-emulation/mamory/mamory-0.2.25.ebuild48
-rw-r--r--games-emulation/mamory/metadata.xml8
-rw-r--r--games-emulation/mastergear-bin/Manifest1
-rw-r--r--games-emulation/mastergear-bin/mastergear-bin-2.0.ebuild29
-rw-r--r--games-emulation/mastergear-bin/metadata.xml5
-rw-r--r--games-emulation/mednafen/Manifest1
-rw-r--r--games-emulation/mednafen/files/mednafen-0.9.38.4-automake-1.13.patch11
-rw-r--r--games-emulation/mednafen/files/mednafen-0.9.38.4-cflags.patch28
-rw-r--r--games-emulation/mednafen/files/mednafen-0.9.38.4-zlib.patch27
-rw-r--r--games-emulation/mednafen/mednafen-0.9.38.4.ebuild72
-rw-r--r--games-emulation/mednafen/metadata.xml12
-rw-r--r--games-emulation/mekanix/Manifest1
-rw-r--r--games-emulation/mekanix/mekanix-070.ebuild30
-rw-r--r--games-emulation/mekanix/metadata.xml5
-rw-r--r--games-emulation/metadata.xml35
-rw-r--r--games-emulation/mupen64plus-audio-sdl/Manifest1
-rw-r--r--games-emulation/mupen64plus-audio-sdl/metadata.xml15
-rw-r--r--games-emulation/mupen64plus-audio-sdl/mupen64plus-audio-sdl-2.0-r1.ebuild83
-rw-r--r--games-emulation/mupen64plus-audio-sdl/mupen64plus-audio-sdl-2.0.ebuild86
-rw-r--r--games-emulation/mupen64plus-core/Manifest1
-rw-r--r--games-emulation/mupen64plus-core/metadata.xml22
-rw-r--r--games-emulation/mupen64plus-core/mupen64plus-core-2.0-r1.ebuild112
-rw-r--r--games-emulation/mupen64plus-core/mupen64plus-core-2.0.ebuild104
-rw-r--r--games-emulation/mupen64plus-input-sdl/Manifest1
-rw-r--r--games-emulation/mupen64plus-input-sdl/metadata.xml15
-rw-r--r--games-emulation/mupen64plus-input-sdl/mupen64plus-input-sdl-2.0-r1.ebuild77
-rw-r--r--games-emulation/mupen64plus-input-sdl/mupen64plus-input-sdl-2.0.ebuild80
-rw-r--r--games-emulation/mupen64plus-rsp-hle/Manifest1
-rw-r--r--games-emulation/mupen64plus-rsp-hle/metadata.xml15
-rw-r--r--games-emulation/mupen64plus-rsp-hle/mupen64plus-rsp-hle-2.0-r1.ebuild69
-rw-r--r--games-emulation/mupen64plus-rsp-hle/mupen64plus-rsp-hle-2.0.ebuild71
-rw-r--r--games-emulation/mupen64plus-ui-console/Manifest1
-rw-r--r--games-emulation/mupen64plus-ui-console/metadata.xml15
-rw-r--r--games-emulation/mupen64plus-ui-console/mupen64plus-ui-console-2.0-r1.ebuild78
-rw-r--r--games-emulation/mupen64plus-ui-console/mupen64plus-ui-console-2.0.ebuild83
-rw-r--r--games-emulation/mupen64plus-video-glide64mk2/Manifest1
-rw-r--r--games-emulation/mupen64plus-video-glide64mk2/metadata.xml18
-rw-r--r--games-emulation/mupen64plus-video-glide64mk2/mupen64plus-video-glide64mk2-2.0-r1.ebuild84
-rw-r--r--games-emulation/mupen64plus-video-glide64mk2/mupen64plus-video-glide64mk2-2.0.ebuild87
-rw-r--r--games-emulation/mupen64plus-video-rice/Manifest1
-rw-r--r--games-emulation/mupen64plus-video-rice/metadata.xml15
-rw-r--r--games-emulation/mupen64plus-video-rice/mupen64plus-video-rice-2.0-r1.ebuild81
-rw-r--r--games-emulation/mupen64plus-video-rice/mupen64plus-video-rice-2.0.ebuild84
-rw-r--r--games-emulation/mupen64plus/Manifest3
-rw-r--r--games-emulation/mupen64plus/files/README.gentoo-patches-2009112355
-rw-r--r--games-emulation/mupen64plus/files/README.gentoo-patches-2010050759
-rw-r--r--games-emulation/mupen64plus/files/ftbfs-gvariant-type-conflicts.patch27
-rw-r--r--games-emulation/mupen64plus/files/mupen64plus-1.5-gcc46.patch11
-rw-r--r--games-emulation/mupen64plus/files/mupen64plus-1.5-libpng14.patch34
-rw-r--r--games-emulation/mupen64plus/files/mupen64plus-1.5-minizip.patch35
-rw-r--r--games-emulation/mupen64plus/metadata.xml28
-rw-r--r--games-emulation/mupen64plus/mupen64plus-1.5-r1.ebuild130
-rw-r--r--games-emulation/mupen64plus/mupen64plus-1.5-r2.ebuild138
-rw-r--r--games-emulation/mupen64plus/mupen64plus-2.0.ebuild23
-rw-r--r--games-emulation/nestopia/Manifest3
-rw-r--r--games-emulation/nestopia/files/nestopia10
-rw-r--r--games-emulation/nestopia/files/nestopia-1.40-makefile.patch69
-rw-r--r--games-emulation/nestopia/metadata.xml8
-rw-r--r--games-emulation/nestopia/nestopia-1.40.ebuild54
-rw-r--r--games-emulation/nestopia/nestopia-1.46.2.ebuild76
-rw-r--r--games-emulation/nestra/Manifest2
-rw-r--r--games-emulation/nestra/files/nestra-0.66-exec-stack.patch10
-rw-r--r--games-emulation/nestra/files/nestra-0.66-include.patch73
-rw-r--r--games-emulation/nestra/metadata.xml5
-rw-r--r--games-emulation/nestra/nestra-0.66-r2.ebuild49
-rw-r--r--games-emulation/openmsx/Manifest1
-rw-r--r--games-emulation/openmsx/files/openmsx-0.9.1-verbose.patch14
-rw-r--r--games-emulation/openmsx/metadata.xml8
-rw-r--r--games-emulation/openmsx/openmsx-0.9.1.ebuild65
-rw-r--r--games-emulation/pcsxr/Manifest1
-rw-r--r--games-emulation/pcsxr/files/pcsxr-1.9.94-disable-sdl2.patch28
-rw-r--r--games-emulation/pcsxr/files/pcsxr-1.9.94-install-paths.patch223
-rw-r--r--games-emulation/pcsxr/metadata.xml12
-rw-r--r--games-emulation/pcsxr/pcsxr-1.9.94-r1.ebuild111
-rw-r--r--games-emulation/pcsxr/pcsxr-1.9.94.ebuild101
-rw-r--r--games-emulation/raine/Manifest1
-rw-r--r--games-emulation/raine/files/raine-0.51.9-ldflags.patch11
-rw-r--r--games-emulation/raine/files/raine-0.51.9-libpng15.patch13
-rw-r--r--games-emulation/raine/files/raine-0.51.9-underlink.patch11
-rw-r--r--games-emulation/raine/metadata.xml5
-rw-r--r--games-emulation/raine/raine-0.51.9.ebuild58
-rw-r--r--games-emulation/sdlmame/Manifest4
-rw-r--r--games-emulation/sdlmame/files/mame-0.139.ini.in270
-rw-r--r--games-emulation/sdlmame/files/sdlmame-0.144-makefile.patch79
-rw-r--r--games-emulation/sdlmame/files/sdlmame-0.144-no-opengl.patch11
-rw-r--r--games-emulation/sdlmame/files/sdlmame-0.148_p1-makefile.patch177
-rw-r--r--games-emulation/sdlmame/files/sdlmame-0.148_p1-no-opengl.patch12
-rw-r--r--games-emulation/sdlmame/files/sdlmame-0.149-QA.patch191
-rw-r--r--games-emulation/sdlmame/files/sdlmame-0.149-debugger-linking.patch28
-rw-r--r--games-emulation/sdlmame/files/sdlmame-0.149-no-opengl.patch19
-rw-r--r--games-emulation/sdlmame/files/sdlmame-0.149-system-lua.patch33
-rw-r--r--games-emulation/sdlmame/files/vector.ini9
-rw-r--r--games-emulation/sdlmame/metadata.xml19
-rw-r--r--games-emulation/sdlmame/sdlmame-0.148_p1-r1.ebuild186
-rw-r--r--games-emulation/sdlmame/sdlmame-0.149.ebuild194
-rw-r--r--games-emulation/sdlmametools/Manifest3
-rw-r--r--games-emulation/sdlmametools/files/sdlmametools-0.148_p1-makefile.patch177
-rw-r--r--games-emulation/sdlmametools/files/sdlmametools-0.148_p1-no-opengl.patch12
-rw-r--r--games-emulation/sdlmametools/files/sdlmametools-0.149-QA.patch191
-rw-r--r--games-emulation/sdlmametools/files/sdlmametools-0.149-debugger-linking.patch28
-rw-r--r--games-emulation/sdlmametools/files/sdlmametools-0.149-no-opengl.patch19
-rw-r--r--games-emulation/sdlmametools/files/sdlmametools-0.149-system-lua.patch33
-rw-r--r--games-emulation/sdlmametools/metadata.xml5
-rw-r--r--games-emulation/sdlmametools/sdlmametools-0.148_p1.ebuild123
-rw-r--r--games-emulation/sdlmametools/sdlmametools-0.149.ebuild118
-rw-r--r--games-emulation/sdlmess/Manifest3
-rw-r--r--games-emulation/sdlmess/files/mess-0.148.ini.in283
-rw-r--r--games-emulation/sdlmess/files/sdlmess-0.148_p1-makefile.patch177
-rw-r--r--games-emulation/sdlmess/files/sdlmess-0.148_p1-no-opengl.patch12
-rw-r--r--games-emulation/sdlmess/files/sdlmess-0.149-QA.patch191
-rw-r--r--games-emulation/sdlmess/files/sdlmess-0.149-debugger-linking.patch28
-rw-r--r--games-emulation/sdlmess/files/sdlmess-0.149-no-opengl.patch19
-rw-r--r--games-emulation/sdlmess/files/sdlmess-0.149-system-lua.patch33
-rw-r--r--games-emulation/sdlmess/files/vector.ini9
-rw-r--r--games-emulation/sdlmess/metadata.xml5
-rw-r--r--games-emulation/sdlmess/sdlmess-0.148_p1.ebuild181
-rw-r--r--games-emulation/sdlmess/sdlmess-0.149.ebuild190
-rw-r--r--games-emulation/snes9x/Manifest1
-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/metadata.xml12
-rw-r--r--games-emulation/snes9x/snes9x-1.53.ebuild120
-rw-r--r--games-emulation/stella/Manifest1
-rw-r--r--games-emulation/stella/metadata.xml8
-rw-r--r--games-emulation/stella/stella-4.0.ebuild69
-rw-r--r--games-emulation/vbam/Manifest1
-rw-r--r--games-emulation/vbam/files/vbam-1.8.0.1228-ffmpeg2.patch34
-rw-r--r--games-emulation/vbam/files/vbam-1.8.0.1228-header.patch10
-rw-r--r--games-emulation/vbam/metadata.xml8
-rw-r--r--games-emulation/vbam/vbam-1.8.0.1228.ebuild114
-rw-r--r--games-emulation/vbam/vbam-9999.ebuild116
-rw-r--r--games-emulation/vgba/Manifest1
-rw-r--r--games-emulation/vgba/metadata.xml5
-rw-r--r--games-emulation/vgba/vgba-4.8.ebuild30
-rw-r--r--games-emulation/virtualjaguar/Manifest1
-rw-r--r--games-emulation/virtualjaguar/files/virtualjaguar36
-rw-r--r--games-emulation/virtualjaguar/metadata.xml9
-rw-r--r--games-emulation/virtualjaguar/virtualjaguar-2.1.2-r1.ebuild78
-rw-r--r--games-emulation/visualboyadvance/Manifest2
-rw-r--r--games-emulation/visualboyadvance/files/1.7.2-gcc34.patch41
-rw-r--r--games-emulation/visualboyadvance/files/1.7.2-gcc41.patch27
-rw-r--r--games-emulation/visualboyadvance/files/1.7.2-homedir.patch11
-rw-r--r--games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-gcc47.patch32
-rw-r--r--games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-glibc2.10.patch76
-rw-r--r--games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-libpng15.patch11
-rw-r--r--games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-ovflfix.patch11
-rw-r--r--games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-sys-types.patch12
-rw-r--r--games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-uninit.patch13
-rw-r--r--games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-zlib-1.2.6.patch12
-rw-r--r--games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-zlib.patch145
-rw-r--r--games-emulation/visualboyadvance/metadata.xml8
-rw-r--r--games-emulation/visualboyadvance/visualboyadvance-1.7.2-r3.ebuild82
-rw-r--r--games-emulation/xe/Manifest2
-rw-r--r--games-emulation/xe/files/xe-2.16.210
-rw-r--r--games-emulation/xe/files/xe-2.16.2-gentoo.patch16
-rw-r--r--games-emulation/xe/metadata.xml5
-rw-r--r--games-emulation/xe/xe-2.16.2.ebuild54
-rw-r--r--games-emulation/yabause/Manifest1
-rw-r--r--games-emulation/yabause/files/yabause-0.9.14-RWX.patch24
-rw-r--r--games-emulation/yabause/files/yabause-0.9.14-cmake.patch51
-rw-r--r--games-emulation/yabause/metadata.xml11
-rw-r--r--games-emulation/yabause/yabause-0.9.14.ebuild70
-rw-r--r--games-emulation/zinc/Manifest1
-rw-r--r--games-emulation/zinc/metadata.xml5
-rw-r--r--games-emulation/zinc/zinc-1.1.ebuild31
-rw-r--r--games-emulation/zsnes/Manifest1
-rw-r--r--games-emulation/zsnes/files/zsnes-1.51-CC-quotes.patch20
-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.xml12
-rw-r--r--games-emulation/zsnes/zsnes-1.51-r4.ebuild113
334 files changed, 13716 insertions, 0 deletions
diff --git a/games-emulation/advancemame/Manifest b/games-emulation/advancemame/Manifest
new file mode 100644
index 000000000000..97d3b591a2e8
--- /dev/null
+++ b/games-emulation/advancemame/Manifest
@@ -0,0 +1 @@
+DIST advancemame-1.2.tar.gz 17508670 SHA256 eaf46e54f0cb5fa1d99f55604a4a3f8a065c1cf5e70ac4abc67391b0450ce439 SHA512 6d9cf7ce0553ea6bc60c91bff7d55f282ebd671c5a48ebb25a8b0a41c575b3a8f0446f8f39ca0bccf93493ef28b331d4661987eb1f8adc5bd2c911674d1be583 WHIRLPOOL 9871fc39063f0f944830fe7c3d25a8370379dc80a37ff00f11039af73511cbb9c59ee2215346e1f4475d9cd4fdaeedce0b8c81c46135ab79925e3ec62114847e
diff --git a/games-emulation/advancemame/advancemame-1.2.ebuild b/games-emulation/advancemame/advancemame-1.2.ebuild
new file mode 100644
index 000000000000..e9e95d63315b
--- /dev/null
+++ b/games-emulation/advancemame/advancemame-1.2.ebuild
@@ -0,0 +1,92 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic games
+
+DESCRIPTION="GNU/Linux port of the MAME emulator with GUI menu"
+HOMEPAGE="http://advancemame.sourceforge.net/"
+SRC_URI="mirror://sourceforge/advancemame/${P}.tar.gz"
+
+LICENSE="GPL-2 XMAME"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="alsa fbcon oss truetype"
+
+# sdl is required (bug #158417)
+RDEPEND="app-arch/unzip
+ app-arch/zip
+ dev-libs/expat
+ media-libs/libsdl
+ sys-libs/zlib
+ alsa? ( media-libs/alsa-lib )
+ truetype? ( media-libs/freetype )"
+DEPEND="${RDEPEND}
+ virtual/os-headers
+ x86? ( >=dev-lang/nasm-0.98 )"
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}-pic.patch" \
+ "${FILESDIR}"/${P}-verboselog.patch
+
+ sed -i \
+ -e 's/"-s"//' \
+ configure || die "sed failed"
+
+ use x86 &&
+ ln -s $(type -P nasm) "${T}/${CHOST}-nasm"
+ ln -s $(type -P sdl-config) "${T}/${CHOST}-sdl-config"
+ use truetype &&
+ ln -s $(type -P freetype-config) "${T}/${CHOST}-freetype-config"
+}
+
+src_configure() {
+ # Fix for bug #78030
+ if use ppc; then
+ append-ldflags "-Wl,--relax"
+ fi
+
+ PATH="${PATH}:${T}"
+ egamesconf \
+ --enable-expat \
+ --enable-sdl \
+ --enable-zlib \
+ --disable-slang \
+ --disable-svgalib \
+ --disable-static \
+ $(use_enable alsa) \
+ $(use_enable fbcon fb) \
+ $(use_enable oss) \
+ $(use_enable truetype freetype) \
+ $(use_enable x86 asm) \
+ --with-emu=${PN/advance}
+}
+
+src_compile() {
+ STRIPPROG=true emake
+}
+
+src_install() {
+ local f
+
+ for f in adv* ; do
+ if [[ -L "${f}" ]] ; then
+ dogamesbin "${f}"
+ fi
+ done
+
+ insinto "${GAMES_DATADIR}/advance"
+ doins support/event.dat
+ keepdir "${GAMES_DATADIR}/advance/"{artwork,diff,image,rom,sample,snap}
+
+ dodoc HISTORY README RELEASE
+ cd doc
+ dodoc *.txt
+ dohtml *.html
+ for f in *.1 ; do
+ newman ${f} ${f/1/6}
+ done
+
+ prepgamesdirs
+}
diff --git a/games-emulation/advancemame/files/advancemame-1.2-pic.patch b/games-emulation/advancemame/files/advancemame-1.2-pic.patch
new file mode 100644
index 000000000000..049befbfac2c
--- /dev/null
+++ b/games-emulation/advancemame/files/advancemame-1.2-pic.patch
@@ -0,0 +1,13 @@
+--- ./advance/blit/blit.c.orig 2004-12-19 01:01:46.039956536 -0500
++++ ./advance/blit/blit.c 2004-12-19 01:01:19.566981040 -0500
+@@ -28,6 +28,10 @@
+ * do so, delete this exception statement from your version.
+ */
+
++#if defined(USE_ASM_INLINE) && defined(__PIC__)
++# undef USE_ASM_INLINE
++#endif
++
+ #include "portable.h"
+
+ #include "blit.h"
diff --git a/games-emulation/advancemame/files/advancemame-1.2-verboselog.patch b/games-emulation/advancemame/files/advancemame-1.2-verboselog.patch
new file mode 100644
index 000000000000..b72c1224e75f
--- /dev/null
+++ b/games-emulation/advancemame/files/advancemame-1.2-verboselog.patch
@@ -0,0 +1,42 @@
+From: Julian Ospald <hasufell@gentoo.org>
+Date: Sun Feb 17 03:39:55 UTC 2013
+Subject: build system
+
+ make build log verbose
+
+--- advancemame-1.2/Makefile.in
++++ advancemame-1.2/Makefile.in
+@@ -77,21 +77,21 @@
+ srcdir=@srcdir@
+ # Don't add the prefix @. This command must be used also in a shell script
+ INSTALL=@INSTALL@
+-CC=@@CC@
+-CXX=@@CXX@
+-LD=@@CC@
+-LDXX=@@CXX@
+-AR=@@AR@
+-ASM=@@ASM@
+-RC=@@RC@
++CC=@CC@
++CXX=@CXX@
++LD=@CC@
++LDXX=@CXX@
++AR=@AR@
++ASM=@ASM@
++RC=@RC@
+ LN_S=@@LN_S@
+ MD=-@@MKDIR@ -p
+ RM=@@RM@ -f
+ ECHO=@@ECHO@
+-CC_FOR_BUILD=@@CC_FOR_BUILD@
+-LD_FOR_BUILD=@@CC_FOR_BUILD@
+-CXX_FOR_BUILD=@@CXX_FOR_BUILD@
+-LDXX_FOR_BUILD=@@CXX_FOR_BUILD@
++CC_FOR_BUILD=@CC_FOR_BUILD@
++LD_FOR_BUILD=@CC_FOR_BUILD@
++CXX_FOR_BUILD=@CXX_FOR_BUILD@
++LDXX_FOR_BUILD=@CXX_FOR_BUILD@
+ EXE=@EXE@
+ EXE_FOR_BUILD=@EXE_FOR_BUILD@
+ SDLCFLAGS=@SDLCFLAGS@
+
diff --git a/games-emulation/advancemame/metadata.xml b/games-emulation/advancemame/metadata.xml
new file mode 100644
index 000000000000..794e37cdbea3
--- /dev/null
+++ b/games-emulation/advancemame/metadata.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <longdescription>
+AdvanceMAME and AdvanceMESS are unofficial MAME and MESS versions with an advanced video support for
+helping the use with TVs, Arcade Monitors, Fixed Frequencies Monitors and also for PC Monitors.
+
+They run in GNU/Linux, Mac OS X, DOS, Windows and in all the other platforms supported by the SDL library.
+
+The main difference compared with the official emulators is that the Advance versions program directly the
+video board to always get a video mode with the correct size and frequency.
+
+Generally the Advance emulators are able to use a video mode which doesn't require any stretching or other
+unneeded effects to match the original arcade display. When the stretching is required by hardware
+limitations you can anyway choice from different types of stretch.
+</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">advancemame</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/advancemenu/Manifest b/games-emulation/advancemenu/Manifest
new file mode 100644
index 000000000000..009eeee97622
--- /dev/null
+++ b/games-emulation/advancemenu/Manifest
@@ -0,0 +1 @@
+DIST advancemenu-2.7.tar.gz 2371297 SHA256 e635f8d236b08e40587344daa33ef78d50d14e01fb6a7ef74eb6fdb3e80cb224 SHA512 72aa75b189e4507ce0fe1c5203476833fd04ec9238102631061ed82c2894890044ae40c82154a76533b6ba0a255c42cdfe2ab5c0f497d595783fa13ea32c71bb WHIRLPOOL f27c1a766601a65ed415794fbe650e2530f3447b80ffb98fb86ed0f9ede4946c0e9cb3b3c72d986f4adbc4e19bb38f6bcb4e34c77b512ba791b61f58594baff4
diff --git a/games-emulation/advancemenu/advancemenu-2.7.ebuild b/games-emulation/advancemenu/advancemenu-2.7.ebuild
new file mode 100644
index 000000000000..fb3aba816ebe
--- /dev/null
+++ b/games-emulation/advancemenu/advancemenu-2.7.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit autotools eutils games
+
+DESCRIPTION="Frontend for AdvanceMAME, MAME, MESS, RAINE and any other emulator"
+HOMEPAGE="http://advancemame.sourceforge.net/menu-readme.html"
+SRC_URI="mirror://sourceforge/advancemame/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE="alsa debug fbcon ncurses oss sdl slang truetype"
+
+RDEPEND="dev-libs/expat
+ alsa? ( media-libs/alsa-lib )
+ ncurses? ( sys-libs/ncurses )
+ sdl? ( media-libs/libsdl )
+ slang? ( >=sys-libs/slang-1.4 )
+ !sdl? ( ( !fbcon? ( media-libs/libsdl ) ) )
+ truetype? ( >=media-libs/freetype-2 )"
+DEPEND="${RDEPEND}
+ x86? ( >=dev-lang/nasm-0.98 )
+ fbcon? ( virtual/os-headers )"
+
+src_prepare() {
+ # pic patch - bug #142021
+ epatch \
+ "${FILESDIR}"/${P}-alsa-pkg-config.patch \
+ "${FILESDIR}"/${P}-pic.patch
+ sed -i -e 's/"-s"//' configure.ac || die
+
+ use x86 && ln -s $(type -P nasm) "${T}/${CHOST}-nasm"
+ use sdl && ln -s $(type -P sdl-config) "${T}/${CHOST}-sdl-config"
+ use !sdl && use !fbcon && ln -s $(type -P sdl-config) "${T}/${CHOST}-sdl-config"
+ use truetype && ln -s $(type -P freetype-config) "${T}/${CHOST}-freetype-config"
+ eautoreconf
+}
+
+src_configure() {
+ export PATH="${PATH}:${T}"
+ egamesconf \
+ --enable-expat \
+ --enable-zlib \
+ --disable-svgalib \
+ --disable-static \
+ $(use_enable alsa) \
+ $(use_enable debug) \
+ $(use_enable fbcon fb) \
+ $(use_enable ncurses) \
+ $(use_enable truetype freetype) \
+ $(use_enable oss) \
+ $(use_enable sdl) \
+ $(use_enable slang) \
+ $(use !sdl && use !fbcon && echo --enable-sdl) \
+ $(use_enable x86 asm)
+}
+
+src_compile() {
+ STRIPPROG=true emake
+}
+
+src_install() {
+ dogamesbin advmenu
+ dodoc HISTORY README RELEASE doc/*.txt
+ doman doc/{advmenu,advdev}.1
+ dohtml doc/*.html
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ echo
+ elog "Execute:"
+ elog " advmenu -default"
+ elog "to generate a config file"
+ elog
+ elog "An example emulator config found in advmenu.rc:"
+ elog " emulator \"snes9x\" generic \"${GAMES_BINDIR}/snes9x\" \"%f\""
+ elog " emulator_roms \"snes9x\" \"/home/user/myroms\""
+ elog " emulator_roms_filter \"snes9x\" \"*.smc;*.sfc\""
+ elog
+ elog "For more information, see the advmenu man page."
+}
diff --git a/games-emulation/advancemenu/files/advancemenu-2.7-alsa-pkg-config.patch b/games-emulation/advancemenu/files/advancemenu-2.7-alsa-pkg-config.patch
new file mode 100644
index 000000000000..1b0f8a8df9cb
--- /dev/null
+++ b/games-emulation/advancemenu/files/advancemenu-2.7-alsa-pkg-config.patch
@@ -0,0 +1,20 @@
+--- advancemenu-2.6.orig/configure.ac
++++ advancemenu-2.6/configure.ac
+@@ -512,7 +512,7 @@
+ [snd_pcm_open],
+ [ac_lib_alsa=yes],
+ [ac_lib_alsa=no],
+- [-lm]
++ [`pkg-config alsa --libs`]
+ )
+ if test $ac_lib_alsa = yes; then
+ AC_MSG_CHECKING([for ALSA])
+@@ -531,7 +531,7 @@
+ [snd_pcm_open],
+ [],
+ [AC_MSG_ERROR([the ALSA library is missing])],
+- [-lm]
++ [`pkg-config alsa --libs`]
+ )
+ AC_MSG_CHECKING([for ALSA version])
+ AC_TRY_COMPILE([
diff --git a/games-emulation/advancemenu/files/advancemenu-2.7-pic.patch b/games-emulation/advancemenu/files/advancemenu-2.7-pic.patch
new file mode 100644
index 000000000000..62f073bed83b
--- /dev/null
+++ b/games-emulation/advancemenu/files/advancemenu-2.7-pic.patch
@@ -0,0 +1,13 @@
+--- ./advance/blit/blit.c.orig
++++ ./advance/blit/blit.c
+@@ -28,6 +28,10 @@
+ * do so, delete this exception statement from your version.
+ */
+
++#if defined(USE_ASM_INLINE) && defined(__PIC__)
++# undef USE_ASM_INLINE
++#endif
++
+ #include "portable.h"
+
+ #include "blit.h"
diff --git a/games-emulation/advancemenu/metadata.xml b/games-emulation/advancemenu/metadata.xml
new file mode 100644
index 000000000000..72ee3bbf50bc
--- /dev/null
+++ b/games-emulation/advancemenu/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">advancemame</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/advancescan/Manifest b/games-emulation/advancescan/Manifest
new file mode 100644
index 000000000000..31bdb9a30764
--- /dev/null
+++ b/games-emulation/advancescan/Manifest
@@ -0,0 +1 @@
+DIST advancescan-1.16.tar.gz 316895 SHA256 2fe238442f82bdb2b45704898183b7ae3297bf9d75a4d33dbbd8cacec0c70fc2 SHA512 6d359c160d54a0a1cd13db10f5fc9986fae4f1151e205024e40c21b0f933723351907156faec22a92561ad523151e3b7d4ff70a6eebbb6152bd3767063a31031 WHIRLPOOL 8772c7e0d8fc3fbeb333fd2bf79191e745c1f979d9ac2d798419448b844c15d5e926fc30cc6d4353a119142f9657816d749ab11eb4e7c1d85a0e0ccee4ea403f
diff --git a/games-emulation/advancescan/advancescan-1.16.ebuild b/games-emulation/advancescan/advancescan-1.16.ebuild
new file mode 100644
index 000000000000..b9c682aa8a81
--- /dev/null
+++ b/games-emulation/advancescan/advancescan-1.16.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit autotools eutils games
+
+DESCRIPTION="A command line rom manager for MAME, MESS, AdvanceMAME, AdvanceMESS and Raine"
+HOMEPAGE="http://advancemame.sourceforge.net/scan-readme.html"
+SRC_URI="mirror://sourceforge/advancemame/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DEPEND="dev-libs/expat
+ sys-libs/zlib"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ rm -rf expat
+ epatch "${FILESDIR}"/${P}-sys-expat.patch
+ eautoreconf
+}
+
+src_install() {
+ dogamesbin advscan advdiff
+ dodoc AUTHORS HISTORY README doc/*.txt advscan.rc.linux
+ doman doc/{advscan,advdiff}.1
+ dohtml doc/*.html
+ prepgamesdirs
+}
diff --git a/games-emulation/advancescan/files/advancescan-1.16-sys-expat.patch b/games-emulation/advancescan/files/advancescan-1.16-sys-expat.patch
new file mode 100644
index 000000000000..3f4ca98e4507
--- /dev/null
+++ b/games-emulation/advancescan/files/advancescan-1.16-sys-expat.patch
@@ -0,0 +1,77 @@
+--- configure.ac
++++ configure.ac
+@@ -30,6 +30,7 @@
+
+ # Checks for libraries.
+ AC_CHECK_LIB([z], [adler32], [], [AC_MSG_ERROR([the libz library is missing])])
++AC_CHECK_LIB([expat], [XML_Parse], [], [AC_MSG_ERROR([the expat library is missing])])
+
+ # Checks for header files.
+ AC_HEADER_STDC
+--- gamexml.cc
++++ gamexml.cc
+@@ -22,7 +22,7 @@
+
+ #include "game.h"
+ #include "strcov.h"
+-#include "expat/expat.h"
++#include <expat.h>
+
+ #include <string>
+ #include <iostream>
+--- Makefile.am
++++ Makefile.am
+@@ -18,10 +18,7 @@
+ siglock.cc \
+ getopt.c \
+ snprintf.c \
+- lib/readinfo.c \
+- expat/xmlrole.c \
+- expat/xmlparse.c \
+- expat/xmltok.c
++ lib/readinfo.c
+
+ advscan_SOURCES = \
+ scan.cc \
+@@ -43,10 +40,7 @@
+ siglock.cc \
+ getopt.c \
+ snprintf.c \
+- lib/readinfo.c \
+- expat/xmlrole.c \
+- expat/xmlparse.c \
+- expat/xmltok.c
++ lib/readinfo.c
+
+ EXTRA_DIST = advscan.rc.linux advscan.rc.dos \
+ README AUTHORS HISTORY INSTALL COPYING \
+@@ -82,28 +76,7 @@
+ portable.h \
+ lib/readinfo.h \
+ lib/endianrw.h \
+- lib/extra.h \
+- expat/COPYING \
+- expat/README \
+- expat/ascii.h \
+- expat/asciitab.h \
+- expat/expat-1.95.8.diff \
+- expat/expat.h \
+- expat/iasciitab.h \
+- expat/expatcfg.h \
+- expat/expat_external.h \
+- expat/internal.h \
+- expat/latin1tab.h \
+- expat/nametab.h \
+- expat/utf8tab.h \
+- expat/xmlparse.c \
+- expat/xmlrole.c \
+- expat/xmlrole.h \
+- expat/xmltok.c \
+- expat/xmltok.h \
+- expat/xmltok_impl.c \
+- expat/xmltok_impl.h \
+- expat/xmltok_ns.c
++ lib/extra.h
+
+ man_MANS = doc/advscan.1 doc/advdiff.1
+
diff --git a/games-emulation/advancescan/metadata.xml b/games-emulation/advancescan/metadata.xml
new file mode 100644
index 000000000000..72ee3bbf50bc
--- /dev/null
+++ b/games-emulation/advancescan/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">advancemame</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/atari800/Manifest b/games-emulation/atari800/Manifest
new file mode 100644
index 000000000000..764b87a88286
--- /dev/null
+++ b/games-emulation/atari800/Manifest
@@ -0,0 +1,2 @@
+DIST atari800-3.1.0.tar.gz 1492289 SHA256 901b02cce92ddb0b614f8034e6211f24cbfc2f8fb1c6581ba0097b1e68f91e0c SHA512 c8f035c9be000c67dd854a14a236d165e6e2d30b5138f8772c6ea5c5290b0410525570e3ed9dcb2f9bcb129f97a36e6eef5993f0a5ad3cc993c6b59b127bcabe WHIRLPOOL e635a16fc8b2af8257f6f8d0e67fd155e98aee0d2c2831ca6c847561b1131f13b75c24a6ed68f089f0e1b04eaaa9d1e2239d53608875337fffce37d16a3ae5f4
+DIST xf25.zip 188942 SHA256 98ae0ad10413dd6f35ed80f5662dba6d790def70c7829046e52012a03b574b8a SHA512 306612fc2af41ed10d76103af83e141cfd8bd3ba2ea3cbd1d0b81d4d5b0108c06948a5c626648c8a2424536757a42a3f8b9af1fb63fa3c31096447ffed0f9923 WHIRLPOOL 58a77afd803b740b2be5038223bac173dc1ccd8e062d0e8e71355c496e113d1d486b1d8fc2e06e0ee58bb8a34948fe6be41312107bd311bdd54ae173ac850f5f
diff --git a/games-emulation/atari800/atari800-3.1.0.ebuild b/games-emulation/atari800/atari800-3.1.0.ebuild
new file mode 100644
index 000000000000..6f8c45907c6a
--- /dev/null
+++ b/games-emulation/atari800/atari800-3.1.0.ebuild
@@ -0,0 +1,95 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit games autotools eutils
+
+DESCRIPTION="Atari 800 emulator"
+HOMEPAGE="http://atari800.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz
+ mirror://sourceforge/${PN}/xf25.zip"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE="ncurses oss opengl readline +sdl +sound"
+
+NOTSDL_DEPS="
+ sys-libs/ncurses
+ sound? (
+ !oss? ( media-libs/libsdl[sound] )
+ )"
+RDEPEND="sdl? ( >=media-libs/libsdl-1.2.0[opengl?,sound?,video] )
+ ncurses? ( ${NOTSDL_DEPS} )
+ !sdl? ( !ncurses? ( ${NOTSDL_DEPS} ) )
+ readline? ( sys-libs/readline:0
+ sys-libs/ncurses )
+ media-libs/libpng:0
+ sys-libs/zlib"
+DEPEND="${RDEPEND}
+ app-arch/unzip"
+
+src_prepare() {
+ # remove some not-so-interesting ones
+ rm -f DOC/{INSTALL.*,*.in,CHANGES.OLD} || die
+ sed -i \
+ -e '1s/ 1 / 6 /' \
+ src/atari800.man || die
+ sed -i \
+ -e "/SYSTEM_WIDE_CFG_FILE/s:/etc:${GAMES_SYSCONFDIR}:" \
+ src/cfg.c || die
+ sed -i \
+ -e "/share/s:/usr/share:${GAMES_DATADIR}:" \
+ src/atari.c || die
+ sed "s:/usr/share/games:${GAMES_DATADIR}:" \
+ "${FILESDIR}"/atari800.cfg > "${T}"/atari800.cfg || die
+
+ # Bug 544608
+ epatch "${FILESDIR}/${P}-tgetent-detection.patch"
+ pushd src > /dev/null && eautoreconf
+ popd > /dev/null
+}
+
+src_configure() {
+ local video="ncurses"
+ local sound=no
+
+ use sdl && video="sdl"
+ if use sound ; then
+ if use sdl ; then
+ sound=sdl
+ elif use oss ; then
+ sound=oss
+ else
+ echo
+ elog "Sound requested but neither sdl nor oss specified."
+ elog "Disabling sound suport."
+ fi
+ fi
+
+ echo
+ elog "Building ${PN} with ${video} video and ${sound} sound"
+ echo
+
+ cd src && \
+ egamesconf \
+ $(use_with readline) \
+ --with-video=${video} \
+ --with-sound=${sound}
+}
+
+src_compile() {
+ emake -C src
+}
+
+src_install () {
+ dogamesbin src/atari800
+ newman src/atari800.man atari800.6
+ dodoc README.1ST DOC/*
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins "${WORKDIR}/"*.ROM
+ insinto "${GAMES_SYSCONFDIR}"
+ doins "${T}"/atari800.cfg
+ prepgamesdirs
+}
diff --git a/games-emulation/atari800/files/atari800-3.1.0-tgetent-detection.patch b/games-emulation/atari800/files/atari800-3.1.0-tgetent-detection.patch
new file mode 100644
index 000000000000..018e423af6b4
--- /dev/null
+++ b/games-emulation/atari800/files/atari800-3.1.0-tgetent-detection.patch
@@ -0,0 +1,12 @@
+diff -ruN atari800-3.1.0/src/configure.ac new/src/configure.ac
+--- atari800-3.1.0/src/configure.ac 2014-04-12 15:58:16.000000000 +0200
++++ new/src/configure.ac 2015-03-26 23:36:24.419178078 +0100
+@@ -982,7 +982,7 @@
+ dnl existence of the tgetent symbol in readline. If not, we search for tgetent
+ dnl in a few other libraries. All done with a single AC_SEARCH_LIBS statement.
+ have_readline=no
+- AC_SEARCH_LIBS(tgetent, [readline termcap ncursesw ncurses curses], [
++ AC_SEARCH_LIBS(tgetent, [readline termcap tinfow ncursesw ncurses curses], [
+ AC_SEARCH_LIBS(readline, readline, [
+ AC_CHECK_HEADER([readline/readline.h], [
+ have_readline=yes
diff --git a/games-emulation/atari800/files/atari800.cfg b/games-emulation/atari800/files/atari800.cfg
new file mode 100644
index 000000000000..b31c67de0958
--- /dev/null
+++ b/games-emulation/atari800/files/atari800.cfg
@@ -0,0 +1,24 @@
+Atari 800 Emulator, Version 1.2.2
+OS/A_ROM=atariosa.rom
+OS/B_ROM=/usr/share/games/atari800/ATARIOSB.ROM
+XL/XE_ROM=/usr/share/games/atari800/ATARIXL.ROM
+BASIC_ROM=/usr/share/games/atari800/ATARIBAS.ROM
+5200_ROM=
+DISK_DIR=
+ROM_DIR=
+H1_DIR=
+H2_DIR=
+H3_DIR=
+H4_DIR=
+HD_READ_ONLY=1
+EXE_DIR=
+STATE_DIR=
+PRINT_COMMAND=lpr %s
+SCREEN_REFRESH_RATIO=1
+MACHINE_TYPE=Atari OS/B
+RAM_SIZE=48
+DEFAULT_TV_MODE=NTSC
+DISABLE_BASIC=1
+ENABLE_SIO_PATCH=1
+ENABLE_H_PATCH=1
+ENABLE_P_PATCH=1
diff --git a/games-emulation/atari800/metadata.xml b/games-emulation/atari800/metadata.xml
new file mode 100644
index 000000000000..cd61b7b57930
--- /dev/null
+++ b/games-emulation/atari800/metadata.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <longdescription>
+Atari800 is an Atari 800, 800XL, 130XE and 5200 emulator for Unix, Amiga, MS-DOS, Atari
+TT/Falcon, SDL and WinCE. Our main objective is to create a freely distributable portable
+emulator (i.e. with source code available). It can be configured to run in the following
+ways :
+
+ * BASIC mode
+ * CURSES mode
+ * SVGALIB for Linux Systems
+ * X Window + Optional XVIEW or MOTIF User Interface
+ * CBM Amiga
+ * MS-DOS
+ * TOS (Atari Falcon030/TT030 and compatible)
+ * MS Windows (DirectX)
+ * SDL (many different platforms and systems)
+ * WinCE
+ * MacOS X
+</longdescription>
+ <upstream>
+ <remote-id type="sourceforge">atari800</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/caps/Manifest b/games-emulation/caps/Manifest
new file mode 100644
index 000000000000..ef25b368488d
--- /dev/null
+++ b/games-emulation/caps/Manifest
@@ -0,0 +1,4 @@
+DIST config_uae_ocs13_512c-512s.zip 1613 SHA256 972e43dea9b4a14f60fb97eebca9711e3610ea0027807b22dfc01ddc01d24574 SHA512 38aa65030f874756780239191e08c7dbf41a241b44a82a58d8adef8dd94879d3db221c26e860d980a602fd89734f4ce8053e7c7037a8889e9a6f69a1d2dc4d8e WHIRLPOOL 294bdc15eb9809d6ac466edf1e22f40c5a8e6c755c6478da68f9dbb4f8c1e8595510fb9ada83cb21e75776d790d2389778cd69254b5a393cccf28654325f6613
+DIST ipfdevlib_linux-20060612.tgz 60265 SHA256 29b436da18b42e23362bb346a2b870ae6ff3c0bd1fa7875610c12484bfe7af83 SHA512 6d01b35850af9f5f4a45f8ee7f9c9b7a02ffaf3830588c46cf718c5007316baac49c1c7c928f0fc78e9014e3f094cb6a2d6e842c1440a7b8e34e6c31899699d7 WHIRLPOOL 0b9f5f98fdeeef35954645bb58a3978833682bdd1d4982e6cce5aa658d2e6d9d0bc2fd8c5677f719720f4521414e9a9b4d0998a690aa7b1e37aed5b39049ffa9
+DIST ipfdoc102a.zip 264258 SHA256 7d434bb032b054eaaf256cb4fe1ff82038d839c566918860a2bdc3a2493692d3 SHA512 f4b34349c65a5cffc6fad8370959ea0c2516087f46cbb43770b45cf14c573062e03abd77350cf4c8f690dc6a1d461dd0613a03ab70c1f8a72a3a43b9085730f0 WHIRLPOOL 8b99770f712b560dfd37cbc22acf94e97130779bd2b68c6017f369ed98f2038d87e23ec0aa57ef17f7c918c1602a63cdb2912a07d4338d53ee04a606fb6c38e9
+DIST ipflib_linux-amd64-20071115.tgz 24278 SHA256 0cb6af9038faf91d7b3d8bc628ce2a3b4348eaefc5c24a48447e37d287ffe297 SHA512 f306503a0aed7fd781bb6aea22a94fe72a5de952e3e26bb923d551ec5f165aa3fced4014df6a50f20b0f4526710b7e8643aa47a4de85f09bb2f3fe040d0b0f70 WHIRLPOOL ec5c747f2c87267845eebfd945d9c12cad244f7bcd3f5ed80601fc5c97e6b21257fdb917281099415e414467a4a1a79ec5b56dcc41642be74efc269fe7f3e413
diff --git a/games-emulation/caps/caps-20071115.ebuild b/games-emulation/caps/caps-20071115.ebuild
new file mode 100644
index 000000000000..8a221be28336
--- /dev/null
+++ b/games-emulation/caps/caps-20071115.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils multilib
+
+DESCRIPTION="Support library that allows third party applications access and use C.A.P.S. images"
+HOMEPAGE="http://www.softpres.org/"
+SRC_URI="mirror://gentoo/ipfdevlib_linux-20060612.tgz
+ amd64? ( mirror://gentoo/ipflib_linux-amd64-${PV}.tgz )
+ doc? ( mirror://gentoo/ipfdoc102a.zip )
+ mirror://gentoo/config_uae_ocs13_512c-512s.zip"
+
+LICENSE="CAPS"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="doc"
+RESTRICT="strip"
+
+DEPEND="app-arch/unzip"
+RDEPEND=""
+
+S=${WORKDIR}
+
+QA_PREBUILT="usr/lib*/libcapsimage.so* usr/bin/ipfinfo"
+
+src_install() {
+ insinto /usr/include/caps
+ doins ipfdevlib_linux/include/caps/capsimage.h
+
+ case ${ARCH} in
+ ppc)
+ dolib.so ipfdevlib_linux/lib/ppc/libcapsimage.so.2.0
+ dobin ipfdevlib_linux/examples/ppc/ipfinfo
+ ;;
+ x86)
+ dolib.so ipfdevlib_linux/lib/i686/libcapsimage.so.2.0
+ dobin ipfdevlib_linux/examples/i686/ipfinfo
+ ;;
+ amd64)
+ dolib.so ipflib_linux-amd64/libcapsimage.so.2.3
+ dobin ipflib_linux-amd64/ipfinfo
+ ;;
+ *)
+ eerror "Unsupported platform"
+ ;;
+ esac
+
+ case ${ARCH} in
+ ppc|x86)
+ dosym libcapsimage.so.2.0 \
+ /usr/$(get_libdir)/libcapsimage.so.2
+ dodoc ipfdevlib_linux/{HISTORY,README}
+ ;;
+ amd64)
+ dosym libcapsimage.so.2.3 \
+ /usr/$(get_libdir)/libcapsimage.so.2
+ dodoc ipflib_linux-amd64/{HISTORY,README}
+ ;;
+ esac
+
+ insinto /usr/share/${PN}
+ doins OCS_13_1Mb_800_600.uae
+ doins ipfdevlib_linux/examples/ipfinfo.c
+
+ use doc && dodoc CAPSLib102a-40.pdf
+}
diff --git a/games-emulation/caps/metadata.xml b/games-emulation/caps/metadata.xml
new file mode 100644
index 000000000000..7f38c4c23e0e
--- /dev/null
+++ b/games-emulation/caps/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <longdescription lang="en">
+ C.A.P.S., the Classic Amiga Preservation Society, as the name implies,
+ dedicates itself to the preservation of classic Amiga software for the
+ future, namely classic Amiga games. This is the C.A.P.S. support
+ library that allows third party applications access to and use of
+ C.A.P.S. images.
+ </longdescription>
+</pkgmetadata>
diff --git a/games-emulation/daphne/Manifest b/games-emulation/daphne/Manifest
new file mode 100644
index 000000000000..93315985e795
--- /dev/null
+++ b/games-emulation/daphne/Manifest
@@ -0,0 +1 @@
+DIST daphne-1.0-src.tar.gz 4316387 SHA256 b3df3cbb49b3b0d1c2d9f8ab9ae22ef39b1627db09b67a4d10122d754443a588 SHA512 e15e3e86cd03b8eea410eedb667c878f9e2fb044a9bf2cc54e54db641f1c2c6fd99e889cfab308bf972336b577059e13d6cf2a353016ded8e28dae9ddedc0ad4 WHIRLPOOL 6e6be7bcd6beb472881870044d7df36c1493585fd2decdaa70b083fa93338a23b07c93be0fa9634df5c84709d5736579684e5fd663f4122b87f9c0317306948c
diff --git a/games-emulation/daphne/daphne-1.0.ebuild b/games-emulation/daphne/daphne-1.0.ebuild
new file mode 100644
index 000000000000..2a2289028585
--- /dev/null
+++ b/games-emulation/daphne/daphne-1.0.ebuild
@@ -0,0 +1,90 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils toolchain-funcs games
+
+DESCRIPTION="Laserdisc Arcade Game Emulator"
+HOMEPAGE="http://www.daphne-emu.com/"
+SRC_URI="http://www.daphne-emu.com/download/${P}-src.tar.gz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DEPEND="media-libs/libogg
+ media-libs/libvorbis
+ sys-libs/zlib
+ media-libs/libsdl[joystick,video]
+ media-libs/sdl-mixer
+ media-libs/libmpeg2
+ virtual/opengl
+ media-libs/glew"
+RDEPEND=${DEPEND}
+
+S=${WORKDIR}/v_1_0/src
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-vorbisfilefix.patch \
+ "${FILESDIR}"/${P}-typefix.patch \
+ "${FILESDIR}"/${P}-gcc43.patch \
+ "${FILESDIR}"/${P}-ldflags.patch \
+ "${FILESDIR}"/${P}-zlib.patch \
+ "${FILESDIR}"/${P}-underlink.patch \
+ "${FILESDIR}"/${P}-system-lmpeg2.patch
+
+ sed -i "/m_appdir =/s:\.:${GAMES_DATADIR}/${PN}:" \
+ io/homedir.cpp || die
+ sed -i "s:pics/:${GAMES_DATADIR}/${PN}/&:" \
+ video/video.cpp || die
+ sed -i "s:sound/:${GAMES_DATADIR}/${PN}/&:" \
+ sound/sound.cpp || die
+ sed -i "s:./lib:$(games_get_libdir)/${PN}/lib:" \
+ io/dll.h || die
+
+ sed \
+ -e "s:-DNATIVE_CPU_X86::" \
+ -e "s:-DUSE_MMX::" \
+ -e '/export USE_MMX = 1/s:^:# :' \
+ Makefile.vars.linux_x86 >Makefile.vars || die
+}
+
+src_configure() {
+ cd vldp2
+ egamesconf --disable-accel-detect
+}
+
+src_compile() {
+ local archflags
+
+ if use x86; then
+ archflags="-DNATIVE_CPU_X86 -DMMX_RGB2YUV -DUSE_MMX"
+ export USE_MMX=1
+ else
+ # -fPIC is needed on amd64 but fails on x86.
+ archflags="-fPIC"
+ fi
+
+ emake \
+ CXX=$(tc-getCXX) \
+ DFLAGS="${CXXFLAGS} ${archflags}"
+ emake -C vldp2 \
+ -f Makefile.linux \
+ CC=$(tc-getCC) \
+ DFLAGS="${CFLAGS} ${archflags}"
+}
+
+src_install() {
+ cd ..
+ newgamesbin daphne.bin daphne
+ exeinto "$(games_get_libdir)"/${PN}
+ doexe libvldp2.so
+ insinto "${GAMES_DATADIR}"/${PN}
+ doins -r pics roms sound
+ dodoc doc/*.{ini,txt}
+ dohtml -r doc/*
+ prepgamesdirs
+}
diff --git a/games-emulation/daphne/files/daphne-1.0-gcc43.patch b/games-emulation/daphne/files/daphne-1.0-gcc43.patch
new file mode 100644
index 000000000000..289757d4a50c
--- /dev/null
+++ b/games-emulation/daphne/files/daphne-1.0-gcc43.patch
@@ -0,0 +1,12 @@
+--- Makefile.old 2009-01-19 16:22:07.000000000 +0100
++++ Makefile 2009-01-19 16:22:17.000000000 +0100
+@@ -33,7 +33,7 @@
+ endif
+
+ # Platform specific cflags defined in the Makefile.vars file
+-export CFLAGS = ${PFLAGS} ${DEFINE_STATIC_VLDP} -Wall -Winline -Werror
++export CFLAGS = ${PFLAGS} ${DEFINE_STATIC_VLDP} -Wall -Winline
+
+ OBJS = ldp-out/*.o cpu/*.o game/*.o io/*.o timer/*.o ldp-in/*.o video/*.o \
+ sound/*.o daphne.o cpu/x86/*.o scoreboard/*.o ${VLDP_OBJS}
+
diff --git a/games-emulation/daphne/files/daphne-1.0-ldflags.patch b/games-emulation/daphne/files/daphne-1.0-ldflags.patch
new file mode 100644
index 000000000000..a5096a5b3927
--- /dev/null
+++ b/games-emulation/daphne/files/daphne-1.0-ldflags.patch
@@ -0,0 +1,22 @@
+--- Makefile.old 2010-10-05 08:48:46.000000000 +0200
++++ Makefile 2010-10-05 08:49:10.000000000 +0200
+@@ -43,7 +43,7 @@
+ .SUFFIXES: .cpp
+
+ all: ${LOCAL_OBJS} sub
+- ${CXX} ${DFLAGS} ${OBJS} -o ${EXE} ${LIBS}
++ ${CXX} $(LDFLAGS) ${DFLAGS} ${OBJS} -o ${EXE} ${LIBS}
+
+ sub:
+ cd ldp-out && $(MAKE)
+--- vldp2/Makefile.linux.old 2010-10-05 09:29:52.000000000 +0200
++++ vldp2/Makefile.linux 2010-10-05 09:30:13.000000000 +0200
+@@ -33,7 +33,7 @@
+ all: vldp2
+
+ vldp2: ${OBJS}
+- ${CC} -shared -o ${LIBNAME} ${OBJS} ${LIBS}
++ ${CC} $(LDFLAGS) -shared -o ${LIBNAME} ${OBJS} ${LIBS}
+ cp ${LIBNAME} ../../.
+
+ clean:
diff --git a/games-emulation/daphne/files/daphne-1.0-system-lmpeg2.patch b/games-emulation/daphne/files/daphne-1.0-system-lmpeg2.patch
new file mode 100644
index 000000000000..7eed630d13f7
--- /dev/null
+++ b/games-emulation/daphne/files/daphne-1.0-system-lmpeg2.patch
@@ -0,0 +1,41 @@
+diff -ur v_1_0.old/src/vldp2/Makefile.am v_1_0/src/vldp2/Makefile.am
+--- v_1_0.old/src/vldp2/Makefile.am 2009-12-29 18:04:15.000000000 +0200
++++ v_1_0/src/vldp2/Makefile.am 2009-12-29 18:10:42.000000000 +0200
+@@ -1,3 +1,3 @@
+-SUBDIRS = autotools include libmpeg2 libvo doc src vc++ test
++SUBDIRS = autotools
+
+ EXTRA_DIST = bootstrap
+diff -ur v_1_0.old/src/vldp2/Makefile.in v_1_0/src/vldp2/Makefile.in
+--- v_1_0.old/src/vldp2/Makefile.in 2009-12-29 18:04:15.000000000 +0200
++++ v_1_0/src/vldp2/Makefile.in 2009-12-29 18:10:51.000000000 +0200
+@@ -128,7 +128,7 @@
+ sharedstatedir = @sharedstatedir@
+ sysconfdir = @sysconfdir@
+ target_alias = @target_alias@
+-SUBDIRS = autotools include libmpeg2 libvo doc src vc++ test
++SUBDIRS = autotools
+
+ EXTRA_DIST = bootstrap
+ subdir = .
+diff -ur v_1_0.old/src/vldp2/Makefile.linux v_1_0/src/vldp2/Makefile.linux
+--- v_1_0.old/src/vldp2/Makefile.linux 2009-12-29 18:04:15.000000000 +0200
++++ v_1_0/src/vldp2/Makefile.linux 2009-12-29 18:13:12.000000000 +0200
+@@ -14,14 +14,9 @@
+ DFLAGS = -O3 -march=i686 -fomit-frame-pointer -funroll-loops
+
+ CFLAGS = ${DFLAGS} `sdl-config --cflags` -I./include
+-LIBS = `sdl-config --libs`
++LIBS = `sdl-config --libs` -lmpeg2
+
+-OBJS = vldp/vldp.o vldp/vldp_internal.o vldp/mpegscan.o \
+- libmpeg2/cpu_accel.o libmpeg2/alloc.o libmpeg2/cpu_state.o \
+- libmpeg2/decode.o libmpeg2/header.o libmpeg2/motion_comp.o \
+- libmpeg2/idct.o libmpeg2/idct_mmx.o libmpeg2/motion_comp_mmx.o \
+- libmpeg2/slice.o \
+- libvo/video_out.o libvo/video_out_null.o
++OBJS = vldp/vldp.o vldp/vldp_internal.o vldp/mpegscan.o
+
+ LIBNAME = libvldp2.so
+
+
diff --git a/games-emulation/daphne/files/daphne-1.0-typefix.patch b/games-emulation/daphne/files/daphne-1.0-typefix.patch
new file mode 100644
index 000000000000..f47511a0cd03
--- /dev/null
+++ b/games-emulation/daphne/files/daphne-1.0-typefix.patch
@@ -0,0 +1,47 @@
+amd64 does not like int pointers
+
+diff -ruN v_1_0.orig/src/ldp-in/ldv1000.cpp v_1_0/src/ldp-in/ldv1000.cpp
+--- v_1_0.orig/src/ldp-in/ldv1000.cpp 2008-01-29 18:04:34.000000000 +0100
++++ v_1_0/src/ldp-in/ldv1000.cpp 2008-09-19 14:29:40.000000000 +0200
+@@ -607,9 +607,9 @@
+
+ void ldv1000_event_callback(void *eventType)
+ {
+- g_ldv1000_last_event = (unsigned int) eventType;
++ g_ldv1000_last_event = (unsigned long) eventType;
+
+- switch ((unsigned int) eventType)
++ switch ((unsigned long) eventType)
+ {
+ case LDV1000_EVENT_VSYNC_END:
+ #ifdef DEBUG
+diff -ruN v_1_0.orig/src/vldp2/libvo/video_out_null.c v_1_0/src/vldp2/libvo/video_out_null.c
+--- v_1_0.orig/src/vldp2/libvo/video_out_null.c 2008-01-29 18:04:43.000000000 +0100
++++ v_1_0/src/vldp2/libvo/video_out_null.c 2008-09-19 14:30:03.000000000 +0200
+@@ -82,7 +82,7 @@
+ // this is the potentially expensive callback that gets the hardware overlay
+ // ready to be displayed, so we do this before we sleep
+ // NOTE : if this callback fails, we don't want to display the frame due to double buffering considerations
+- if (g_in_info->prepare_frame(&g_yuv_buf[(int) id]))
++ if (g_in_info->prepare_frame(&g_yuv_buf[(long) id]))
+ {
+ #ifndef VLDP_BENCHMARK
+
+@@ -133,7 +133,7 @@
+ #endif
+ // draw the frame
+ // we are using the pointer 'id' as an index, kind of risky, but convenient :)
+- g_in_info->display_frame(&g_yuv_buf[(int) id]);
++ g_in_info->display_frame(&g_yuv_buf[(long) id]);
+ #ifndef VLDP_BENCHMARK
+ } // end if we didn't get a new command to interrupt the frame being displayed
+ #endif
+@@ -272,7 +272,7 @@
+ uint8_t ** buf, void ** id)
+ {
+ static buffer_index = 0;
+- *id = (int *) buffer_index; // THIS IS A LITTLE TRICKY
++ *id = (long *) buffer_index; // THIS IS A LITTLE TRICKY
+ // We are setting an integer value to a pointer ...
+ // Because it is convenient to let the pointer hold the value of this integer for us
+ // Hopefully it doesn't cause any trouble later ;)
diff --git a/games-emulation/daphne/files/daphne-1.0-underlink.patch b/games-emulation/daphne/files/daphne-1.0-underlink.patch
new file mode 100644
index 000000000000..f04f3f6c5fd1
--- /dev/null
+++ b/games-emulation/daphne/files/daphne-1.0-underlink.patch
@@ -0,0 +1,8 @@
+--- Makefile.vars.linux_x86.old 2011-09-21 12:27:42.480566742 +0200
++++ Makefile.vars.linux_x86 2011-09-21 12:27:57.490564959 +0200
+@@ -24,4 +24,4 @@
+ -DUSE_MMX -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DUSE_OPENGL
+
+ # platform-specific lib flags
+-LIBS = `sdl-config --libs` -ldl -lz -logg -lvorbis -lvorbisfile -lGLEW
++LIBS = `sdl-config --libs` -ldl -lz -logg -lvorbis -lvorbisfile -lGLEW -lGL -lm
diff --git a/games-emulation/daphne/files/daphne-1.0-vorbisfilefix.patch b/games-emulation/daphne/files/daphne-1.0-vorbisfilefix.patch
new file mode 100644
index 000000000000..49eb1aaab62d
--- /dev/null
+++ b/games-emulation/daphne/files/daphne-1.0-vorbisfilefix.patch
@@ -0,0 +1,14 @@
+Fix no sound issue with >=media-libs/libvorbis-1.2.0
+
+diff -ruN v_1_0.orig/src/ldp-out/ldp-vldp-audio.cpp v_1_0/src/ldp-out/ldp-vldp-audio.cpp
+--- v_1_0.orig/src/ldp-out/ldp-vldp-audio.cpp 2008-01-29 18:04:07.000000000 +0100
++++ v_1_0/src/ldp-out/ldp-vldp-audio.cpp 2008-09-19 13:43:10.000000000 +0200
+@@ -146,7 +146,7 @@
+ switch (whence)
+ {
+ case SEEK_SET:
+- if (offset < g_audio_filesize)
++ if (offset <= g_audio_filesize)
+ {
+ // make sure offset is positive so we don't get into trouble
+ if (offset >= 0)
diff --git a/games-emulation/daphne/files/daphne-1.0-zlib.patch b/games-emulation/daphne/files/daphne-1.0-zlib.patch
new file mode 100644
index 000000000000..dbae7b31fe9c
--- /dev/null
+++ b/games-emulation/daphne/files/daphne-1.0-zlib.patch
@@ -0,0 +1,13 @@
+--- io/unzip.h.old 2011-09-21 12:13:28.911668053 +0200
++++ io/unzip.h 2011-09-21 12:14:53.074658064 +0200
+@@ -57,6 +57,10 @@
+ #include "zlib.h"
+ #endif
+
++#ifndef OF
++#define OF _Z_OF
++#endif
++
+ #if defined(STRICTUNZIP) || defined(STRICTZIPUNZIP)
+ /* like the STRICT of WIN32, we define a pointer that cannot be converted
+ from (void*) without cast */
diff --git a/games-emulation/daphne/metadata.xml b/games-emulation/daphne/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/daphne/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/dboxfe/Manifest b/games-emulation/dboxfe/Manifest
new file mode 100644
index 000000000000..b1712472eb2b
--- /dev/null
+++ b/games-emulation/dboxfe/Manifest
@@ -0,0 +1 @@
+DIST dboxfe-0.1.3.tar.bz2 260934 SHA256 a1e8e2fa1b3221f3e7dc14c065e93eede3b9d744d94047118cc730207eb52c5c SHA512 2c4f56b03daa4701b1c28c6082c89cb5e737c2d808215ea994ecbaf18d7e02a5616291b229768a86e4ff272e4d84fffaf4ec3350efad72b4f6aa6195804a7ad2 WHIRLPOOL 77e49f802912a67e07f3c9e81ff5d352f9a9c53741e711e9774acb98fb3cd4075dea5eac317c8b10bde941e6fd6d53ae17ceaf2115d35e28a37f953ae41757a0
diff --git a/games-emulation/dboxfe/dboxfe-0.1.3.ebuild b/games-emulation/dboxfe/dboxfe-0.1.3.ebuild
new file mode 100644
index 000000000000..71f9204bcbae
--- /dev/null
+++ b/games-emulation/dboxfe/dboxfe-0.1.3.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils qt4-r2 games
+
+DESCRIPTION="Creates and manages configuration files for DOSBox"
+HOMEPAGE="http://sourceforge.net/projects/dboxfe.berlios/"
+SRC_URI="mirror://sourceforge/dboxfe.berlios/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc ~sparc x86"
+IUSE=""
+
+DEPEND="dev-qt/qtgui:4
+ dev-qt/qtcore:4"
+RDEPEND="${DEPEND}
+ >=games-emulation/dosbox-0.65"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-ldflags.patch
+}
+
+src_configure() {
+ qt4-r2_src_configure
+}
+
+src_install() {
+ dogamesbin bin/dboxfe
+ dodoc TODO ChangeLog
+ newicon res/default.png ${PN}.png
+ make_desktop_entry dboxfe "DosBoxFE"
+ prepgamesdirs
+}
diff --git a/games-emulation/dboxfe/files/dboxfe-0.1.3-ldflags.patch b/games-emulation/dboxfe/files/dboxfe-0.1.3-ldflags.patch
new file mode 100644
index 000000000000..6ceb1d2d5c29
--- /dev/null
+++ b/games-emulation/dboxfe/files/dboxfe-0.1.3-ldflags.patch
@@ -0,0 +1,20 @@
+--- dboxfe.pro.old 2010-09-29 23:53:38.000000000 +0200
++++ dboxfe.pro 2010-09-29 23:54:11.000000000 +0200
+@@ -83,6 +83,7 @@
+ # Unix/Linux settings
+ unix{
+ TARGET = dboxfe
++ QMAKE_LFLAGS += $(LDFLAGS)
+ #QMAKE_POST_LINK = strip -s bin/dboxfe
+ RCC_DIR = .unix/rcc
+ MOC_DIR += .unix/moc
+--- dboxfetray/dboxfetray.pro.old 2010-09-29 23:55:31.000000000 +0200
++++ dboxfetray/dboxfetray.pro 2010-09-29 23:56:12.000000000 +0200
+@@ -56,6 +56,7 @@
+ # Unix/Linux settings
+ unix{
+ TARGET = dboxfetray
++ QMAKE_LFLAGS += $(LDFLAGS)
+ #QMAKE_POST_LINK = strip -s bin/dboxfetray
+ RCC_DIR = .unix/rcc
+ MOC_DIR += .unix/moc
diff --git a/games-emulation/dboxfe/metadata.xml b/games-emulation/dboxfe/metadata.xml
new file mode 100644
index 000000000000..921785cff2d7
--- /dev/null
+++ b/games-emulation/dboxfe/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">dboxfe.berlios</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/desmume/Manifest b/games-emulation/desmume/Manifest
new file mode 100644
index 000000000000..764c4739fabe
--- /dev/null
+++ b/games-emulation/desmume/Manifest
@@ -0,0 +1,3 @@
+DIST desmume-0.9.10.tar.gz 4141586 SHA256 8900a7a1fc849fdd33b014748dd97a6cda4c32548b8d2e06511e6ed8d5ba7445 SHA512 a9151f1d8b08ce64a837ae2447221f5c0003286d4c75b9416d5f151627755aafb09a5120c39b8ee39a04b99d9e8c49ac7dcc0ccd083507aab7e4801269468012 WHIRLPOOL e924adf532db2b10691cb01640f1dbf54045b0dbe6c5daf59c0150a2b254c86cd8d384bc364fdb756168599319a1ef81ce751f09cd5d5e5b79980fb26b9a4e72
+DIST desmume-0.9.8.tar.gz 3677290 SHA256 78363468a2d5efba95de57739a9c81a3757ecd76c2a183ec68336e30d47a5e01
+DIST desmume-0.9.9.tar.gz 4107513 SHA256 cd2ad70cdde1236eba5a4ff8cea838f42b7dc470e32ac938263f49f12a55d754 SHA512 ba5a965102559f048cd57718b4c50e6b2bd39eca4a5990e4cdf068bfa752fccb52d71911ea48da769c5ec18bb740f6b09e6c856ccc78b1e1adf23fd701d1fe31 WHIRLPOOL 055594100216e4ffd046119716e9acc018e7631f96f2be4e830495f88462382180c3955841bfcc3ec494227a606bc820820342907e2b1b2b61a8a65f9b1949b4
diff --git a/games-emulation/desmume/desmume-0.9.10.ebuild b/games-emulation/desmume/desmume-0.9.10.ebuild
new file mode 100644
index 000000000000..b761c4276035
--- /dev/null
+++ b/games-emulation/desmume/desmume-0.9.10.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit games
+
+DESCRIPTION="Nintendo DS emulator"
+HOMEPAGE="http://desmume.org/"
+SRC_URI="mirror://sourceforge/desmume/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.8.0:2
+ gnome-base/libglade
+ x11-libs/gtkglext
+ virtual/opengl
+ sys-libs/zlib
+ dev-libs/zziplib
+ media-libs/libsdl[joystick]
+ x11-libs/agg"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ epatch "${FILESDIR}/desmume-fix-function-type.patch"
+}
+
+src_configure() {
+ egamesconf --datadir=/usr/share
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc AUTHORS ChangeLog README README.LIN
+ prepgamesdirs
+}
diff --git a/games-emulation/desmume/desmume-0.9.8.ebuild b/games-emulation/desmume/desmume-0.9.8.ebuild
new file mode 100644
index 000000000000..942cb36b5da1
--- /dev/null
+++ b/games-emulation/desmume/desmume-0.9.8.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit games
+
+DESCRIPTION="Nintendo DS emulator"
+HOMEPAGE="http://desmume.org/"
+SRC_URI="mirror://sourceforge/desmume/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.8.0:2
+ gnome-base/libglade
+ x11-libs/gtkglext
+ virtual/opengl
+ sys-libs/zlib
+ dev-libs/zziplib
+ media-libs/libsdl[joystick]
+ x11-libs/agg"
+RDEPEND="${DEPEND}"
+
+src_configure() {
+ egamesconf --datadir=/usr/share || die "egamesconf failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake failed"
+ dodoc AUTHORS ChangeLog README README.LIN
+ prepgamesdirs
+}
diff --git a/games-emulation/desmume/desmume-0.9.9.ebuild b/games-emulation/desmume/desmume-0.9.9.ebuild
new file mode 100644
index 000000000000..73d2ad571cac
--- /dev/null
+++ b/games-emulation/desmume/desmume-0.9.9.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="5"
+
+inherit games
+
+DESCRIPTION="Nintendo DS emulator"
+HOMEPAGE="http://desmume.org/"
+SRC_URI="mirror://sourceforge/desmume/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+
+DEPEND=">=x11-libs/gtk+-2.8.0:2
+ gnome-base/libglade
+ x11-libs/gtkglext
+ virtual/opengl
+ sys-libs/zlib
+ dev-libs/zziplib
+ media-libs/libsdl[joystick]
+ x11-libs/agg"
+RDEPEND="${DEPEND}"
+
+src_configure() {
+ egamesconf --datadir=/usr/share || die "egamesconf failed"
+}
+
+src_install() {
+ emake DESTDIR="${D}" install || die "emake failed"
+ dodoc AUTHORS ChangeLog README README.LIN
+ prepgamesdirs
+}
diff --git a/games-emulation/desmume/files/desmume-fix-function-type.patch b/games-emulation/desmume/files/desmume-fix-function-type.patch
new file mode 100644
index 000000000000..b370d57912eb
--- /dev/null
+++ b/games-emulation/desmume/files/desmume-fix-function-type.patch
@@ -0,0 +1,22 @@
+diff -Naur a/src/gtk/glx_3Demu.cpp b/src/gtk/glx_3Demu.cpp
+--- a/src/gtk/glx_3Demu.cpp 2014-12-06 21:08:12.628393543 +0100
++++ b/src/gtk/glx_3Demu.cpp 2014-12-06 21:08:26.591393054 +0100
+@@ -31,7 +31,7 @@
+ static GLXContext ctx;
+ static GLXPbuffer pbuf;
+
+-void deinit_glx_3Demu(void)
++int deinit_glx_3Demu(void)
+ {
+ Display *dpy = glXGetCurrentDisplay();
+
+diff -Naur a/src/gtk/glx_3Demu.h b/src/gtk/glx_3Demu.h
+--- a/src/gtk/glx_3Demu.h 2014-12-06 21:08:12.628393543 +0100
++++ b/src/gtk/glx_3Demu.h 2014-12-06 21:08:23.999393145 +0100
+@@ -20,5 +20,5 @@
+
+ #ifdef HAVE_GL_GLX
+ int init_glx_3Demu(void);
+-void deinit_glx_3Demu(void);
++int deinit_glx_3Demu(void);
+ #endif
diff --git a/games-emulation/desmume/metadata.xml b/games-emulation/desmume/metadata.xml
new file mode 100644
index 000000000000..c36000ab7b2e
--- /dev/null
+++ b/games-emulation/desmume/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <maintainer>
+ <email>hanno@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">desmume</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/dgen-sdl/Manifest b/games-emulation/dgen-sdl/Manifest
new file mode 100644
index 000000000000..824401ea4c08
--- /dev/null
+++ b/games-emulation/dgen-sdl/Manifest
@@ -0,0 +1 @@
+DIST dgen-sdl-1.33.tar.gz 939297 SHA256 99e2c06017c22873c77f88186ebcc09867244eb6e042c763bb094b02b8def61e SHA512 c98ab8cdced62a5d26fd677ad36b031e756620114c946ac067599e84ae6ebcfab731554dd4337b6314c3b5db4601c8a6cc67c285d2aad136e659b9973c01a749 WHIRLPOOL 09c22244983ca960b03a25f633e9885698787a57d3a4e5be2e6af571d71a38d166dbf18aac280e8980ec4e7db2f4eaac6927dd529641c3bd1758a9984e64a211
diff --git a/games-emulation/dgen-sdl/dgen-sdl-1.33.ebuild b/games-emulation/dgen-sdl/dgen-sdl-1.33.ebuild
new file mode 100644
index 000000000000..87a36c2b1c49
--- /dev/null
+++ b/games-emulation/dgen-sdl/dgen-sdl-1.33.ebuild
@@ -0,0 +1,43 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils games
+
+DESCRIPTION="A Linux/SDL-Port of the famous DGen MegaDrive/Genesis-Emulator"
+HOMEPAGE="http://dgen.sourceforge.net/"
+SRC_URI="mirror://sourceforge/dgen/files/${P}.tar.gz"
+
+LICENSE="dgen-sdl BSD BSD-2 free-noncomm LGPL-2.1+ GPL-2+"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="joystick opengl"
+
+RDEPEND="media-libs/libsdl[joystick?,opengl?]
+ app-arch/libarchive
+ opengl? ( virtual/opengl )"
+DEPEND="${RDEPEND}
+ x86? ( dev-lang/nasm )"
+
+src_prepare() {
+ # fix building with USE=-joystick
+ epatch "${FILESDIR}"/${P}-joystick.patch
+}
+
+src_configure() {
+ egamesconf \
+ $(use_enable x86 asm) \
+ $(use_enable joystick) \
+ $(use_enable opengl)
+}
+
+src_compile() {
+ emake -C musa m68kops.h
+ emake
+}
+
+src_install() {
+ DOCS="AUTHORS ChangeLog README sample.dgenrc" default
+ prepgamesdirs
+}
diff --git a/games-emulation/dgen-sdl/files/dgen-sdl-1.33-joystick.patch b/games-emulation/dgen-sdl/files/dgen-sdl-1.33-joystick.patch
new file mode 100644
index 000000000000..38cb962b690b
--- /dev/null
+++ b/games-emulation/dgen-sdl/files/dgen-sdl-1.33-joystick.patch
@@ -0,0 +1,18 @@
+--- sdl/sdl.cpp.orig
++++ sdl/sdl.cpp
+@@ -6285,6 +6285,7 @@
+ #endif
+ static unsigned long hide_mouse_when;
+ static bool hide_mouse;
++ bool pressed;
+ #ifdef WITH_JOYSTICK
+ static uint32_t const axis_value[][3] = {
+ // { pressed, [implicitly released ...] }
+@@ -6301,7 +6302,6 @@
+ };
+ unsigned int hat_value_map;
+ intptr_t joypad;
+- bool pressed;
+ #endif
+ uint32_t plist[8];
+ uint32_t rlist[8];
diff --git a/games-emulation/dgen-sdl/metadata.xml b/games-emulation/dgen-sdl/metadata.xml
new file mode 100644
index 000000000000..dd17d9838ef4
--- /dev/null
+++ b/games-emulation/dgen-sdl/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">dgen</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/dolphin/Manifest b/games-emulation/dolphin/Manifest
new file mode 100644
index 000000000000..e12772892c44
--- /dev/null
+++ b/games-emulation/dolphin/Manifest
@@ -0,0 +1,2 @@
+DIST dolphin-4.0.2.zip 28261421 SHA256 f20c824ee83c3a495fd019747d2f8254477b94c135415b386142f89716d05d66 SHA512 5b1931a133fd431b8f03f47c4c1cfe89f752de17f792e2729421df439564d15a8e35b17e82e31cef99230157de4aa16b2572b28ad67f23ca23c5492972df2938 WHIRLPOOL 48dcc47de02e6aa25e5318bc2564df1ab510210556e3e7c9442f405abd04879b8cff85afb5f1fa7a36364902a472f18bf5fa8da3a9db59b915d41d4e60f3b235
+DIST dolphin-4.0.zip 23439392 SHA256 a698caf05f47a55c30e09d0aab053a412df683de2e139a6348156b03c502a0ec SHA512 02e366c2fa95ab5f37b0a66b94a5b56a632ef81e13febd982d6385cfaf7fa3edb4364180d4b8312e82bc7b8f150d02cde10248996f6a12286a20d684024aca20 WHIRLPOOL 0cb7b28b911111f4b7bf93c56f2dd31d080e7e0418fb53d9cc9093ca995d2c99a1fa7d5d82111e2c8db363e2b07384be39ec0062ab0252233f480b8e45e9304e
diff --git a/games-emulation/dolphin/dolphin-4.0-r2.ebuild b/games-emulation/dolphin/dolphin-4.0-r2.ebuild
new file mode 100644
index 000000000000..a326e47d88fa
--- /dev/null
+++ b/games-emulation/dolphin/dolphin-4.0-r2.ebuild
@@ -0,0 +1,154 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+WX_GTK_VER="2.9"
+
+inherit cmake-utils eutils pax-utils toolchain-funcs versionator wxwidgets games
+
+SRC_URI="https://github.com/${PN}-emu/${PN}/archive/${PV}.zip -> ${P}.zip"
+KEYWORDS="~amd64"
+
+DESCRIPTION="Gamecube and Wii game emulator"
+HOMEPAGE="https://www.dolphin-emu.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="alsa ao bluetooth doc ffmpeg +lzo openal opengl openmp portaudio pulseaudio"
+
+RESTRICT="mirror"
+
+RDEPEND=">=media-libs/glew-1.6
+ >=media-libs/libsdl-1.2[joystick]
+ <media-libs/libsfml-2.0
+ >=net-libs/miniupnpc-1.8
+ sys-libs/readline:=
+ x11-libs/libXext
+ x11-libs/libXrandr
+ alsa? ( media-libs/alsa-lib )
+ ao? ( media-libs/libao )
+ bluetooth? ( net-wireless/bluez )
+ ffmpeg? ( virtual/ffmpeg )
+ lzo? ( dev-libs/lzo )
+ openal? ( media-libs/openal )
+ opengl? ( virtual/opengl )
+ portaudio? ( media-libs/portaudio )
+ pulseaudio? ( media-sound/pulseaudio )
+ "
+DEPEND="${RDEPEND}
+ app-arch/zip
+ media-gfx/nvidia-cg-toolkit
+ media-libs/freetype
+ media-libs/libsoundtouch
+ >=sys-devel/gcc-4.6.0
+ x11-libs/wxGTK:2.9
+ "
+
+pkg_pretend() {
+
+ local ver=4.6.0
+ local msg="${PN} needs at least GCC ${ver} set to compile."
+
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ if ! version_is_at_least ${ver} $(gcc-fullversion); then
+ eerror ${msg}
+ die ${msg}
+ fi
+ fi
+
+}
+
+src_prepare() {
+
+ # Remove automatic dependencies to prevent building without flags enabled.
+ if use !alsa; then
+ sed -i -e '^/include(FindALSA/d' CMakeLists.txt || die
+ fi
+ if use !ao; then
+ sed -i -e '/^check_lib(AO/d' CMakeLists.txt || die
+ fi
+ if use !bluetooth; then
+ sed -i -e '/^check_lib(BLUEZ/d' CMakeLists.txt || die
+ fi
+ if use !openal; then
+ sed -i -e '/^include(FindOpenAL/d' CMakeLists.txt || die
+ fi
+ if use !portaudio; then
+ sed -i -e '/CMAKE_REQUIRED_LIBRARIES portaudio/d' CMakeLists.txt || die
+ fi
+ if use !pulseaudio; then
+ sed -i -e '/^check_lib(PULSEAUDIO/d' CMakeLists.txt || die
+ fi
+
+ # Remove ALL the bundled libraries, aside from:
+ # - SOIL: The sources are not public.
+ # - Bochs-disasm: Don't know what it is.
+ # - CLRun: Part of OpenCL
+ # - polarssl: Currently fails the check as is.
+ mv Externals/SOIL . || die
+ mv Externals/Bochs_disasm . || die
+ mv Externals/CLRun . || die
+ mv Externals/polarssl . || die
+ rm -r Externals/* || die
+ mv polarssl Externals || die
+ mv CLRun Externals || die
+ mv Bochs_disasm Externals || die
+ mv SOIL Externals || die
+
+ # Add call for FindX11 as FindOpenGL does not include it implicitly
+ # anymore for >=cmake-3.2. For more info, see:
+ # https://public.kitware.com/Bug/print_bug_page.php?bug_id=15268
+ if has_version ">=dev-util/cmake-3.2"; then
+ sed -i -e '/if(NOT ANDROID)/a include(FindX11)' CMakeLists.txt || die
+
+ # Fix syntax warnings in FindMiniupnpc.cmake
+ sed -i -e 's/\"\"/\\\"\\\"/g' CMakeTests/FindMiniupnpc.cmake || die
+ fi
+}
+
+src_configure() {
+
+ local mycmakeargs=(
+ "-DDOLPHIN_WC_REVISION=${PV}"
+ "-DCMAKE_INSTALL_PREFIX=${GAMES_PREFIX}"
+ "-Dprefix=${GAMES_PREFIX}"
+ "-Ddatadir=${GAMES_DATADIR}/${PN}"
+ "-Dplugindir=$(games_get_libdir)/${PN}"
+ $( cmake-utils_use ffmpeg ENCODE_FRAMEDUMPS )
+ $( cmake-utils_use openmp OPENMP )
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+
+ cmake-utils_src_compile
+}
+
+src_install() {
+
+ cmake-utils_src_install
+
+ dodoc Readme.txt
+ if use doc; then
+ dodoc -r docs/ActionReplay docs/DSP docs/WiiMote
+ fi
+
+ doicon Source/Core/DolphinWX/resources/Dolphin.xpm
+ make_desktop_entry "dolphin-emu" "Dolphin" "Dolphin" "Game;"
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ # Add pax markings for hardened systems
+ pax-mark -m "${EPREFIX}"/usr/games/bin/"${PN}"-emu
+
+ if ! use portaudio; then
+ ewarn "If you want microphone capabilities in dolphin-emu, rebuild with"
+ ewarn "USE=\"portaudio\""
+ fi
+}
diff --git a/games-emulation/dolphin/dolphin-4.0.2-r7.ebuild b/games-emulation/dolphin/dolphin-4.0.2-r7.ebuild
new file mode 100644
index 000000000000..c85c5fc3a4e6
--- /dev/null
+++ b/games-emulation/dolphin/dolphin-4.0.2-r7.ebuild
@@ -0,0 +1,155 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+WX_GTK_VER="3.0"
+
+inherit cmake-utils eutils pax-utils toolchain-funcs versionator wxwidgets games
+
+SRC_URI="https://github.com/${PN}-emu/${PN}/archive/${PV}.zip -> ${P}.zip"
+KEYWORDS="~amd64"
+
+DESCRIPTION="Gamecube and Wii game emulator"
+HOMEPAGE="https://www.dolphin-emu.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="alsa ao bluetooth doc ffmpeg +lzo openal opengl openmp portaudio pulseaudio"
+
+RESTRICT="mirror"
+
+RDEPEND=">=media-libs/glew-1.6
+ <media-libs/libsfml-2.0
+ >=net-libs/miniupnpc-1.8
+ media-libs/libsdl2[haptic,joystick]
+ sys-libs/readline:=
+ x11-libs/libXext
+ x11-libs/libXrandr
+ alsa? ( media-libs/alsa-lib )
+ ao? ( media-libs/libao )
+ bluetooth? ( net-wireless/bluez )
+ ffmpeg? ( virtual/ffmpeg
+ !!>=media-video/libav-10 )
+ lzo? ( dev-libs/lzo )
+ openal? ( media-libs/openal )
+ opengl? ( virtual/opengl )
+ portaudio? ( media-libs/portaudio )
+ pulseaudio? ( media-sound/pulseaudio )
+ "
+DEPEND="${RDEPEND}
+ app-arch/zip
+ media-gfx/nvidia-cg-toolkit
+ media-libs/freetype
+ media-libs/libsoundtouch
+ >=sys-devel/gcc-4.6.0
+ x11-libs/wxGTK:${WX_GTK_VER}
+ "
+
+pkg_pretend() {
+
+ local ver=4.6.0
+ local msg="${PN} needs at least GCC ${ver} set to compile."
+
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ if ! version_is_at_least ${ver} $(gcc-fullversion); then
+ eerror ${msg}
+ die ${msg}
+ fi
+ fi
+
+}
+
+src_prepare() {
+
+ # Remove automatic dependencies to prevent building without flags enabled.
+ if use !alsa; then
+ sed -i -e '/include(FindALSA/d' CMakeLists.txt || die
+ fi
+ if use !ao; then
+ sed -i -e '/check_lib(AO/d' CMakeLists.txt || die
+ fi
+ if use !bluetooth; then
+ sed -i -e '/check_lib(BLUEZ/d' CMakeLists.txt || die
+ fi
+ if use !openal; then
+ sed -i -e '/include(FindOpenAL/d' CMakeLists.txt || die
+ fi
+ if use !portaudio; then
+ sed -i -e '/CMAKE_REQUIRED_LIBRARIES portaudio/d' CMakeLists.txt || die
+ fi
+ if use !pulseaudio; then
+ sed -i -e '/check_lib(PULSEAUDIO/d' CMakeLists.txt || die
+ fi
+
+ # Remove ALL the bundled libraries, aside from:
+ # - SOIL: The sources are not public.
+ # - Bochs-disasm: Don't know what it is.
+ # - CLRun: Part of OpenCL
+ # - polarssl: Currently fails the check as is.
+ mv Externals/SOIL . || die
+ mv Externals/Bochs_disasm . || die
+ mv Externals/CLRun . || die
+ mv Externals/polarssl . || die
+ rm -r Externals/* || die
+ mv polarssl Externals || die
+ mv CLRun Externals || die
+ mv Bochs_disasm Externals || die
+ mv SOIL Externals || die
+
+ # Add call for FindX11 as FindOpenGL does not include it implicitly
+ # anymore for >=cmake-3.2. For more info, see:
+ # https://public.kitware.com/Bug/print_bug_page.php?bug_id=15268
+ if has_version ">=dev-util/cmake-3.2"; then
+ sed -i -e '/if(NOT ANDROID)/a include(FindX11)' CMakeLists.txt || die
+
+ # Fix syntax warnings in FindMiniupnpc.cmake
+ sed -i -e 's/\"\"/\\\"\\\"/g' CMakeTests/FindMiniupnpc.cmake || die
+ fi
+}
+
+src_configure() {
+
+ local mycmakeargs=(
+ "-DDOLPHIN_WC_REVISION=${PV}"
+ "-DCMAKE_INSTALL_PREFIX=${GAMES_PREFIX}"
+ "-Dprefix=${GAMES_PREFIX}"
+ "-Ddatadir=${GAMES_DATADIR}/${PN}"
+ "-Dplugindir=$(games_get_libdir)/${PN}"
+ $( cmake-utils_use ffmpeg ENCODE_FRAMEDUMPS )
+ $( cmake-utils_use openmp OPENMP )
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+
+ cmake-utils_src_compile
+}
+
+src_install() {
+
+ cmake-utils_src_install
+
+ dodoc Readme.txt
+ if use doc; then
+ dodoc -r docs/ActionReplay docs/DSP docs/WiiMote
+ fi
+
+ doicon Source/Core/DolphinWX/resources/Dolphin.xpm
+ make_desktop_entry "dolphin-emu" "Dolphin" "Dolphin" "Game;"
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ # Add pax markings for hardened systems
+ pax-mark -m "${EPREFIX}"/usr/games/bin/"${PN}"-emu
+
+ if ! use portaudio; then
+ ewarn "If you want microphone capabilities in dolphin-emu, rebuild with"
+ ewarn "USE=\"portaudio\""
+ fi
+}
diff --git a/games-emulation/dolphin/dolphin-9999.ebuild b/games-emulation/dolphin/dolphin-9999.ebuild
new file mode 100644
index 000000000000..8271dd58f0bf
--- /dev/null
+++ b/games-emulation/dolphin/dolphin-9999.ebuild
@@ -0,0 +1,156 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+WX_GTK_VER="3.0"
+
+inherit cmake-utils eutils pax-utils toolchain-funcs versionator wxwidgets games
+
+if [[ ${PV} == 9999* ]]
+then
+ EGIT_REPO_URI="https://github.com/dolphin-emu/dolphin"
+ inherit git-r3
+ KEYWORDS=""
+else
+ SRC_URI="http://${PN}-emu.googlecode.com/files/${P}-src.zip"
+ KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Gamecube and Wii game emulator"
+HOMEPAGE="https://www.dolphin-emu.org/"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="alsa ao bluetooth doc ffmpeg lto +lzo openal opengl openmp portaudio pulseaudio"
+
+RDEPEND=">=media-libs/glew-1.10
+ >=media-libs/libsfml-2.1
+ >=net-libs/miniupnpc-1.8
+ sys-libs/readline:=
+ x11-libs/libXext
+ x11-libs/libXrandr
+ media-libs/libsdl2[haptic,joystick]
+ net-libs/polarssl[havege]
+ alsa? ( media-libs/alsa-lib )
+ ao? ( media-libs/libao )
+ bluetooth? ( net-wireless/bluez )
+ ffmpeg? ( virtual/ffmpeg
+ !!>=media-video/libav-10 )
+ lzo? ( dev-libs/lzo )
+ openal? ( media-libs/openal )
+ opengl? ( virtual/opengl )
+ portaudio? ( media-libs/portaudio )
+ pulseaudio? ( media-sound/pulseaudio )
+ "
+DEPEND="${RDEPEND}
+ app-arch/zip
+ media-gfx/nvidia-cg-toolkit
+ media-libs/freetype
+ media-libs/libsoundtouch
+ >net-libs/enet-1.3.7
+ >=sys-devel/gcc-4.9.0
+ x11-libs/wxGTK:${WX_GTK_VER}
+ "
+
+pkg_pretend() {
+
+ local ver=4.9.0
+ local msg="${PN} needs at least GCC ${ver} set to compile."
+
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ if ! version_is_at_least ${ver} $(gcc-fullversion); then
+ eerror ${msg}
+ die ${msg}
+ fi
+ fi
+
+}
+
+src_prepare() {
+
+ # Remove automatic dependencies to prevent building without flags enabled.
+ if use !alsa; then
+ sed -i -e '/include(FindALSA/d' CMakeLists.txt || die
+ fi
+ if use !ao; then
+ sed -i -e '/check_lib(AO/d' CMakeLists.txt || die
+ fi
+ if use !bluetooth; then
+ sed -i -e '/check_lib(BLUEZ/d' CMakeLists.txt || die
+ fi
+ if use !openal; then
+ sed -i -e '/include(FindOpenAL/d' CMakeLists.txt || die
+ fi
+ if use !portaudio; then
+ sed -i -e '/CMAKE_REQUIRED_LIBRARIES portaudio/d' CMakeLists.txt || die
+ fi
+ if use !pulseaudio; then
+ sed -i -e '/check_lib(PULSEAUDIO/d' CMakeLists.txt || die
+ fi
+
+ # Remove ALL the bundled libraries, aside from:
+ # - SOIL: The sources are not public.
+ # - Bochs-disasm: Don't know what it is.
+ # - GL: A custom gl.h file is used.
+ # - gtest: Their build set up solely relies on the build in gtest.
+ # - xxhash: Not on the tree.
+ mv Externals/SOIL . || die
+ mv Externals/Bochs_disasm . || die
+ mv Externals/GL . || die
+ mv Externals/gtest . || die
+ mv Externals/xxhash . || die
+ rm -r Externals/* || die "Failed to delete Externals dir."
+ mv Bochs_disasm Externals || die
+ mv SOIL Externals || die
+ mv GL Externals || die
+ mv gtest Externals || die
+ mv xxhash Externals || die
+}
+
+src_configure() {
+
+ local mycmakeargs=(
+ "-DDOLPHIN_WC_REVISION=${PV}"
+ "-DCMAKE_INSTALL_PREFIX=${GAMES_PREFIX}"
+ "-Dprefix=${GAMES_PREFIX}"
+ "-Ddatadir=${GAMES_DATADIR}/${PN}"
+ "-Dplugindir=$(games_get_libdir)/${PN}"
+ "-DUSE_SHARED_ENET=ON"
+ $( cmake-utils_use ffmpeg ENCODE_FRAMEDUMPS )
+ $( cmake-utils_use_enable lto LTO )
+ $( cmake-utils_use openmp OPENMP )
+ )
+
+ cmake-utils_src_configure
+}
+
+src_compile() {
+
+ cmake-utils_src_compile
+}
+src_install() {
+
+ cmake-utils_src_install
+
+ dodoc Readme.md
+ if use doc; then
+ dodoc -r docs/ActionReplay docs/DSP docs/WiiMote
+ fi
+
+ doicon Installer/dolphin-emu.xpm
+ make_desktop_entry "dolphin-emu" "Dolphin Emulator" "dolphin-emu" "Game;Emulator;"
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ # Add pax markings for hardened systems
+ pax-mark -m "${EPREFIX}"/usr/games/bin/"${PN}"-emu
+
+ if ! use portaudio; then
+ ewarn "If you want microphone capabilities in dolphin-emu, rebuild with"
+ ewarn "USE=\"portaudio\""
+ fi
+}
diff --git a/games-emulation/dolphin/files/dolphin-emu-3.5-gcc-4.8.patch b/games-emulation/dolphin/files/dolphin-emu-3.5-gcc-4.8.patch
new file mode 100644
index 000000000000..98b128f90542
--- /dev/null
+++ b/games-emulation/dolphin/files/dolphin-emu-3.5-gcc-4.8.patch
@@ -0,0 +1,211 @@
+--- Externals/Bochs_disasm/PowerPCDisasm.cpp 2013-05-04 10:01:04.218490222 +0200
++++ Externals/Bochs_disasm/PowerPCDisasm.cpp 2013-05-04 10:01:19.159459773 +0200
+@@ -580,7 +580,7 @@
+ if (me < mb)
+ mask = ~mask;
+ //rotate the mask so it can be applied to source reg
+- return _rotl(mask, 32 - r);
++ return __rotl(mask, 32 - r);
+ }
+
+
+--- Source/Core/Common/Src/CommonFuncs.h 2013-05-04 10:01:04.139490384 +0200
++++ Source/Core/Common/Src/CommonFuncs.h 2013-05-04 10:02:18.181339068 +0200
+@@ -65,7 +65,7 @@
+ #endif
+ #define ARRAYSIZE(A) (sizeof(A)/sizeof((A)[0]))
+
+-inline u32 _rotl(u32 x, int shift) {
++inline u32 __rotl(u32 x, int shift) {
+ shift &= 31;
+ if (!shift) return x;
+ return (x << shift) | (x >> (32 - shift));
+@@ -76,7 +76,7 @@
+ return (x << n) | (x >> (64 - n));
+ }
+
+-inline u32 _rotr(u32 x, int shift) {
++inline u32 __rotr(u32 x, int shift) {
+ shift &= 31;
+ if (!shift) return x;
+ return (x >> shift) | (x << (32 - shift));
+--- Source/Core/Common/Src/Hash.cpp 2013-05-04 10:01:04.140490382 +0200
++++ Source/Core/Common/Src/Hash.cpp 2013-05-04 10:01:19.161459756 +0200
+@@ -362,15 +362,15 @@
+ inline void bmix32(u32 & h1, u32 & h2, u32 & k1, u32 & k2, u32 & c1, u32 & c2)
+ {
+ k1 *= c1;
+- k1 = _rotl(k1,11);
++ k1 = __rotl(k1,11);
+ k1 *= c2;
+ h1 ^= k1;
+ h1 += h2;
+
+- h2 = _rotl(h2,17);
++ h2 = __rotl(h2,17);
+
+ k2 *= c2;
+- k2 = _rotl(k2,11);
++ k2 = __rotl(k2,11);
+ k2 *= c1;
+ h2 ^= k2;
+ h2 += h1;
+--- Source/Core/Core/Src/ARDecrypt.cpp 2013-05-04 10:01:04.193490273 +0200
++++ Source/Core/Core/Src/ARDecrypt.cpp 2013-05-04 10:01:19.161459756 +0200
+@@ -270,26 +270,26 @@
+ {
+ u32 tmp;
+
+- *val = _rotl(*val,4);
++ *val = __rotl(*val,4);
+
+ tmp = ((*addr^*val)&0xF0F0F0F0);
+ *addr ^= tmp;
+- *val = _rotr((*val^tmp),0x14);
++ *val = __rotr((*val^tmp),0x14);
+
+ tmp = ((*addr^*val)&0xFFFF0000);
+ *addr ^= tmp;
+- *val = _rotr((*val^tmp),0x12);
++ *val = __rotr((*val^tmp),0x12);
+
+ tmp = ((*addr^*val)&0x33333333);
+ *addr ^= tmp;
+- *val = _rotr((*val^tmp),6);
++ *val = __rotr((*val^tmp),6);
+
+ tmp = ((*addr^*val)&0x00FF00FF);
+ *addr ^= tmp;
+- *val = _rotl((*val^tmp),9);
++ *val = __rotl((*val^tmp),9);
+
+ tmp = ((*addr^*val)&0xAAAAAAAA);
+- *addr = _rotl((*addr^tmp),1);
++ *addr = __rotl((*addr^tmp),1);
+ *val ^= tmp;
+ }
+
+@@ -297,27 +297,27 @@
+ {
+ u32 tmp;
+
+- *val = _rotr(*val,1);
++ *val = __rotr(*val,1);
+
+ tmp = ((*addr^*val)&0xAAAAAAAA);
+ *val ^= tmp;
+- *addr = _rotr((*addr^tmp),9);
++ *addr = __rotr((*addr^tmp),9);
+
+ tmp = ((*addr^*val)&0x00FF00FF);
+ *val ^= tmp;
+- *addr = _rotl((*addr^tmp),6);
++ *addr = __rotl((*addr^tmp),6);
+
+ tmp = ((*addr^*val)&0x33333333);
+ *val ^= tmp;
+- *addr = _rotl((*addr^tmp),0x12);
++ *addr = __rotl((*addr^tmp),0x12);
+
+ tmp = ((*addr^*val)&0xFFFF0000);
+ *val ^= tmp;
+- *addr = _rotl((*addr^tmp),0x14);
++ *addr = __rotl((*addr^tmp),0x14);
+
+ tmp = ((*addr^*val)&0xF0F0F0F0);
+ *val ^= tmp;
+- *addr = _rotr((*addr^tmp),4);
++ *addr = __rotr((*addr^tmp),4);
+ }
+
+ void decryptcode(u32 *seeds, u32 *code)
+@@ -330,11 +330,11 @@
+ unscramble1(&addr,&val);
+ while (i < 32)
+ {
+- tmp = (_rotr(val,4)^seeds[i++]);
++ tmp = (__rotr(val,4)^seeds[i++]);
+ tmp2 = (val^seeds[i++]);
+ addr ^= (table6[tmp&0x3F]^table4[(tmp>>8)&0x3F]^table2[(tmp>>16)&0x3F]^table0[(tmp>>24)&0x3F]^table7[tmp2&0x3F]^table5[(tmp2>>8)&0x3F]^table3[(tmp2>>16)&0x3F]^table1[(tmp2>>24)&0x3F]);
+
+- tmp = (_rotr(addr,4)^seeds[i++]);
++ tmp = (__rotr(addr,4)^seeds[i++]);
+ tmp2 = (addr^seeds[i++]);
+ val ^= (table6[tmp&0x3F]^table4[(tmp>>8)&0x3F]^table2[(tmp>>16)&0x3F]^table0[(tmp>>24)&0x3F]^table7[tmp2&0x3F]^table5[(tmp2>>8)&0x3F]^table3[(tmp2>>16)&0x3F]^table1[(tmp2>>24)&0x3F]);
+ }
+--- Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp 2013-05-04 10:01:04.187490286 +0200
++++ Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Integer.cpp 2013-05-04 10:01:19.162459748 +0200
+@@ -194,21 +194,21 @@
+ void Interpreter::rlwimix(UGeckoInstruction _inst)
+ {
+ u32 mask = Helper_Mask(_inst.MB,_inst.ME);
+- m_GPR[_inst.RA] = (m_GPR[_inst.RA] & ~mask) | (_rotl(m_GPR[_inst.RS],_inst.SH) & mask);
++ m_GPR[_inst.RA] = (m_GPR[_inst.RA] & ~mask) | (__rotl(m_GPR[_inst.RS],_inst.SH) & mask);
+ if (_inst.Rc) Helper_UpdateCR0(m_GPR[_inst.RA]);
+ }
+
+ void Interpreter::rlwinmx(UGeckoInstruction _inst)
+ {
+ u32 mask = Helper_Mask(_inst.MB,_inst.ME);
+- m_GPR[_inst.RA] = _rotl(m_GPR[_inst.RS],_inst.SH) & mask;
++ m_GPR[_inst.RA] = __rotl(m_GPR[_inst.RS],_inst.SH) & mask;
+ if (_inst.Rc) Helper_UpdateCR0(m_GPR[_inst.RA]);
+ }
+
+ void Interpreter::rlwnmx(UGeckoInstruction _inst)
+ {
+ u32 mask = Helper_Mask(_inst.MB,_inst.ME);
+- m_GPR[_inst.RA] = _rotl(m_GPR[_inst.RS], m_GPR[_inst.RB] & 0x1F) & mask;
++ m_GPR[_inst.RA] = __rotl(m_GPR[_inst.RS], m_GPR[_inst.RB] & 0x1F) & mask;
+
+ if (_inst.Rc) Helper_UpdateCR0(m_GPR[_inst.RA]);
+ }
+--- Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp 2013-05-04 10:01:04.185490290 +0200
++++ Source/Core/Core/Src/PowerPC/Jit64/Jit_Integer.cpp 2013-05-04 10:01:19.190459657 +0200
+@@ -1672,7 +1672,7 @@
+ {
+ unsigned result = (int)gpr.R(s).offset;
+ if (inst.SH != 0)
+- result = _rotl(result, inst.SH);
++ result = __rotl(result, inst.SH);
+ result &= Helper_Mask(inst.MB, inst.ME);
+ gpr.SetImmediate32(a, result);
+ if (inst.Rc)
+@@ -1739,7 +1739,7 @@
+ if (gpr.R(a).IsImm() && gpr.R(s).IsImm())
+ {
+ u32 mask = Helper_Mask(inst.MB,inst.ME);
+- gpr.SetImmediate32(a, ((u32)gpr.R(a).offset & ~mask) | (_rotl((u32)gpr.R(s).offset,inst.SH) & mask));
++ gpr.SetImmediate32(a, ((u32)gpr.R(a).offset & ~mask) | (__rotl((u32)gpr.R(s).offset,inst.SH) & mask));
+ if (inst.Rc)
+ {
+ ComputeRC(gpr.R(a));
+@@ -1824,7 +1824,7 @@
+ u32 mask = Helper_Mask(inst.MB, inst.ME);
+ if (gpr.R(b).IsImm() && gpr.R(s).IsImm())
+ {
+- gpr.SetImmediate32(a, _rotl((u32)gpr.R(s).offset, (u32)gpr.R(b).offset & 0x1F) & mask);
++ gpr.SetImmediate32(a, __rotl((u32)gpr.R(s).offset, (u32)gpr.R(b).offset & 0x1F) & mask);
+ if (inst.Rc)
+ {
+ ComputeRC(gpr.R(a));
+--- Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp 2013-05-04 10:01:04.188490284 +0200
++++ Source/Core/Core/Src/PowerPC/Jit64IL/IR.cpp 2013-05-04 10:01:19.191459655 +0200
+@@ -248,7 +248,7 @@
+ return 0;
+ case Rol:
+ if (isImm(*getOp2(I))) {
+- return _rotl(ComputeKnownZeroBits(getOp1(I)),
++ return __rotl(ComputeKnownZeroBits(getOp1(I)),
+ GetImmValue(getOp2(I)));
+ }
+ default:
+@@ -844,7 +844,7 @@
+ InstLoc IRBuilder::FoldRol(InstLoc Op1, InstLoc Op2) {
+ if (isImm(*Op2)) {
+ if (isImm(*Op1))
+- return EmitIntConst(_rotl(GetImmValue(Op1),
++ return EmitIntConst(__rotl(GetImmValue(Op1),
+ GetImmValue(Op2)));
+ if (!(GetImmValue(Op2) & 31)) return Op1;
+ }
diff --git a/games-emulation/dolphin/metadata.xml b/games-emulation/dolphin/metadata.xml
new file mode 100644
index 000000000000..41ce06585e8a
--- /dev/null
+++ b/games-emulation/dolphin/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<use>
+ <flag name="lto">Add support for link-time optimizations.</flag>
+</use>
+<longdescription lang="en">
+Dolphin is a Gamecube and Wii emulator. Most games run perfectly or with minor
+bugs. Games are playable at HD quality, with 1080p and more.
+</longdescription>
+ <maintainer>
+ <email>twitch153@gentoo.org</email>
+ <name>Devan Franchini</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/games-emulation/dosbox/Manifest b/games-emulation/dosbox/Manifest
new file mode 100644
index 000000000000..aa7079d0e759
--- /dev/null
+++ b/games-emulation/dosbox/Manifest
@@ -0,0 +1 @@
+DIST dosbox-0.74.tar.gz 1265711 SHA256 13f74916e2d4002bad1978e55727f302ff6df3d9be2f9b0e271501bd0a938e05 SHA512 4a6ff4c658997a495119d200ec6ad37649da940814a4b14fca0dd29a99142026e324695b7aa9d2946efc2abf9067a819d911e43778efe905ed10ddf9b9f2dd3d WHIRLPOOL abc94770c732f8b73bedffbcca778f249c2fdc09353c3f484e2fc23f910602cc60b3abfcc22a9dbf3d3c4e77535fc488cd476217fe6498cab786a8024a257ff3
diff --git a/games-emulation/dosbox/dosbox-0.74.ebuild b/games-emulation/dosbox/dosbox-0.74.ebuild
new file mode 100644
index 000000000000..56a0bb8c15d4
--- /dev/null
+++ b/games-emulation/dosbox/dosbox-0.74.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils games
+
+DESCRIPTION="DOS emulator"
+HOMEPAGE="http://dosbox.sourceforge.net/"
+SRC_URI="mirror://sourceforge/dosbox/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~arm ppc ppc64 ~sparc x86"
+IUSE="alsa debug hardened opengl"
+
+DEPEND="alsa? ( media-libs/alsa-lib )
+ opengl? ( virtual/glu virtual/opengl )
+ debug? ( sys-libs/ncurses )
+ media-libs/libpng:0
+ media-libs/libsdl[joystick,video,X]
+ media-libs/sdl-net
+ media-libs/sdl-sound"
+RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}"/${P}-gcc46.patch )
+
+src_configure() {
+ egamesconf \
+ $(use_enable alsa alsa-midi) \
+ $(use_enable !hardened dynamic-core) \
+ $(use_enable !hardened dynamic-x86) \
+ $(use_enable debug) \
+ $(use_enable opengl)
+}
+
+src_install() {
+ default
+ make_desktop_entry dosbox DOSBox /usr/share/pixmaps/dosbox.ico
+ doicon src/dosbox.ico
+ prepgamesdirs
+}
diff --git a/games-emulation/dosbox/dosbox-9999.ebuild b/games-emulation/dosbox/dosbox-9999.ebuild
new file mode 100644
index 000000000000..f01034ef4e64
--- /dev/null
+++ b/games-emulation/dosbox/dosbox-9999.ebuild
@@ -0,0 +1,51 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+ESVN_REPO_URI="https://dosbox.svn.sourceforge.net/svnroot/dosbox/dosbox/trunk"
+inherit autotools eutils subversion games
+
+DESCRIPTION="DOS emulator"
+HOMEPAGE="http://dosbox.sourceforge.net/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+IUSE="alsa debug hardened opengl"
+
+DEPEND="alsa? ( media-libs/alsa-lib )
+ opengl? ( virtual/glu virtual/opengl )
+ debug? ( sys-libs/ncurses )
+ media-libs/libpng:0
+ media-libs/libsdl[joystick,video,X]
+ media-libs/sdl-net
+ media-libs/sdl-sound"
+RDEPEND=${DEPEND}
+
+S=${WORKDIR}/${PN}
+
+src_unpack() {
+ subversion_src_unpack
+}
+
+src_prepare() {
+ subversion_src_prepare
+ eautoreconf
+}
+
+src_configure() {
+ egamesconf \
+ $(use_enable alsa alsa-midi) \
+ $(use_enable !hardened dynamic-core) \
+ $(use_enable !hardened dynamic-x86) \
+ $(use_enable debug) \
+ $(use_enable opengl)
+}
+
+src_install() {
+ default
+ make_desktop_entry dosbox DOSBox /usr/share/pixmaps/dosbox.ico
+ doicon src/dosbox.ico
+ prepgamesdirs
+}
diff --git a/games-emulation/dosbox/files/dosbox-0.74-gcc46.patch b/games-emulation/dosbox/files/dosbox-0.74-gcc46.patch
new file mode 100644
index 000000000000..16811d47d640
--- /dev/null
+++ b/games-emulation/dosbox/files/dosbox-0.74-gcc46.patch
@@ -0,0 +1,10 @@
+--- include/dos_inc.h.old 2011-04-28 08:46:04.505011354 +0200
++++ include/dos_inc.h 2011-04-28 08:46:27.104408178 +0200
+@@ -21,6 +21,7 @@
+ #ifndef DOSBOX_DOS_INC_H
+ #define DOSBOX_DOS_INC_H
+
++#include <cstddef>
+ #ifndef DOSBOX_DOS_SYSTEM_H
+ #include "dos_system.h"
+ #endif
diff --git a/games-emulation/dosbox/metadata.xml b/games-emulation/dosbox/metadata.xml
new file mode 100644
index 000000000000..941eda8deb47
--- /dev/null
+++ b/games-emulation/dosbox/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+<maintainer>
+<email>mr_bones_@gentoo.org</email>
+</maintainer>
+</pkgmetadata>
diff --git a/games-emulation/emutos/Manifest b/games-emulation/emutos/Manifest
new file mode 100644
index 000000000000..32a740a4a7e2
--- /dev/null
+++ b/games-emulation/emutos/Manifest
@@ -0,0 +1,5 @@
+DIST emutos-256k-0.9.3.zip 1573051 SHA256 1345274293ef8dc749e90652e085c34d87417c74aa1b94dc7b537d299a19600a SHA512 f5ad9223169b713d932ee3f5f986eef127f3f5d7d6a54ad272738034fda8436b69055937edbce335256edafef44466c4e34e932f2807c25fa099ce07f3410dde WHIRLPOOL 6a634a35f0850d0e76a696d3f3d70d30ae76a4b95fc3efdc1aa6c2a49756cc22863b6034a46efb1e0c4e079af75b375eb58d405f19b1029e407e6dedd4269790
+DIST emutos-256k-0.9.4.zip 1600186 SHA256 c788da706e82a5514f6d2faf11043a8998adca090fcce46f8f32ea209ffd81f4 SHA512 ce7ce9e53c82f7861752ee454a4e3ce616bca73ce580e2b803deea22497de06e5ab49a69af6507ce98ab337312dbb879d258ba2acdf868443f406761caa69404 WHIRLPOOL 55563daa1187e65d13be9d1426488246cf9acf80ba73dd303cb917ce7fe8120a7fe2ea7b5234657676114a6b8148a439fc9c84c8777552c93796164aa46569d9
+DIST emutos-512k-0.9.3.zip 289576 SHA256 2220abe4b75e6f0709327446a5ac553d8365e2e22cc0c57d755085f272fbf5f0 SHA512 5f99f817813e90b65c19753b2cc68a1f1c8652e9a9dbe0d6241503bae2d196c04ef775a68c728e654860772cac8258ae839fa0204657d56d55a112d2a91386de WHIRLPOOL 2a32f2d968a166da64d57518e40cfb228b357a16e9d0ca44750c9e6043de828dd2721e4aec2338d3c1fa19928c56a9730c9aaf29a55d5c060bb8f0b7ee3b54c6
+DIST emutos-512k-0.9.4.zip 314877 SHA256 a8445ce74bf642fecf237953a20641a2e97b74feaadc7fb7149e8221634f4218 SHA512 00c8718f364712f5d346859dc40ed83c1792521c9600520aacf199f7d6b24d5cf7a3e2533e1e343d6aa9e77ed3056f8636713bb7c3e9739254e0658c921a78a8 WHIRLPOOL c5cb35824b4cf5ffa19c27295c9566cfaac65810dcce6791405198b61fb703ed49c6986dbd63eb79a0dfcc8b4b4cb6be64cbd79076d9a2bd1c60a3d469d98add
+DIST emutos-src-0.9.3.tar.gz 935570 SHA256 a22098e732e59d979a34c1131a87bca9701bd26a616df20329286cdcb9c9ed8c SHA512 45e19a9f8ebbd1675059a78d1416d0571bc54c3979b36c684f2394f508f48f6f1dae10f4eb966e1757ff10698644302c788ee3e51bf42fe10d131d87508d9824 WHIRLPOOL 07e2d054c4dd395594e264ebccecacb44479e9981b3f162025b2ebfaa9b5c0c83475bd751c4423f6a7d60bc6701d8205a7898a40f7b8f09dbba0ee0b6c889d05
diff --git a/games-emulation/emutos/emutos-0.9.3.ebuild b/games-emulation/emutos/emutos-0.9.3.ebuild
new file mode 100644
index 000000000000..06de19f0e16a
--- /dev/null
+++ b/games-emulation/emutos/emutos-0.9.3.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit games
+
+DESCRIPTION="a single-user single-tasking operating system for 32 bit Atari computer emulators"
+HOMEPAGE="http://emutos.sourceforge.net"
+SRC_URI="mirror://sourceforge/emutos/emutos-src-0.9.3.tar.gz
+ mirror://sourceforge/emutos/emutos-512k-${PV}.zip
+ mirror://sourceforge/emutos/emutos-256k-${PV}.zip"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE=""
+
+RDEPEND=""
+DEPEND="app-arch/unzip"
+
+S=${WORKDIR}
+
+src_install() {
+ dogameslib */*.img
+ dodoc emutos-512k-${PV}/{readme.txt,doc/{announce,authors,changelog,status}.txt}
+ prepgamesdirs
+}
diff --git a/games-emulation/emutos/emutos-0.9.4.ebuild b/games-emulation/emutos/emutos-0.9.4.ebuild
new file mode 100644
index 000000000000..c0d7b3af4305
--- /dev/null
+++ b/games-emulation/emutos/emutos-0.9.4.ebuild
@@ -0,0 +1,28 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit games
+
+DESCRIPTION="a single-user single-tasking operating system for 32 bit Atari computer emulators"
+HOMEPAGE="http://emutos.sourceforge.net"
+SRC_URI="mirror://sourceforge/emutos/emutos-src-0.9.3.tar.gz
+ mirror://sourceforge/emutos/emutos-512k-${PV}.zip
+ mirror://sourceforge/emutos/emutos-256k-${PV}.zip"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE=""
+
+RDEPEND=""
+DEPEND="app-arch/unzip"
+
+S=${WORKDIR}
+
+src_install() {
+ dogameslib */*.img
+ dodoc emutos-512k-${PV}/{readme.txt,doc/{announce,authors,changelog,status}.txt}
+ prepgamesdirs
+}
diff --git a/games-emulation/emutos/metadata.xml b/games-emulation/emutos/metadata.xml
new file mode 100644
index 000000000000..054700e7f980
--- /dev/null
+++ b/games-emulation/emutos/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <maintainer>
+ <email>mr_bones_@gentoo.org</email>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">emutos</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/fakenes/Manifest b/games-emulation/fakenes/Manifest
new file mode 100644
index 000000000000..15a009b04e81
--- /dev/null
+++ b/games-emulation/fakenes/Manifest
@@ -0,0 +1 @@
+DIST fakenes-0.5.8.tar.bz2 274503 SHA256 0ffe0ddd05bc6b23fc85892d11aef5e1ccb8be4469eafaa859fb19dd34bcca54 SHA512 2a22c51cf7171661a92584e083c3dfd69d009b586c22f8b5a4b4022065309ae4d6370a81997c035a9e19ff225e87d92e1b572b313585f2e05776cbf7c1c971aa WHIRLPOOL 8d3bc785be76c29ababf162fe53608dedd55d9fddc8954189388131334a21a5850067fe04b4c5dfc66f418a61e7c823d2fad6756c4d189d32c160bd93194e70c
diff --git a/games-emulation/fakenes/fakenes-0.5.8-r2.ebuild b/games-emulation/fakenes/fakenes-0.5.8-r2.ebuild
new file mode 100644
index 000000000000..ff62f037592e
--- /dev/null
+++ b/games-emulation/fakenes/fakenes-0.5.8-r2.ebuild
@@ -0,0 +1,79 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils flag-o-matic toolchain-funcs gnome2-utils games
+
+DESCRIPTION="portable, Open Source NES emulator which is written mostly in C"
+HOMEPAGE="http://fakenes.sourceforge.net/"
+SRC_URI="mirror://sourceforge/fakenes/${P}.tar.bz2"
+
+LICENSE="ZLIB"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="openal opengl zlib"
+
+RDEPEND=">=media-libs/allegro-4.4.1.1:0[opengl?]
+ dev-games/hawknl
+ openal? (
+ media-libs/openal
+ media-libs/freealut
+ )
+ zlib? ( sys-libs/zlib )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+src_prepare() {
+ sed -i \
+ -e "s:openal-config:pkg-config openal:" \
+ build/openal.cbd || die
+
+ sed -i \
+ -e "s:LIBAGL = agl:LIBAGL = alleggl:" \
+ build/alleggl.cbd || die
+ epatch "${FILESDIR}"/${P}-{underlink,zlib}.patch
+}
+
+src_compile() {
+ local myconf
+
+ append-ldflags -Wl,-z,noexecstack
+
+ echo "$(tc-getBUILD_CC) cbuild.c -o cbuild"
+ $(tc-getBUILD_CC) cbuild.c -o cbuild || die "cbuild build failed"
+
+ use openal || myconf="$myconf -openal"
+ use opengl || myconf="$myconf -alleggl"
+ use zlib || myconf="$myconf -zlib"
+
+ LD="$(tc-getCC) ${CFLAGS}" ./cbuild ${myconf} --verbose || die "cbuild failed"
+}
+
+src_install() {
+ dogamesbin fakenes
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins support/*
+ dodoc docs/{CHANGES,README}
+ dohtml docs/faq.html
+
+ newicon -s 32 support/icon-32x32.png ${PN}.png
+ make_desktop_entry ${PN} "FakeNES"
+
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ games_pkg_preinst
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+}
diff --git a/games-emulation/fakenes/files/fakenes-0.5.8-underlink.patch b/games-emulation/fakenes/files/fakenes-0.5.8-underlink.patch
new file mode 100644
index 000000000000..a5f6f699fc7c
--- /dev/null
+++ b/games-emulation/fakenes/files/fakenes-0.5.8-underlink.patch
@@ -0,0 +1,8 @@
+--- build/hawknl.cbd.old 2011-06-22 17:28:16.733408930 +0200
++++ build/hawknl.cbd 2011-06-22 17:28:29.217203187 +0200
+@@ -22,4 +22,4 @@
+
+ # --
+
+-LDFLAGS += ' -lNL'
++LDFLAGS += ' -lNL -lm'
diff --git a/games-emulation/fakenes/files/fakenes-0.5.8-zlib.patch b/games-emulation/fakenes/files/fakenes-0.5.8-zlib.patch
new file mode 100644
index 000000000000..15549051a6a5
--- /dev/null
+++ b/games-emulation/fakenes/files/fakenes-0.5.8-zlib.patch
@@ -0,0 +1,170 @@
+diff -ur fakenes-0.5.8-old/src/include/unzip.h fakenes-0.5.8/src/include/unzip.h
+--- fakenes-0.5.8-old/src/include/unzip.h 2012-08-22 20:51:45.310735240 +0200
++++ fakenes-0.5.8/src/include/unzip.h 2012-08-22 20:56:40.737069700 +0200
+@@ -119,9 +119,9 @@
+ tm_unz tmu_date;
+ } unz_file_info;
+
+-extern int ZEXPORT unzStringFileNameCompare OF ((const char* fileName1,
++extern int ZEXPORT unzStringFileNameCompare (const char* fileName1,
+ const char* fileName2,
+- int iCaseSensitivity));
++ int iCaseSensitivity);
+ /*
+ Compare two filename (fileName1,fileName2).
+ If iCaseSenisivity = 1, comparision is case sensitivity (like strcmp)
+@@ -132,7 +132,7 @@
+ */
+
+
+-extern unzFile ZEXPORT unzOpen OF((const char *path));
++extern unzFile ZEXPORT unzOpen (const char *path);
+ /*
+ Open a Zip file. path contain the full pathname (by example,
+ on a Windows NT computer "c:\\zlib\\zlib111.zip" or on an Unix computer
+@@ -143,24 +143,24 @@
+ of this unzip package.
+ */
+
+-extern int ZEXPORT unzClose OF((unzFile file));
++extern int ZEXPORT unzClose (unzFile file);
+ /*
+ Close a ZipFile opened with unzipOpen.
+ If there is files inside the .Zip opened with unzOpenCurrentFile (see later),
+ these files MUST be closed with unzipCloseCurrentFile before call unzipClose.
+ return UNZ_OK if there is no problem. */
+
+-extern int ZEXPORT unzGetGlobalInfo OF((unzFile file,
+- unz_global_info *pglobal_info));
++extern int ZEXPORT unzGetGlobalInfo (unzFile file,
++ unz_global_info *pglobal_info);
+ /*
+ Write info about the ZipFile in the *pglobal_info structure.
+ No preparation of the structure is needed
+ return UNZ_OK if there is no problem. */
+
+
+-extern int ZEXPORT unzGetGlobalComment OF((unzFile file,
++extern int ZEXPORT unzGetGlobalComment (unzFile file,
+ char *szComment,
+- uLong uSizeBuf));
++ uLong uSizeBuf);
+ /*
+ Get the global comment string of the ZipFile, in the szComment buffer.
+ uSizeBuf is the size of the szComment buffer.
+@@ -171,22 +171,22 @@
+ /***************************************************************************/
+ /* Unzip package allow you browse the directory of the zipfile */
+
+-extern int ZEXPORT unzGoToFirstFile OF((unzFile file));
++extern int ZEXPORT unzGoToFirstFile (unzFile file);
+ /*
+ Set the current file of the zipfile to the first file.
+ return UNZ_OK if there is no problem
+ */
+
+-extern int ZEXPORT unzGoToNextFile OF((unzFile file));
++extern int ZEXPORT unzGoToNextFile (unzFile file);
+ /*
+ Set the current file of the zipfile to the next file.
+ return UNZ_OK if there is no problem
+ return UNZ_END_OF_LIST_OF_FILE if the actual file was the latest.
+ */
+
+-extern int ZEXPORT unzLocateFile OF((unzFile file,
++extern int ZEXPORT unzLocateFile (unzFile file,
+ const char *szFileName,
+- int iCaseSensitivity));
++ int iCaseSensitivity);
+ /*
+ Try locate the file szFileName in the zipfile.
+ For the iCaseSensitivity signification, see unzStringFileNameCompare
+@@ -197,14 +197,14 @@
+ */
+
+
+-extern int ZEXPORT unzGetCurrentFileInfo OF((unzFile file,
++extern int ZEXPORT unzGetCurrentFileInfo (unzFile file,
+ unz_file_info *pfile_info,
+ char *szFileName,
+ uLong fileNameBufferSize,
+ void *extraField,
+ uLong extraFieldBufferSize,
+ char *szComment,
+- uLong commentBufferSize));
++ uLong commentBufferSize);
+ /*
+ Get Info about the current file
+ if pfile_info!=NULL, the *pfile_info structure will contain somes info about
+@@ -223,22 +223,22 @@
+ from it, and close it (you can close it before reading all the file)
+ */
+
+-extern int ZEXPORT unzOpenCurrentFile OF((unzFile file));
++extern int ZEXPORT unzOpenCurrentFile (unzFile file);
+ /*
+ Open for reading data the current file in the zipfile.
+ If there is no error, the return value is UNZ_OK.
+ */
+
+-extern int ZEXPORT unzCloseCurrentFile OF((unzFile file));
++extern int ZEXPORT unzCloseCurrentFile (unzFile file);
+ /*
+ Close the file in zip opened with unzOpenCurrentFile
+ Return UNZ_CRCERROR if all the file was read but the CRC is not good
+ */
+
+
+-extern int ZEXPORT unzReadCurrentFile OF((unzFile file,
++extern int ZEXPORT unzReadCurrentFile (unzFile file,
+ voidp buf,
+- unsigned len));
++ unsigned len);
+ /*
+ Read bytes from the current file (opened by unzOpenCurrentFile)
+ buf contain buffer where data must be copied
+@@ -250,19 +250,19 @@
+ (UNZ_ERRNO for IO error, or zLib error for uncompress error)
+ */
+
+-extern z_off_t ZEXPORT unztell OF((unzFile file));
++extern z_off_t ZEXPORT unztell (unzFile file);
+ /*
+ Give the current position in uncompressed data
+ */
+
+-extern int ZEXPORT unzeof OF((unzFile file));
++extern int ZEXPORT unzeof (unzFile file);
+ /*
+ return 1 if the end of file was reached, 0 elsewhere
+ */
+
+-extern int ZEXPORT unzGetLocalExtrafield OF((unzFile file,
++extern int ZEXPORT unzGetLocalExtrafield (unzFile file,
+ voidp buf,
+- unsigned len));
++ unsigned len);
+ /*
+ Read extra field from the current file (opened by unzOpenCurrentFile)
+ This is the local-header version of the extra field (sometimes, there is
+diff -ur fakenes-0.5.8-old/src/unzip.c fakenes-0.5.8/src/unzip.c
+--- fakenes-0.5.8-old/src/unzip.c 2012-08-22 20:51:45.300735366 +0200
++++ fakenes-0.5.8/src/unzip.c 2012-08-22 20:57:42.596243769 +0200
+@@ -500,7 +500,7 @@
+ /*
+ Get Info about the current file in the zipfile, with internal only info
+ */
+-local int unzlocal_GetCurrentFileInfoInternal OF((unzFile file,
++local int unzlocal_GetCurrentFileInfoInternal (unzFile file,
+ unz_file_info *pfile_info,
+ unz_file_info_internal
+ *pfile_info_internal,
+@@ -509,7 +509,7 @@
+ void *extraField,
+ uLong extraFieldBufferSize,
+ char *szComment,
+- uLong commentBufferSize));
++ uLong commentBufferSize);
+
+ local int unzlocal_GetCurrentFileInfoInternal (file,
+ pfile_info,
diff --git a/games-emulation/fakenes/metadata.xml b/games-emulation/fakenes/metadata.xml
new file mode 100644
index 000000000000..590648f50af5
--- /dev/null
+++ b/games-emulation/fakenes/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">fakenes</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/fbzx/Manifest b/games-emulation/fbzx/Manifest
new file mode 100644
index 000000000000..6fc69fbcd565
--- /dev/null
+++ b/games-emulation/fbzx/Manifest
@@ -0,0 +1 @@
+DIST fbzx-2.10.0.tar.bz2 326352 SHA256 deed3d37247e4154bb10325d014461c8caf0c55ca23a611c62035e491a4f960f SHA512 b96ae4029e4ef73d15c851a54c8e057131ba6e0acf03820222aa4d4bc91e8ad497556cce41c5faef230939f1c88423e09e435f9ce91c0e0f183f6eac7843bb36 WHIRLPOOL 97bb0fcbb9d1c5921b7c6f9d4873fd620d2219b71abbaece2453f4417bace91c1b1fab44382f2d63b5aa8c3225f5f865150b51ce534a228712a39543912ea908
diff --git a/games-emulation/fbzx/fbzx-2.10.0.ebuild b/games-emulation/fbzx/fbzx-2.10.0.ebuild
new file mode 100644
index 000000000000..3dfff4c8a209
--- /dev/null
+++ b/games-emulation/fbzx/fbzx-2.10.0.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils games
+
+DESCRIPTION="A Sinclair Spectrum emulator, designed to work at full screen using the FrameBuffer"
+HOMEPAGE="http://www.rastersoft.com/fbzx.html"
+SRC_URI="http://www.rastersoft.com/descargas/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE=""
+
+RDEPEND="media-libs/libsdl[video]
+ media-sound/pulseaudio
+ media-libs/alsa-lib"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+src_prepare() {
+ sed -i -e "s|/usr/share/|${GAMES_DATADIR}/${PN}/|g" emulator.c || die
+ epatch \
+ "${FILESDIR}"/${P}-build.patch \
+ "${FILESDIR}"/${P}-keyboard.patch
+}
+
+src_install() {
+ dogamesbin fbzx
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins -r keymap.bmp spectrum-roms
+ dodoc AMSTRAD CAPABILITIES FAQ PORTING README* TODO VERSIONS
+ doicon fbzx.svg
+ make_desktop_entry fbzx FBZX
+ prepgamesdirs
+}
diff --git a/games-emulation/fbzx/files/fbzx-2.10.0-build.patch b/games-emulation/fbzx/files/fbzx-2.10.0-build.patch
new file mode 100644
index 000000000000..191e7f09ac1e
--- /dev/null
+++ b/games-emulation/fbzx/files/fbzx-2.10.0-build.patch
@@ -0,0 +1,12 @@
+diff -ru fbzx-2.10.0.orig/Makefile fbzx-2.10.0/Makefile
+--- fbzx-2.10.0.orig/Makefile 2012-06-22 19:44:32.000000000 -0400
++++ fbzx-2.10.0/Makefile 2012-08-11 03:08:12.761127099 -0400
+@@ -4,7 +4,7 @@
+ PREFIX2=/usr/local
+ endif
+
+-CFLAGS += `pkg-config --cflags sdl libpulse-simple alsa` -O2 -Wno-pointer-sign -Wall -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
++CFLAGS += `pkg-config --cflags sdl libpulse-simple alsa` -Wno-pointer-sign -Wall -D D_SOUND_PULSE -D D_SOUND_ALSA -D D_SOUND_OSS
+ LDFLAGS += `pkg-config --libs sdl libpulse-simple alsa`
+
+ fbzx: computer.o Z80free.o Z80free_codes.o Z80free_codesCB.o Z80free_codesED.o Z80free_codesDD.o Z80free_codesFD.o Z80free_codesDDCB.o Z80free_codesFDCB.o emulator.o cargador.o characters.o menus.o sound.o tape.o spk_ay.o microdrive.o
diff --git a/games-emulation/fbzx/files/fbzx-2.10.0-keyboard.patch b/games-emulation/fbzx/files/fbzx-2.10.0-keyboard.patch
new file mode 100644
index 000000000000..3920748c07e9
--- /dev/null
+++ b/games-emulation/fbzx/files/fbzx-2.10.0-keyboard.patch
@@ -0,0 +1,11 @@
+--- menus.c.orig
++++ menus.c
+@@ -1820,7 +1820,7 @@
+ buffer=screen->pixels;
+
+ clean_screen();
+- fichero=myfopen("fbzx/keymap.bmp","r");
++ fichero=myfopen("keymap.bmp","r");
+ if (fichero==NULL) {
+ strcpy(ordenador.osd_text,"Keymap picture not found");
+ ordenador.osd_time=100;
diff --git a/games-emulation/fbzx/metadata.xml b/games-emulation/fbzx/metadata.xml
new file mode 100644
index 000000000000..b2e8a5cecf47
--- /dev/null
+++ b/games-emulation/fbzx/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <longdescription>
+ FBZX is a Sinclair Spectrum emulator, designed to work at full screen
+ using the FrameBuffer.
+ </longdescription>
+</pkgmetadata>
diff --git a/games-emulation/fceux/Manifest b/games-emulation/fceux/Manifest
new file mode 100644
index 000000000000..1db9abeaccb9
--- /dev/null
+++ b/games-emulation/fceux/Manifest
@@ -0,0 +1 @@
+DIST fceux-2.2.2.src.tar.gz 9249858 SHA256 804d11bdb4a195f3a580ce5d2d01be877582763378637e16186a22459f5fe5e1 SHA512 3d3b11c21232656492d962c21a93097f66e33fbd5adbbce6b771dc004393f30502c369eae83c23d988c7e447b4784740a10dfcb0811252854d4364c4b1face98 WHIRLPOOL 61d12dd5db761d31ae83dcfc3117538313910cf844e502457326503d966ac38ca69e7c90d696da991394dd67a0b115f2b0698c217b5a077ed1c3ec9649508ff8
diff --git a/games-emulation/fceux/fceux-2.2.2.ebuild b/games-emulation/fceux/fceux-2.2.2.ebuild
new file mode 100644
index 000000000000..0a3cbb5cd715
--- /dev/null
+++ b/games-emulation/fceux/fceux-2.2.2.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils scons-utils games
+
+DESCRIPTION="A portable Famicom/NES emulator, an evolution of the original FCE Ultra"
+HOMEPAGE="http://fceux.com/"
+SRC_URI="mirror://sourceforge/fceultra/${P}.src.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="gtk +lua +opengl"
+
+DEPEND="lua? ( dev-lang/lua:0 )
+ media-libs/libsdl[opengl?,video]
+ opengl? ( virtual/opengl )
+ gtk? ( x11-libs/gtk+:3 )
+ sys-libs/zlib[minizip]"
+RDEPEND=${DEPEND}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-warnings.patch
+}
+
+src_compile() {
+ escons \
+ GTK=0 \
+ CREATE_AVI=1 \
+ SYSTEM_LUA=1 \
+ SYSTEM_MINIZIP=1 \
+ $(use_scons gtk GTK3) \
+ $(use_scons opengl OPENGL) \
+ $(use_scons lua LUA)
+}
+
+src_install() {
+ dogamesbin bin/fceux
+
+ doman documentation/fceux.6
+ docompress -x /usr/share/doc/${PF}/documentation /usr/share/doc/${PF}/fceux.chm
+ dodoc -r Authors changelog.txt TODO-SDL bin/fceux.chm documentation
+ rm -f "${D}/usr/share/doc/${PF}/documentation/fceux.6"
+ make_desktop_entry fceux FCEUX
+ doicon fceux.png
+ prepgamesdirs
+}
diff --git a/games-emulation/fceux/files/fceux-2.2.2-warnings.patch b/games-emulation/fceux/files/fceux-2.2.2-warnings.patch
new file mode 100644
index 000000000000..f0af4631abda
--- /dev/null
+++ b/games-emulation/fceux/files/fceux-2.2.2-warnings.patch
@@ -0,0 +1,33 @@
+diff -ru fceux-2.2.2.orig/src/input.cpp fceux-2.2.2/src/input.cpp
+--- fceux-2.2.2.orig/src/input.cpp 2013-06-15 15:44:11.000000000 -0400
++++ fceux-2.2.2/src/input.cpp 2014-12-31 01:32:46.302001912 -0500
+@@ -1161,7 +1161,7 @@
+ // FIXME this will always evaluate to true, should this be
+ // if (*lastSavestateMade...) to check if it holds a string or just
+ // a '\0'?
+- if (lastSavestateMade && (undoSS || redoSS))
++ if (*lastSavestateMade && (undoSS || redoSS))
+ SwapSaveState();
+ }
+
+diff -ru fceux-2.2.2.orig/src/state.cpp fceux-2.2.2/src/state.cpp
+--- fceux-2.2.2.orig/src/state.cpp 2013-09-18 19:03:59.000000000 -0400
++++ fceux-2.2.2/src/state.cpp 2014-12-31 01:33:11.453155054 -0500
+@@ -1048,7 +1048,7 @@
+ //Both files must exist
+ //--------------------------------------------------------------------------------------------
+
+- if (!lastSavestateMade)
++ if (!*lastSavestateMade)
+ {
+ FCEUI_DispMessage("Can't Undo",0);
+ FCEUI_printf("Undo savestate was attempted but unsuccessful because there was not a recently used savestate.\n");
+@@ -1153,7 +1153,7 @@
+ void RedoLoadState()
+ {
+ if (!redoLS) return;
+- if (lastLoadstateMade && redoLS)
++ if (*lastLoadstateMade && redoLS)
+ {
+ FCEUSS_Load(lastLoadstateMade);
+ FCEUI_printf("Redoing %s\n",lastLoadstateMade);
diff --git a/games-emulation/fceux/metadata.xml b/games-emulation/fceux/metadata.xml
new file mode 100644
index 000000000000..ee1fe81755b2
--- /dev/null
+++ b/games-emulation/fceux/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">fceultra</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/gambatte/Manifest b/games-emulation/gambatte/Manifest
new file mode 100644
index 000000000000..fbddf3aade06
--- /dev/null
+++ b/games-emulation/gambatte/Manifest
@@ -0,0 +1 @@
+DIST gambatte-0.5.0_p20131102.tar.xz 353212 SHA256 894040f47f3f5cc6e320d7ee9ac5370fb4301261ceee535c5e4ae5550f0e9ff0 SHA512 9f27af85d2fceb128231eb3e5bf2806a1773c575990296f37eb3c0a14bca5c72f7f161cdf77f710f4ff85b2b3266db9ba098e5ef6772bc5bf7b2c97b8281999b WHIRLPOOL 4ec8bc24bc3d5a443b2b938d8ed6d7164770d7788abc5251639b40f12417989185fa8cfa36abadb0c19fae34937411ad63f4fffa17f4ccecd39f37ace4e03c33
diff --git a/games-emulation/gambatte/gambatte-0.5.0_p20131102.ebuild b/games-emulation/gambatte/gambatte-0.5.0_p20131102.ebuild
new file mode 100644
index 000000000000..031be7d22e79
--- /dev/null
+++ b/games-emulation/gambatte/gambatte-0.5.0_p20131102.ebuild
@@ -0,0 +1,98 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit scons-utils qt4-r2 games
+
+DESCRIPTION="An accuracy-focused Gameboy / Gameboy Color emulator"
+HOMEPAGE="http://sourceforge.net/projects/gambatte"
+SRC_URI="http://dev.gentoo.org/~hasufell/distfiles/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="qt4 +sdl"
+REQUIRED_USE="|| ( qt4 sdl )"
+
+RDEPEND="
+ sys-libs/zlib
+ qt4? (
+ dev-qt/qtcore:4
+ dev-qt/qtgui:4
+ dev-qt/qtopengl:4
+ media-libs/alsa-lib
+ x11-libs/libX11
+ x11-libs/libXext
+ x11-libs/libXrandr
+ x11-libs/libXv
+ )
+ sdl? ( media-libs/libsdl[X,sound,joystick,video] )"
+DEPEND="${RDEPEND}
+ app-arch/xz-utils"
+
+fix_scons() {
+ local i
+ for i; do
+ cat >> $i << END
+import os
+import SCons.Util
+
+if os.environ.has_key('AR'):
+ env['AR'] = os.environ['AR']
+if os.environ.has_key('RANLIB'):
+ env['RANLIB'] = os.environ['RANLIB']
+if os.environ.has_key('CC'):
+ env['CC'] = os.environ['CC']
+if os.environ.has_key('CFLAGS'):
+ env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
+if os.environ.has_key('CXX'):
+ env['CXX'] = os.environ['CXX']
+if os.environ.has_key('CXXFLAGS'):
+ env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
+if os.environ.has_key('CPPFLAGS'):
+ env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CPPFLAGS'])
+if os.environ.has_key('LDFLAGS'):
+ env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
+END
+ done
+}
+
+src_prepare() {
+ # Fix zlib/minizip build error
+ sed -i \
+ -e '1i#define OF(x) x' \
+ libgambatte/src/file/unzip/{unzip,ioapi}.h \
+ || die "sed iompi.h failed"
+
+ fix_scons {gambatte_sdl,libgambatte}/SConstruct
+}
+
+src_compile() {
+ # build core library
+ cd "${S}"/libgambatte || die
+ escons
+
+ # build sdl frontend
+ if use sdl; then
+ cd "${S}"/gambatte_sdl || die
+ escons
+ fi
+
+ # build qt frontend
+ if use qt4; then
+ cd "${S}"/gambatte_qt || die
+ eqmake4 ${PN}_qt.pro
+ emake
+ fi
+}
+
+src_install() {
+ use sdl && dogamesbin gambatte_sdl/gambatte_sdl
+ use qt4 && dogamesbin gambatte_qt/bin/gambatte_qt
+
+ dodoc README changelog
+
+ prepgamesdirs
+}
diff --git a/games-emulation/gambatte/metadata.xml b/games-emulation/gambatte/metadata.xml
new file mode 100644
index 000000000000..cad5a2aa1773
--- /dev/null
+++ b/games-emulation/gambatte/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/gcube/Manifest b/games-emulation/gcube/Manifest
new file mode 100644
index 000000000000..be0bc7dbc11e
--- /dev/null
+++ b/games-emulation/gcube/Manifest
@@ -0,0 +1 @@
+DIST gcube-0.4-src.tar.bz2 803503 SHA256 e2fe9b198ea627ec6b1be98b06a620d1f32f373c94161ea042319dbf6cb10418 SHA512 f73665386d547322f20ed5e358f4f394b07d74fd90bddbfe1158a7a5d896bff36dabc9833f2d820a7af7673b8c8af62490f7fa07b06a2bbca4df6356a1e3c91a WHIRLPOOL d36dbe8aff85acfdd8ab7faec11c452fff8a74b8aea2c7dbaa824a8308c89474e30d2b49fef20048ea773c0406550808717eeffba1a3c8b13f01931c0365e63f
diff --git a/games-emulation/gcube/files/gcube-0.4-gcc47.patch b/games-emulation/gcube/files/gcube-0.4-gcc47.patch
new file mode 100644
index 000000000000..b459a4e24034
--- /dev/null
+++ b/games-emulation/gcube/files/gcube-0.4-gcc47.patch
@@ -0,0 +1,10 @@
+--- Makefile.rules.old 2012-10-23 14:06:54.417782365 +0200
++++ Makefile.rules 2012-10-23 14:07:11.516377033 +0200
+@@ -1,6 +1,6 @@
+
+ SDL_CONFIG=sdl-config
+-LIBS=`$(SDL_CONFIG) --libs` -mno-windows -mcygwin -lz -l$(OPENGL) -lm
++LIBS=`$(SDL_CONFIG) --libs` -lz -l$(OPENGL) -lm
+
+ PROFLAGS=-g -Wall -pg -fprofile-arcs -ftest-coverage
+ OPTFLAGS=-O3 -fno-strict-aliasing -fomit-frame-pointer -ffast-math -march=$(CPU) $(OPTIMIZE)
diff --git a/games-emulation/gcube/files/gcube-0.4-ldflags.patch b/games-emulation/gcube/files/gcube-0.4-ldflags.patch
new file mode 100644
index 000000000000..169472ee1851
--- /dev/null
+++ b/games-emulation/gcube/files/gcube-0.4-ldflags.patch
@@ -0,0 +1,30 @@
+--- Makefile.rules.old 2010-10-01 07:16:16.000000000 +0200
++++ Makefile.rules 2010-10-01 07:18:04.000000000 +0200
+@@ -88,22 +88,22 @@
+ profiler: default
+
+ gcube: $(OBJECTS) gcube.o
+- $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
++ $(CC) $(LDFLAGS) $(CFLAGS) $^ -o $@ $(LIBS)
+
+ gcubedbg: $(OBJECTS) gcubedbg.o cpu_dbg.o
+ $(CC) $(CFLAGS) $^ -o $@ $(LIBS)
+
+ bin2dol: bin2dol.c general.o
+- $(CC) $(CFLAGS) $^ -o $@
++ $(CC) $(LDFLAGS) $(CFLAGS) $^ -o $@
+
+ tplx: tplx.o general.o
+- $(CC) $(CFLAGS) $^ -o $@
++ $(CC) $(LDFLAGS) $(CFLAGS) $^ -o $@
+
+ thpview: thpview.o general.o jpeg_tools.o
+- $(CC) $(CFLAGS) `$(SDL_CONFIG) --cflags` $^ -o $@ -ljpeg `$(SDL_CONFIG) --libs`
++ $(CC) $(LDFLAGS) $(CFLAGS) `$(SDL_CONFIG) --cflags` $^ -o $@ -ljpeg `$(SDL_CONFIG) --libs`
+
+ isopack: isopack.o general.o
+- $(CC) $(CFLAGS) $^ -o $@ -lz
++ $(CC) $(LDFLAGS) $(CFLAGS) $^ -o $@ -lz
+
+ ppc_disasm.o: ppc_disasm.c
+ $(CC) -g -c -o $@ $<
diff --git a/games-emulation/gcube/files/gcube-0.4-underlink.patch b/games-emulation/gcube/files/gcube-0.4-underlink.patch
new file mode 100644
index 000000000000..f1cff91cb158
--- /dev/null
+++ b/games-emulation/gcube/files/gcube-0.4-underlink.patch
@@ -0,0 +1,10 @@
+--- Makefile.rules.old 2011-06-10 14:14:08.372105234 +0200
++++ Makefile.rules 2011-06-10 14:14:18.504746649 +0200
+@@ -1,6 +1,6 @@
+
+ SDL_CONFIG=sdl-config
+-LIBS=`$(SDL_CONFIG) --libs` -mno-windows -mcygwin -lz -l$(OPENGL)
++LIBS=`$(SDL_CONFIG) --libs` -mno-windows -mcygwin -lz -l$(OPENGL) -lm
+
+ PROFLAGS=-g -Wall -pg -fprofile-arcs -ftest-coverage
+ OPTFLAGS=-O3 -fno-strict-aliasing -fomit-frame-pointer -ffast-math -march=$(CPU) $(OPTIMIZE)
diff --git a/games-emulation/gcube/gcube-0.4-r1.ebuild b/games-emulation/gcube/gcube-0.4-r1.ebuild
new file mode 100644
index 000000000000..4aa39cbfa4c4
--- /dev/null
+++ b/games-emulation/gcube/gcube-0.4-r1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils games
+
+DESCRIPTION="Gamecube emulator"
+HOMEPAGE="http://gcube.exemu.net/"
+SRC_URI="http://gcube.exemu.net/downloads/${P}-src.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE=""
+
+DEPEND="virtual/opengl
+ media-libs/libsdl[sound,joystick,video]
+ virtual/jpeg:0
+ sys-libs/ncurses
+ sys-libs/zlib"
+RDEPEND="${DEPEND}"
+
+S=${WORKDIR}/${PV}
+
+src_prepare() {
+ sed -i \
+ -e '/^CFLAGS=-g/d' Makefile.rules \
+ || die "sed failed"
+ epatch "${FILESDIR}"/${P}-ldflags.patch \
+ "${FILESDIR}"/${P}-underlink.patch \
+ "${FILESDIR}"/${P}-gcc47.patch
+}
+
+src_install() {
+ local x
+
+ dogamesbin gcmap gcube
+ for x in bin2dol isopack thpview tplx ; do
+ newgamesbin ${x} ${PN}-${x}
+ done
+ dodoc ChangeLog README
+ prepgamesdirs
+}
diff --git a/games-emulation/gcube/metadata.xml b/games-emulation/gcube/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/gcube/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/generator/Manifest b/games-emulation/generator/Manifest
new file mode 100644
index 000000000000..28137ed91b4b
--- /dev/null
+++ b/games-emulation/generator/Manifest
@@ -0,0 +1 @@
+DIST generator-0.35-cbiere-r4.tar.bz2 435289 SHA256 54f3a94ed441cfd05d66e7730126c65287f3c1503f13987653c6db84739a79b6 SHA512 73fd36d8004135c172025b3eb3385f731e294935413d7ac905672f1a88434ca332325821c5f15d5ae83fb1385fcde9f1e7f32242f8ac175bb96bd535b5d91620 WHIRLPOOL 446345f838f6c79a31434eda2bb29ff8169036dc6fb26ee11b7adcdb4e7932c62f02fdb468c7a5125b0245b1eae6ffad34ec0d239702e5e1d975504efb7d190b
diff --git a/games-emulation/generator/files/generator-0.35_p4-configure.patch b/games-emulation/generator/files/generator-0.35_p4-configure.patch
new file mode 100644
index 000000000000..72ed087bd296
--- /dev/null
+++ b/games-emulation/generator/files/generator-0.35_p4-configure.patch
@@ -0,0 +1,94 @@
+--- configure.ac.original 2008-03-17 13:07:48.000000000 -0400
++++ configure.ac 2008-03-17 13:08:03.000000000 -0400
+@@ -28,15 +28,12 @@
+ AC_ARG_WITH(tcltk,
+ AS_HELP_STRING(--with-tcltk,Create tcltk version),
+ MY_PROG="generator-tcltk")
+- AC_ARG_WITH(gtk,
+- AS_HELP_STRING(--with-gtk,Create gtk version),
+- MY_PROG="generator-gtk")
+ AC_ARG_WITH(sdl,
+ AS_HELP_STRING(--with-sdl,Create SDL version),
+ [MY_PROG="generator-sdl"; USE_SDL_AUDIO=yes])
+ if [[ "x$MY_PROG" = "x" ]]; then
+ AC_MSG_ERROR(You must select a user interface type:
+- svgalib allegro tcltk gtk sdl)
++ svgalib allegro tcltk sdl)
+ fi
+ if [[ "x$MY_PROG" = "xgenerator-allegro" ]]; then
+ AC_DEFINE(ALLEGRO, 1, [Allegro version])
+@@ -202,50 +199,6 @@
+ CFLAGS="$CFLAGS -Wstrict-prototypes -Wunused"
+ fi
+ fi
+- if [[ "x$DEBUG" != "xno" ]]; then
+- AC_MSG_RESULT(Turning on debug flags)
+- CFLAGS="$CFLAGS -g -O"
+- optimum=no
+- else
+- if [[ "x$GCCVER" != "xno" ]]; then
+- AC_MSG_RESULT(Turning on gcc optimisations)
+- CFLAGS="$CFLAGS -O3 -fomit-frame-pointer"
+- if [[ "x$GCCVER" = "x3" ]]; then
+- AC_MSG_RESULT(Turning on gcc 3 optimisations)
+- CFLAGS="$CFLAGS -fno-math-errno"
+- fi
+- case "$CFLAGS" in
+- *mcpu*|*march*) AC_MSG_RESULT(Skipping target optimisations)
+- ;;
+- *) case "$target_cpu" in
+- i386) AC_MSG_RESULT(Turning on i386 optimisations)
+- CFLAGS="$CFLAGS -march=i386 -ffast-math"
+- ;;
+- i486) AC_MSG_RESULT(Turning on i486 optimisations)
+- CFLAGS="$CFLAGS -march=i486 -ffast-math"
+- ;;
+- i586) AC_MSG_RESULT(Turning on pentium optimisations)
+- # cannot do malign-double as we link to other libraries and
+- # it would break binary compatibility
+- CFLAGS="$CFLAGS -march=pentium -ffast-math"
+- ;;
+- i?86) AC_MSG_RESULT(Turning on i686 optimisations)
+- # cannot do malign-double as we link to other libraries and
+- # it would break binary compatibility
+- CFLAGS="$CFLAGS -march=i686 -ffast-math"
+- ;;
+- alpha*) AC_MSG_RESULT(Adding -mieee for Alpha)
+- CFLAGS="$CFLAGS -mieee"
+- ;;
+- *) AC_MSG_RESULT(Sorry unknown target CPU)
+- ;;
+- esac
+- esac
+- else
+- AC_MSG_WARN(You did not opt for gcc optimisations!)
+- optimum=no
+- fi
+- fi
+ AC_CHECK_LIB(jpeg, jpeg_start_compress,
+ [ MY_LIBS="-ljpeg $MY_LIBS"; AC_DEFINE(JPEG, 1, [JPEG features]) ])
+
+@@ -272,14 +225,7 @@
+
+ AC_PATH_XTRA
+
+- if [[ "x$MY_PROG" = "xgenerator-gtk" ]]; then
+- MY_SUBDIRS="glade gtkopts $MY_SUBDIRS"
+- AM_PATH_GTK(1.2.10,,AC_MSG_ERROR(Generator needs gtk 1.2.10 or later))
+- AM_PATH_SDL(1.2.6,,AC_MSG_ERROR(Generator needs sdk 1.2.6 or later))
+-
+- MY_LIBS="$MY_LIBS $X_PRE_LIBS $X_LIBS $X_EXTRA_LIBS"
+- CFLAGS="$CFLAGS $X_CFLAGS"
+- elif [[ "x$MY_PROG" = "xgenerator-sdl" ]]; then
++ if [[ "x$MY_PROG" = "xgenerator-sdl" ]]; then
+ MY_SUBDIRS="gtkopts $MY_SUBDIRS"
+ AM_PATH_SDL(1.2.6,,AC_MSG_ERROR(Generator needs sdk 1.2.6 or later))
+
+@@ -305,6 +251,7 @@
+ AC_CHECK_SIZEOF(unsigned long, 4)
+ AC_CHECK_SIZEOF(unsigned long long, 8)
+ AC_CHECK_HEADERS(sys/param.h)
++ AC_CHECK_HEADERS(sys/time.h)
+ AC_CHECK_HEADERS(bzlib.h)
+ AC_CHECK_HEADERS(zlib.h)
+ AC_CHECK_HEADERS(tcl8.0.h)
diff --git a/games-emulation/generator/files/generator-0.35_p4-execstacks.patch b/games-emulation/generator/files/generator-0.35_p4-execstacks.patch
new file mode 100644
index 000000000000..f92ef6121f5a
--- /dev/null
+++ b/games-emulation/generator/files/generator-0.35_p4-execstacks.patch
@@ -0,0 +1,12 @@
+--- raze/Makefile.am.old 2006-09-03 03:17:39.000000000 +0200
++++ raze/Makefile.am 2006-09-03 03:16:36.000000000 +0200
+@@ -343,6 +343,10 @@
+ raze: raze.o
+ raze.o: raze.asm raze.reg
+ nasm -e raze.asm -o raze2.asm
++ echo "%ifidn __OUTPUT_FORMAT__,elf" >> raze2.asm
++ echo "section .note.GNU-stack noalloc noexec nowrite progbits" \
++ >> raze2.asm
++ echo "%endif" >> raze2.asm
+ nasm -f @ASMOUTPUT@ raze2.asm -o raze.o -praze.reg
+
diff --git a/games-emulation/generator/files/generator-0.35_p4-underlink.patch b/games-emulation/generator/files/generator-0.35_p4-underlink.patch
new file mode 100644
index 000000000000..964a6bea0883
--- /dev/null
+++ b/games-emulation/generator/files/generator-0.35_p4-underlink.patch
@@ -0,0 +1,11 @@
+--- main/Makefile.am.old 2011-06-20 21:35:25.832460030 +0200
++++ main/Makefile.am 2011-06-20 21:36:29.490503981 +0200
+@@ -7,7 +7,7 @@
+ bin_PROGRAMS = @PROGRAM@
+ EXTRA_PROGRAMS = generator-svgalib generator-tcltk generator-allegro \
+ generator-gtk generator-sdl
+-LDADD = ../cpu68k/lib68k.a ../ym2612/libym2612.a @MY_LIBS@ \
++LDADD = ../cpu68k/lib68k.a ../ym2612/libym2612.a @MY_LIBS@ -lm \
+ ../sn76496/libsn76496.a
+
+ ## this should be generator_tcltk_DATA but it won't let me do that
diff --git a/games-emulation/generator/generator-0.35_p4.ebuild b/games-emulation/generator/generator-0.35_p4.ebuild
new file mode 100644
index 000000000000..03e2cf9e0ff6
--- /dev/null
+++ b/games-emulation/generator/generator-0.35_p4.ebuild
@@ -0,0 +1,52 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit autotools eutils toolchain-funcs games
+
+MY_P=${PN}-${PV/_p/-cbiere-r}
+DESCRIPTION="Sega Genesis / Mega Drive emulator"
+HOMEPAGE="http://www.squish.net/generator/"
+SRC_URI="http://www.squish.net/generator/cbiere/generator/${MY_P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="+sdlaudio"
+
+DEPEND="virtual/jpeg:0
+ media-libs/libsdl[joystick,video]
+ sdlaudio? ( media-libs/libsdl[sound] )"
+RDEPEND=${DEPEND}
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-configure.patch \
+ "${FILESDIR}"/${P}-underlink.patch
+
+ sed -i -e 's/@GTK_CFLAGS@//g' main/Makefile.am || die
+ eautoreconf
+}
+
+src_configure() {
+ egamesconf \
+ --with-cmz80 \
+ --with-sdl \
+ --without-tcltk \
+ --with-gcc=$(gcc-major-version) \
+ $(use_with sdlaudio sdl-audio)
+}
+
+src_compile() {
+ [[ -f Makefile ]] && emake clean
+ emake -j1
+}
+
+src_install() {
+ dogamesbin main/generator-sdl
+ dodoc AUTHORS ChangeLog NEWS README TODO docs/*
+ prepgamesdirs
+}
diff --git a/games-emulation/generator/metadata.xml b/games-emulation/generator/metadata.xml
new file mode 100644
index 000000000000..b21068e12a9f
--- /dev/null
+++ b/games-emulation/generator/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <use>
+ <flag name="sdlaudio">Enable SDL Audio</flag>
+ </use>
+</pkgmetadata>
diff --git a/games-emulation/gens/Manifest b/games-emulation/gens/Manifest
new file mode 100644
index 000000000000..cddcd82f90ba
--- /dev/null
+++ b/games-emulation/gens/Manifest
@@ -0,0 +1 @@
+DIST gens-2.15.5.tar.gz 741852 SHA256 51910d3056da9ffbb2c01cfec064998c9a4cad0cb379d703ec1b93c83dba305a SHA512 7163f6a1e09bac420e0e4aa0f8f3ed255406d9aff3cc7366c40226e7fece78baca5428d0fe87daf0f12f6e10b428477a795b54d008db5e3dcbf7692ed9d9fe7d WHIRLPOOL 282cced72eea63eb01b22612c5c40a4dc412b27d1fa3215a59da33a33541003172d57d442bced4d74cef89c3f3c443d2e7ca8cbd670a559a5cd8a3fc88b74696
diff --git a/games-emulation/gens/files/gens-2.15.5-as-needed.patch b/games-emulation/gens/files/gens-2.15.5-as-needed.patch
new file mode 100644
index 000000000000..02aed32b802c
--- /dev/null
+++ b/games-emulation/gens/files/gens-2.15.5-as-needed.patch
@@ -0,0 +1,11 @@
+--- configure.old 2009-02-04 14:41:40.000000000 +0100
++++ configure 2009-02-04 14:48:52.000000000 +0100
+@@ -4929,7 +4929,7 @@
+ { echo "$as_me:$LINENO: result: $with_opengl" >&5
+ echo "${ECHO_T}$with_opengl" >&6; }
+ if test x$with_opengl = xyes; then
+- LDFLAGS="$LDFLAGS -lGL"
++ LIBS="$LIBS -lGL"
+
+ fi
+ fi
diff --git a/games-emulation/gens/files/gens-2.15.5-gcc34.patch b/games-emulation/gens/files/gens-2.15.5-gcc34.patch
new file mode 100644
index 000000000000..cb81be76e385
--- /dev/null
+++ b/games-emulation/gens/files/gens-2.15.5-gcc34.patch
@@ -0,0 +1,46 @@
+from http://sourceforge.net/p/gens/patches/25/
+
+--- gens.orig/src/gens/gens_core/cpu/68k/cpu_68k.c 2004-05-22 09:02:12.000000000 -0700
++++ gens/src/gens/gens_core/cpu/68k/cpu_68k.c 2005-03-21 10:52:24.000000000 -0800
+@@ -24,9 +24,9 @@
+
+ struct STARSCREAM_PROGRAMREGION M68K_Fetch[] = {
+ {0x000000, 0x3FFFFF, (unsigned) 0x000000},
+- {0xFF0000, 0xFFFFFF, (unsigned) &Ram_68k[0] - 0xFF0000},
+- {0xF00000, 0xF0FFFF, (unsigned) &Ram_68k[0] - 0xF00000},
+- {0xEF0000, 0xEFFFFF, (unsigned) &Ram_68k[0] - 0xEF0000},
++ {0xFF0000, 0xFFFFFF, (unsigned) NULL},
++ {0xF00000, 0xF0FFFF, (unsigned) NULL},
++ {0xEF0000, 0xEFFFFF, (unsigned) NULL},
+ {-1, -1, (unsigned) NULL},
+ {-1, -1, (unsigned) NULL},
+ {-1, -1, (unsigned) NULL}
+@@ -60,7 +60,7 @@
+
+
+ struct STARSCREAM_PROGRAMREGION S68K_Fetch[] = {
+- {0x000000, 0x07FFFF, (unsigned) &Ram_Prg[0]},
++ {0x000000, 0x07FFFF, (unsigned) NULL},
+ {-1, -1, (unsigned) NULL},
+ {-1, -1, (unsigned) NULL}
+ };
+@@ -109,6 +109,10 @@
+ int
+ M68K_Init (void)
+ {
++ M68K_Fetch[1].offset=(unsigned) &Ram_68k[0] - 0xFF0000;
++ M68K_Fetch[2].offset=(unsigned) &Ram_68k[0] - 0xF00000;
++ M68K_Fetch[3].offset=(unsigned) &Ram_68k[0] - 0xEF0000;
++
+ memset (&Context_68K, 0, sizeof (Context_68K));
+
+ Context_68K.s_fetch = Context_68K.u_fetch = Context_68K.fetch = M68K_Fetch;
+@@ -134,6 +138,8 @@
+ int
+ S68K_Init (void)
+ {
++ S68K_Fetch[0].offset=(unsigned) &Ram_Prg[0];
++
+ memset (&Context_68K, 0, sizeof (Context_68K));
+
+ Context_68K.s_fetch = Context_68K.u_fetch = Context_68K.fetch = S68K_Fetch;
diff --git a/games-emulation/gens/files/gens-2.15.5-ovflfix.patch b/games-emulation/gens/files/gens-2.15.5-ovflfix.patch
new file mode 100644
index 000000000000..f5b98a54245f
--- /dev/null
+++ b/games-emulation/gens/files/gens-2.15.5-ovflfix.patch
@@ -0,0 +1,13 @@
+--- src/gens/gens_core/cpu/68k/cpu_68k.c.old 2010-10-28 09:34:52.000000000 +0200
++++ src/gens/gens_core/cpu/68k/cpu_68k.c 2010-10-28 09:35:53.000000000 +0200
+@@ -239,8 +239,8 @@
+ memset (Ram_Word_2M, 0, 256 * 1024);
+ memset (Ram_Word_1M, 0, 256 * 1024);
+
+- memset (COMM.Command, 0, 8 * 5);
+- memset (COMM.Status, 0, 8 * 5);
++ memset (COMM.Command, 0, sizeof (COMM.Command));
++ memset (COMM.Status, 0, sizeof (COMM.Status));
+
+ LED_Status = S68K_State = S68K_Mem_WP = S68K_Mem_PM = Ram_Word_State = 0;
+ COMM.Flag = Init_Timer_INT3 = Timer_INT3 = Int_Mask_S68K = 0;
diff --git a/games-emulation/gens/files/gens-2.15.5-romsdir.patch b/games-emulation/gens/files/gens-2.15.5-romsdir.patch
new file mode 100644
index 000000000000..606efe2dd6f9
--- /dev/null
+++ b/games-emulation/gens/files/gens-2.15.5-romsdir.patch
@@ -0,0 +1,13 @@
+diff -ruN gens-rc3.5-opengl/src/gens/util/rom.c gens-rc3.5-opengl-patched/src/gens/util/rom.c
+--- src/gens/util/file/rom.c 2005-01-10 22:24:01.000000000 +0100
++++ src/gens/util/file/rom.c 2006-10-29 14:58:14.000000000 +0100
+@@ -411,6 +411,9 @@
+ create_file_chooser_dialog ("Open Rom", GTK_FILE_CHOOSER_ACTION_OPEN);
+ // fileselection_set_dir (fd.filesel, Rom_Dir);
+ addRomsFilter (widget);
++
++ gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (widget), Rom_Dir);
++
+ res = gtk_dialog_run (GTK_DIALOG (widget));
+ if (res == GTK_RESPONSE_OK)
+ {
diff --git a/games-emulation/gens/gens-2.15.5.ebuild b/games-emulation/gens/gens-2.15.5.ebuild
new file mode 100644
index 000000000000..bfe3f3eef3d1
--- /dev/null
+++ b/games-emulation/gens/gens-2.15.5.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic games
+
+DESCRIPTION="A Sega Genesis/CD/32X emulator"
+HOMEPAGE="http://sourceforge.net/projects/gens/"
+SRC_URI="mirror://sourceforge/gens/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86"
+IUSE=""
+
+RDEPEND="virtual/opengl
+ >=media-libs/libsdl-1.2[joystick,video]
+ x11-libs/gtk+:2"
+DEPEND="${RDEPEND}
+ >=dev-lang/nasm-0.98"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-romsdir.patch \
+ "${FILESDIR}"/${P}-as-needed.patch \
+ "${FILESDIR}"/${P}-ovflfix.patch \
+ "${FILESDIR}"/${P}-gcc34.patch
+ sed -i -e '1i#define OF(x) x' src/gens/util/file/unzip.h || die
+ append-ldflags -Wl,-z,noexecstack
+}
+
+src_configure() {
+ egamesconf \
+ --disable-gtktest \
+ --disable-sdltest
+}
+
+src_install() {
+ DOCS="AUTHORS BUGS README gens.txt history.txt" \
+ default
+ newicon pixmaps/gens_small.png ${PN}.png
+ make_desktop_entry "${PN}" "Gens"
+ prepgamesdirs
+}
diff --git a/games-emulation/gens/metadata.xml b/games-emulation/gens/metadata.xml
new file mode 100644
index 000000000000..d3d009f0cfb8
--- /dev/null
+++ b/games-emulation/gens/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">gens</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/gfceux/Manifest b/games-emulation/gfceux/Manifest
new file mode 100644
index 000000000000..924bc975bc8b
--- /dev/null
+++ b/games-emulation/gfceux/Manifest
@@ -0,0 +1 @@
+DIST fceux-2.1.1.src.tar.bz2 3263945 SHA256 5f668de5870e28e4b52fcf8816c17831c0f9597307bd643c226a616a1766bdab SHA512 19a1253a3ff1d88baec5636dbebab287b106e5e114081ab4040f52dfcda28b878af748a759e08dc2fe1381eb8f59e728d36993a9aca9ce184ed8760114cf3149 WHIRLPOOL 198d60dd85064f1a865d710b2da7b7fe883d39a2ec8cc111a407fdff78c43b0f7a0840d2b03717bbff46af8c1ec8aaf91bba3ae44fee6112c956b1a59c7075b7
diff --git a/games-emulation/gfceux/files/gfceux-2.1.1-gentoo.patch b/games-emulation/gfceux/files/gfceux-2.1.1-gentoo.patch
new file mode 100644
index 000000000000..b8eee53a4b88
--- /dev/null
+++ b/games-emulation/gfceux/files/gfceux-2.1.1-gentoo.patch
@@ -0,0 +1,18 @@
+diff -ru gfceux.orig/src/main.py gfceux/src/main.py
+--- gfceux.orig/src/main.py 2009-04-29 01:09:52.000000000 -0400
++++ gfceux/src/main.py 2009-09-29 00:38:53.152619918 -0400
+@@ -279,12 +279,8 @@
+ def load_ui(self):
+ global widgets
+ """ Search for the glade XML file and load it """
+- # Check first in the directory of this script.
+- if os.path.isfile('data/gfceux.glade'):
+- glade_file = 'data/gfceux.glade'
+- # Then check to see if its installed on a *nix system
+- elif os.path.isfile(os.path.join(os.path.dirname(sys.argv[0]), '../share/gfceux/gfceux.glade')):
+- glade_file = os.path.join(os.path.dirname(sys.argv[0]), '../share/gfceux/gfceux.glade')
++ if os.path.isfile('/usr/share/gfceux/gfceux.glade'):
++ glade_file = '/usr/share/gfceux/gfceux.glade'
+ else:
+ print 'ERROR.'
+ print 'Could not find the glade UI file.'
diff --git a/games-emulation/gfceux/gfceux-2.1.1-r1.ebuild b/games-emulation/gfceux/gfceux-2.1.1-r1.ebuild
new file mode 100644
index 000000000000..e9218d0ef88d
--- /dev/null
+++ b/games-emulation/gfceux/gfceux-2.1.1-r1.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit eutils gnome2-utils distutils-r1 games
+
+DESCRIPTION="A graphical frontend for the FCEUX emulator"
+HOMEPAGE="http://fceux.com"
+SRC_URI="mirror://sourceforge/fceultra/fceux-${PV}.src.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+DEPEND="dev-python/pygtk"
+RDEPEND="${DEPEND}
+ games-emulation/fceux"
+
+S=${WORKDIR}/${PN}
+
+python_prepare_all() {
+ distutils-r1_python_prepare_all
+
+ sed -i \
+ -e "s#data/gfceux.glade#${GAMES_DATADIR}/${PN}/gfceux.glade#" \
+ src/main.py || die
+}
+
+python_install() {
+ distutils-r1_python_install --install-scripts="${GAMES_BINDIR}"
+}
+
+src_prepare() {
+ distutils-r1_src_prepare
+}
+
+src_compile() {
+ distutils-r1_src_compile
+}
+
+src_install() {
+ distutils-r1_src_install
+
+ doicon -s 48 data/${PN}.png
+ newicon -s 128 data/${PN}_big.png ${PN}.png
+
+ # respect games variables
+ dodir "${GAMES_DATADIR}"/${PN}
+ mv "${ED}"/usr/share/${PN}/* "${ED}${GAMES_DATADIR}"/${PN}/ || die
+
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ games_pkg_preinst
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+}
diff --git a/games-emulation/gfceux/metadata.xml b/games-emulation/gfceux/metadata.xml
new file mode 100644
index 000000000000..ee1fe81755b2
--- /dev/null
+++ b/games-emulation/gfceux/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">fceultra</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/gngb/Manifest b/games-emulation/gngb/Manifest
new file mode 100644
index 000000000000..2032b18e4725
--- /dev/null
+++ b/games-emulation/gngb/Manifest
@@ -0,0 +1 @@
+DIST gngb-20060309.tar.gz 168911 SHA256 49c565002a6e9025c33b13aa0ffcdc456b6bd6360fb966460815a3b4007b4bc8 SHA512 169fdb94eac439240ff15fc2337908cb40e06259338d03c0193a0cb04acb9ee688832fc3157ec56e4e541a8889c4b1a4e7d0efb035b5829ffb856192b60d259f WHIRLPOOL 98c4338825dbf7a2bfa4679041c0aad6fc95ab2f72b293afddbc0ece8c539c3629691150443d18582d767036c1a8d48dff3d04978f94a387894e2290f1f2b090
diff --git a/games-emulation/gngb/files/gngb-20060309-ovflfix.patch b/games-emulation/gngb/files/gngb-20060309-ovflfix.patch
new file mode 100644
index 000000000000..d4cad523854e
--- /dev/null
+++ b/games-emulation/gngb/files/gngb-20060309-ovflfix.patch
@@ -0,0 +1,17 @@
+--- src/serial.c.old 2010-10-28 14:40:23.000000000 +0200
++++ src/serial.c 2010-10-28 14:41:07.000000000 +0200
+@@ -302,11 +302,11 @@
+ /* Gbserial_read: Read a byte on the serial
+ This is a block function */
+ Uint8 gbserial_read(void) {
+- Uint8 b;
++ Uint8 b[2];
+
+ gbserial.ready2read=0;
+- if ((read(dest_socket,&b,2))<=0) return 0xFF;
+- return b;
++ if ((read(dest_socket,b,2))<=0) return 0xFF;
++ return b[0];
+ }
+
+ /* Gbserial_write: Write a byte on the serial
diff --git a/games-emulation/gngb/gngb-20060309.ebuild b/games-emulation/gngb/gngb-20060309.ebuild
new file mode 100644
index 000000000000..3a1774a4d93f
--- /dev/null
+++ b/games-emulation/gngb/gngb-20060309.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit autotools eutils games
+
+DESCRIPTION="Gameboy / Gameboy Color emulator"
+HOMEPAGE="http://m.peponas.free.fr/gngb/"
+SRC_URI="http://m.peponas.free.fr/gngb/download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="ppc x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="opengl"
+
+DEPEND="media-libs/libsdl[sound,joystick,video]
+ sys-libs/zlib
+ app-arch/bzip2
+ opengl? ( virtual/opengl )"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-ovflfix.patch
+ sed -i -e '70i#define OF(x) x' src/unzip.h || die
+ eautoreconf
+}
+
+src_configure() {
+ egamesconf $(use_enable opengl gl)
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc AUTHORS ChangeLog NEWS README TODO
+ prepgamesdirs
+}
diff --git a/games-emulation/gngb/metadata.xml b/games-emulation/gngb/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/gngb/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/gngeo/Manifest b/games-emulation/gngeo/Manifest
new file mode 100644
index 000000000000..0244c45b6bd8
--- /dev/null
+++ b/games-emulation/gngeo/Manifest
@@ -0,0 +1 @@
+DIST gngeo-0.8.tar.gz 1043579 SHA256 4955a36a978accbc13cc9d58be3dbbed8864f27c34446b2fea879ee27fd7c4b6 SHA512 4301e0f48afd8686cdc45bd8c3e7b724f4ab7a2482567c7fe99ee8960f652dbcefb00fcdd7071d85b02636a9ae9795d03169ffc79e8ae6f4c5515a5a53c090c7 WHIRLPOOL 46a9faa2ab1ef8fde03a4fa5f1569b4960b75003b09582eed718068eac125d2f3696207a474b8a14f854dad9753e14fd92f78b9778b8658e80f8f4e2b046d5d8
diff --git a/games-emulation/gngeo/files/gngeo-0.8-concurrentMake.patch b/games-emulation/gngeo/files/gngeo-0.8-concurrentMake.patch
new file mode 100644
index 000000000000..1afc182c0988
--- /dev/null
+++ b/games-emulation/gngeo/files/gngeo-0.8-concurrentMake.patch
@@ -0,0 +1,16 @@
+--- src/generator68k/Makefile.am.orig 2015-01-23 18:37:37.998723294 -0500
++++ src/generator68k/Makefile.am 2015-01-23 18:38:39.995391133 -0500
+@@ -71,9 +71,12 @@
+
+ #def68k : def68k.c
+ # gcc def68k.c tab68k.c -o def68k -I .. -I ../.. -I . `sdl-config --cflags`
+-def68k.o gen68k.o tab68k2.o : %.o : %.c
++def68k.o tab68k2.o : %.o : %.c
+ $(gcc_build_verbose)$(CC_FOR_BUILD) -c $< -o $@ -I .. -I ../.. -I . `sdl-config --cflags`
+
++gen68k.o: gen68k.c def68k-iibs.h
++ $(CC_FOR_BUILD) -c $< -o $@ -I .. -I ../.. -I . `sdl-config --cflags`
++
+ def68k : def68k.o tab68k2.o
+ $(gcc_build_verbose)$(CC_FOR_BUILD) def68k.o tab68k2.o -o $@
+
diff --git a/games-emulation/gngeo/files/gngeo-0.8-execstacks.patch b/games-emulation/gngeo/files/gngeo-0.8-execstacks.patch
new file mode 100644
index 000000000000..17c576b7d634
--- /dev/null
+++ b/games-emulation/gngeo/files/gngeo-0.8-execstacks.patch
@@ -0,0 +1,105 @@
+--- src/effect/2xsaimmx.asm
++++ src/effect/2xsaimmx.asm
+@@ -2107,3 +2107,7 @@
+ final1b resb 8
+ final2a resb 8
+ final2b resb 8
++
++%ifidn __OUTPUT_FORMAT__,elf
++section .note.GNU-stack noalloc noexec nowrite progbits
++%endif
+--- src/effect/effect_i386.asm
++++ src/effect/effect_i386.asm
+@@ -88,3 +88,7 @@
+ emms
+
+ endproc
++
++%ifidn __OUTPUT_FORMAT__,elf
++section .note.GNU-stack noalloc noexec nowrite progbits
++%endif
+--- src/effect/hq2x16.asm
++++ src/effect/hq2x16.asm
+@@ -1935,3 +1935,7 @@
+ dd ..@cross8, ..@flag0, ..@flag0, ..@flag0,
+ dd ..@flag0, ..@flag0, ..@flag0, ..@flag0
+
++
++%ifidn __OUTPUT_FORMAT__,elf
++section .note.GNU-stack noalloc noexec nowrite progbits
++%endif
+--- src/effect/hq3x16.asm
++++ src/effect/hq3x16.asm
+@@ -2520,3 +2520,7 @@
+ dd ..@cross8, ..@flag0, ..@flag0, ..@flag0,
+ dd ..@flag0, ..@flag0, ..@flag0, ..@flag0
+
++
++%ifidn __OUTPUT_FORMAT__,elf
++section .note.GNU-stack noalloc noexec nowrite progbits
++%endif
+--- src/memcpy.S
++++ src/memcpy.S
+@@ -495,4 +495,8 @@
+
+ Lmemcpy_bsrcul1l4:
+ add r1, r1, #1
+-b Lmemcpy_bl4
+\ No newline at end of file
++b Lmemcpy_bl4
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",@progbits
++#endif
+--- src/raze/Makefile.am
++++ src/raze/Makefile.am
+@@ -20,7 +20,7 @@
+ $(srcdir)/strip_ $< $@
+
+ raze2.asm: raze.asmu raze.incu raze.regu
+- nasm -w+orphan-labels -I $(srcdir)/ -e $< -o $@
++ nasm -w+orphan-labels -f elf -I $(srcdir)/ -e $< -o $@
+
+ # This assembles the file, once it's been pre-processed
+ raze.o: raze2.asm
+--- src/raze/raze.asm
++++ src/raze/raze.asm
+@@ -4259,3 +4259,6 @@
+
+ ;- the end ------------------------------------------------------------------;
+
++%ifidn ___OUTPUT_FORMAT__,elf
++section .note.GNU-stack noalloc noexec nowrite progbits
++%endif
+--- src/screen_i386.asm
++++ src/screen_i386.asm
+@@ -96,3 +96,6 @@
+ endproc
+
+
++%ifidn __OUTPUT_FORMAT__,elf
++section .note.GNU-stack noalloc noexec nowrite progbits
++%endif
+--- src/star/star.c
++++ src/star/star.c
+@@ -2431,6 +2431,10 @@
+ */
+ static void suffixes(void) {
+ emit("end\n");
++
++ emit("%%ifidn ___OUTPUT_FORMAT__,elf\n");
++ emit("section .note.GNU-stack noalloc noexec nowrite progbits\n");
++ emit("%%endif\n");
+ }
+
+ /****************************************************************************
+--- src/video_i386.asm
++++ src/video_i386.asm
+@@ -86,3 +86,7 @@
+
+ popa
+ endproc
++
++%ifidn __OUTPUT_FORMAT__,elf
++section .note.GNU-stack noalloc noexec nowrite progbits
++%endif
diff --git a/games-emulation/gngeo/files/gngeo-0.8-zlib.patch b/games-emulation/gngeo/files/gngeo-0.8-zlib.patch
new file mode 100644
index 000000000000..9aa4a6b5f479
--- /dev/null
+++ b/games-emulation/gngeo/files/gngeo-0.8-zlib.patch
@@ -0,0 +1,9 @@
+diff -ru gngeo-0.8.orig/configure.in gngeo-0.8/configure.in
+--- gngeo-0.8.orig/configure.in 2012-11-15 17:57:57.849578009 -0500
++++ gngeo-0.8/configure.in 2012-11-15 18:19:55.305923094 -0500
+@@ -95,6 +95,7 @@
+ #AC_SUBST(LIBOBJS)
+ AC_CHECK_LIB([m], [acos])
+ AC_CHECK_LIB([z], [inflate])
++AC_CHECK_LIB([minizip], [unzReadCurrentFile])
+
diff --git a/games-emulation/gngeo/gngeo-0.8.ebuild b/games-emulation/gngeo/gngeo-0.8.ebuild
new file mode 100644
index 000000000000..50dc24086ea7
--- /dev/null
+++ b/games-emulation/gngeo/gngeo-0.8.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils autotools games
+
+DESCRIPTION="A NeoGeo emulator"
+HOMEPAGE="http://code.google.com/p/gngeo/"
+SRC_URI="http://gngeo.googlecode.com/files/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE=""
+
+DEPEND="virtual/opengl
+ media-libs/libsdl[joystick,opengl,sound,video]
+ sys-libs/zlib[minizip]"
+RDEPEND=${DEPEND}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-execstacks.patch \
+ "${FILESDIR}"/${P}-zlib.patch \
+ "${FILESDIR}"/${P}-concurrentMake.patch
+ mv configure.in configure.ac || die
+ eautoreconf
+}
+
+src_configure() {
+ egamesconf --disable-i386asm
+}
+
+src_install() {
+ DOCS=( AUTHORS FAQ NEWS README* TODO sample_gngeorc )
+ default
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ echo
+ elog "A licensed NeoGeo BIOS copy is required to run the emulator."
+ echo
+}
diff --git a/games-emulation/gngeo/metadata.xml b/games-emulation/gngeo/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/gngeo/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/gnomeboyadvance/Manifest b/games-emulation/gnomeboyadvance/Manifest
new file mode 100644
index 000000000000..96621bb7bf63
--- /dev/null
+++ b/games-emulation/gnomeboyadvance/Manifest
@@ -0,0 +1 @@
+DIST gnomeboyadvance-0.1.tar.bz2 32230 SHA256 04de90219a7b316fd9055a60c4e4b643ab2ae49f3c10d6c34dc3906d842aac94
diff --git a/games-emulation/gnomeboyadvance/gnomeboyadvance-0.1.ebuild b/games-emulation/gnomeboyadvance/gnomeboyadvance-0.1.ebuild
new file mode 100644
index 000000000000..19e12da60809
--- /dev/null
+++ b/games-emulation/gnomeboyadvance/gnomeboyadvance-0.1.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=2
+PYTHON_DEPEND="2"
+inherit python games
+
+DESCRIPTION="A GNOME Python frontend to VisualBoyAdvance"
+HOMEPAGE="http://developer.berlios.de/projects/gnomeboyadvance/"
+SRC_URI="mirror://berlios/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="ppc x86 ~x86-fbsd"
+IUSE=""
+
+RDEPEND="dev-python/libgnome-python
+ dev-python/pygobject:2
+ >=dev-python/pygtk-1.99:2
+ games-emulation/visualboyadvance"
+
+S=${WORKDIR}/gnomeBoyAdvance-0.1
+
+pkg_setup() {
+ python_set_active_version 2
+ games_pkg_setup
+}
+
+src_prepare() {
+ sed -i \
+ -e 's:/usr/share/:/usr/share/games/:' \
+ gnomeboyadvance \
+ || die "sed gnomeboyadvance failed"
+ python_convert_shebangs -r 2 ${PN}
+}
+
+src_install() {
+ dogamesbin gnomeboyadvance || die "dogamesbin failed"
+ insinto "${GAMES_DATADIR}"/gnomeboyadvance
+ doins gnomeBoyAdvance.png gnomeboyadvance.glade || die "doins failed"
+ dodoc README CHANGES TODO
+ prepgamesdirs
+}
diff --git a/games-emulation/gnomeboyadvance/metadata.xml b/games-emulation/gnomeboyadvance/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/gnomeboyadvance/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/gnuboy/Manifest b/games-emulation/gnuboy/Manifest
new file mode 100644
index 000000000000..30456abbe4e1
--- /dev/null
+++ b/games-emulation/gnuboy/Manifest
@@ -0,0 +1 @@
+DIST gnuboy-1.0.3.tar.gz 187627 SHA256 f0022db824b920054a42690322932cf582e0a9995961124586f054503a0f8072 SHA512 89e8075dac5ec17b375a5739367b46c55130211fb487a052be1cca49a5d86cc1a7f1619b2b2473d744fbe3c51fdb1a11110b15836cc9cc9de588932b91d258e6 WHIRLPOOL e42e4598fef51bbb190a0317767f6faa3dfd49ad701bd44f54b8488fd0d72f2bd6568fceb5baca9079ea18a4f6732333ba3a62d928c11eeb310e305f83d0ea7d
diff --git a/games-emulation/gnuboy/files/gnuboy-1.0.3-exec-stack.patch b/games-emulation/gnuboy/files/gnuboy-1.0.3-exec-stack.patch
new file mode 100644
index 000000000000..b8059f915f6f
--- /dev/null
+++ b/games-emulation/gnuboy/files/gnuboy-1.0.3-exec-stack.patch
@@ -0,0 +1,27 @@
+--- asm/i386/cpu.s
++++ asm/i386/cpu.s
+@@ -2428,3 +2428,6 @@
+
+
+
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+--- asm/i386/lcd.s
++++ asm/i386/lcd.s
+@@ -288,3 +288,6 @@
+
+
+
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+--- asm/i386/refresh.s
++++ asm/i386/refresh.s
+@@ -283,3 +283,6 @@
+
+
+
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
diff --git a/games-emulation/gnuboy/files/gnuboy-1.0.3-include.patch b/games-emulation/gnuboy/files/gnuboy-1.0.3-include.patch
new file mode 100644
index 000000000000..15573000511e
--- /dev/null
+++ b/games-emulation/gnuboy/files/gnuboy-1.0.3-include.patch
@@ -0,0 +1,14 @@
+diff -ru gnuboy-1.0.3.orig/defs.h gnuboy-1.0.3/defs.h
+--- gnuboy-1.0.3.orig/defs.h 2001-01-23 07:04:22.000000000 -0500
++++ gnuboy-1.0.3/defs.h 2014-07-04 03:56:46.685149736 -0400
+@@ -4,6 +4,10 @@
+ #ifndef __DEFS_H__
+ #define __DEFS_H__
+
++#include <stdlib.h>
++#include <string.h>
++#include <unistd.h>
++#include <ctype.h>
+
+
+ #ifdef IS_LITTLE_ENDIAN
diff --git a/games-emulation/gnuboy/files/gnuboy-1.0.3-linux-headers.patch b/games-emulation/gnuboy/files/gnuboy-1.0.3-linux-headers.patch
new file mode 100644
index 000000000000..b0dd24a8e50e
--- /dev/null
+++ b/games-emulation/gnuboy/files/gnuboy-1.0.3-linux-headers.patch
@@ -0,0 +1,93 @@
+# -ansi breaks <linux/joystick.h>
+
+--- configure.in
++++ configure.in
+@@ -133,7 +133,7 @@
+ if test "$enable_warnings" = yes ; then
+ case "$CC" in *gcc*)
+ AC_MSG_RESULT(enabling selected compiler warnings)
+-CFLAGS="$CFLAGS -ansi -pedantic -Wall -Wno-implicit -Wno-long-long" ;;
++CFLAGS="$CFLAGS -Wall -Wno-implicit -Wno-long-long" ;;
+ *)
+ AC_MSG_RESULT(disabling warnings for non-gcc compiler) ;;
+ esac
+--- loader.c
++++ loader.c
+@@ -11,7 +11,6 @@
+ #include <stdlib.h>
+ #include <string.h>
+
+-char *strdup();
+
+ static int mbc_table[256] =
+ {
+--- main.c
++++ main.c
+@@ -8,7 +8,6 @@
+ #include <stdlib.h>
+ #include <string.h>
+
+-char *strdup();
+
+ #include <stdarg.h>
+ #include <signal.h>
+--- path.c
++++ path.c
+@@ -5,7 +5,6 @@
+ #include <stdlib.h>
+ #include <string.h>
+
+-char *strdup();
+
+ #ifdef ALT_PATH_SEP
+ #define SEP ';'
+--- rckeys.c
++++ rckeys.c
+@@ -4,7 +4,6 @@
+ #include <stdlib.h>
+ #include <string.h>
+
+-char *strdup();
+
+ #include "defs.h"
+ #include "rc.h"
+--- rcvars.c
++++ rcvars.c
+@@ -5,7 +5,6 @@
+ #include <stdlib.h>
+ #include <string.h>
+
+-char *strdup();
+
+ #include "defs.h"
+ #include "rc.h"
+--- sys/linux/fbdev.c
++++ sys/linux/fbdev.c
+@@ -10,7 +10,6 @@
+
+ #include <stdlib.h>
+ #include <string.h>
+-char *strdup();
+ #include <unistd.h>
+ #include <sys/mman.h>
+ #include <linux/fb.h>
+--- sys/linux/joy.c
++++ sys/linux/joy.c
+@@ -2,7 +2,6 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+-char *strdup();
+ #include <linux/joystick.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+--- sys/oss/oss.c
++++ sys/oss/oss.c
+@@ -2,7 +2,6 @@
+
+ #include <stdlib.h>
+ #include <string.h>
+-char *strdup();
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <fcntl.h>
diff --git a/games-emulation/gnuboy/gnuboy-1.0.3-r1.ebuild b/games-emulation/gnuboy/gnuboy-1.0.3-r1.ebuild
new file mode 100644
index 000000000000..58834b279a4f
--- /dev/null
+++ b/games-emulation/gnuboy/gnuboy-1.0.3-r1.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit autotools eutils games
+
+DESCRIPTION="Gameboy emulator with multiple renderers"
+HOMEPAGE="http://code.google.com/p/gnuboy/"
+SRC_URI="mirror://gentoo/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE="X sdl"
+
+RDEPEND="sdl? ( media-libs/libsdl )
+ !X? ( media-libs/libsdl )
+ X? ( x11-libs/libXext )"
+DEPEND="${RDEPEND}
+ X? ( x11-proto/xextproto
+ x11-proto/xproto )"
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-exec-stack.patch \
+ "${FILESDIR}"/${P}-linux-headers.patch \
+ "${FILESDIR}"/${P}-include.patch
+
+ eautoreconf
+}
+
+src_configure() {
+ local myconf
+
+ if ! use X ; then
+ myconf="--with-sdl"
+ fi
+
+ egamesconf \
+ $(use_with X x) \
+ $(use_with sdl) \
+ $(use_enable x86 asm) \
+ ${myconf} \
+ --disable-arch \
+ --disable-optimize
+}
+
+src_install() {
+ for f in sdlgnuboy xgnuboy
+ do
+ if [[ -f ${f} ]] ; then
+ dogamesbin ${f}
+ fi
+ done
+ dodoc README docs/{CHANGES,CONFIG,CREDITS,FAQ,HACKING,WHATSNEW}
+ prepgamesdirs
+}
diff --git a/games-emulation/gnuboy/metadata.xml b/games-emulation/gnuboy/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/gnuboy/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/gxmame/Manifest b/games-emulation/gxmame/Manifest
new file mode 100644
index 000000000000..59f715e722cf
--- /dev/null
+++ b/games-emulation/gxmame/Manifest
@@ -0,0 +1 @@
+DIST gxmame-0.35beta2.tar.gz 697013 SHA256 6d0339bf334f40ff0b972cf5c4df14660c48a2f0bce10f23d6a0feb3d5c83622 SHA512 c2b47c1f3f76d86846302754b31954b81d5b7165f5778153c6e6285bdcc6040c5479009cd70dcf32c86afa245ae8b6fe98af781f0d51acfcb76c8deb76422fe2 WHIRLPOOL 1c9f8d9aca3b8b49edf435f9888dce917992c919c1a869b2da4102fca549bc851ab47ecd4f2b9b2325fa89c6dad8667824ca6bd48ab94da1d8be35d63bb4592e
diff --git a/games-emulation/gxmame/files/gxmame-0.35_beta2-glib-single-include.patch b/games-emulation/gxmame/files/gxmame-0.35_beta2-glib-single-include.patch
new file mode 100644
index 000000000000..83ef4aa075e5
--- /dev/null
+++ b/games-emulation/gxmame/files/gxmame-0.35_beta2-glib-single-include.patch
@@ -0,0 +1,13 @@
+Index: gxmame-0.35beta2/src/gxmame.c
+===================================================================
+--- gxmame-0.35beta2.orig/src/gxmame.c
++++ gxmame-0.35beta2/src/gxmame.c
+@@ -31,7 +31,7 @@
+ #include <unistd.h>
+ #include <signal.h>
+ #include <glib/gprintf.h>
+-#include <glib/gutils.h>
++#include <glib.h>
+ #include <gtk/gtkmain.h>
+ #include <gtk/gtkfilesel.h>
+
diff --git a/games-emulation/gxmame/files/gxmame-0.35_beta2-ovflfix.patch b/games-emulation/gxmame/files/gxmame-0.35_beta2-ovflfix.patch
new file mode 100644
index 000000000000..8831a3e09b61
--- /dev/null
+++ b/games-emulation/gxmame/files/gxmame-0.35_beta2-ovflfix.patch
@@ -0,0 +1,29 @@
+--- src/options.c.old 2010-12-01 10:48:45.000000000 +0100
++++ src/options.c 2010-12-01 10:53:55.000000000 +0100
+@@ -4245,7 +4245,7 @@
+ case XMAME_EXEC_SVGAFX:
+ target->fxgkeepaspect = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (fxgkeepaspect_checkbutton));
+ used_text = gtk_editable_get_chars (GTK_EDITABLE (fx_entry), 0, -1);
+- strncpy (target->resolution, used_text, 20);
++ strncpy (target->resolution, used_text, sizeof(target->resolution));
+ g_free (used_text);
+ break;
+
+@@ -4330,7 +4330,7 @@
+ }
+
+ used_text = gtk_editable_get_chars (GTK_EDITABLE (soundfile_entry), 0, -1);
+- strncpy (target->soundfile, used_text, 50);
++ strncpy (target->soundfile, used_text, sizeof(target->soundfile));
+ g_free (used_text);
+
+ target->timer = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (timer_checkbutton));
+@@ -4465,7 +4465,7 @@
+ target->skip_disclaimer = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (disclaimer_checkbutton));
+ target->skip_gameinfo = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gameinfo_checkbutton));
+ used_text = gtk_editable_get_chars (GTK_EDITABLE (debug_size_combo_entry), 0, -1);
+- strncpy (target->debug_size, used_text, 20);
++ strncpy (target->debug_size, used_text, sizeof(target->debug_size));
+ g_free (used_text);
+ target->use_additional_options = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (additional_options_checkbutton));
+ /* here I'm using directly the additional option because I don't know its length */
diff --git a/games-emulation/gxmame/gxmame-0.35_beta2.ebuild b/games-emulation/gxmame/gxmame-0.35_beta2.ebuild
new file mode 100644
index 000000000000..9f8c694f46d5
--- /dev/null
+++ b/games-emulation/gxmame/gxmame-0.35_beta2.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit eutils games
+
+MY_P="${PN}-${PV/_beta/beta}"
+DESCRIPTION="frontend for XMame using the GTK library"
+HOMEPAGE="http://gxmame.sourceforge.net/"
+SRC_URI="mirror://sourceforge/gxmame/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc ~sparc x86"
+IUSE="nls joystick"
+
+RDEPEND="dev-libs/expat
+ >=x11-libs/gtk+-2.4:2
+ >=dev-libs/glib-2.4:2
+ x11-themes/gnome-icon-theme
+ nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-glib-single-include.patch
+ epatch "${FILESDIR}"/${P}-ovflfix.patch
+ sed -i \
+ -e "s:-O2 -fomit-frame-pointer -ffast-math:${CFLAGS}:" \
+ -e "s:-O2:${CFLAGS}:" \
+ configure \
+ || die "sed failed"
+ sed -i \
+ -e 's:COPYING::' \
+ -e "s:^docdir = .*:docdir = /usr/share/doc/${PF}:" \
+ -e "s:^htmldir = .*:htmldir = /usr/share/doc/${PF}/html:" \
+ -e "s:^icondir = .*:icondir = /usr/share/icons:" \
+ -e "s:^pixmapdir = .*:pixmapdir = /usr/share/pixmaps:" \
+ -e "s:^gnulocaledir = .*:gnulocaledir = /usr/share/locale:" \
+ -e "s:^icon2dir = .*:icon2dir = /usr/share/icons/mini:" \
+ -e "s:^Graphicsdir = .*:Graphicsdir = /usr/share/applications:" \
+ -e "/DDATADIR/s:\$(datadir):/usr/share/pixmaps:" \
+ -e "/DPACKAGE_LOCALE_DIR/s:\$(datadir):/usr/share:" \
+ Makefile.in html/Makefile.in src/Makefile.in po/Makefile.in.in \
+ || die "sed failed"
+ sed -i \
+ -e 's/"gxmame"/""/' src/gui.c \
+ || die "sed failed"
+}
+
+src_configure() {
+ egamesconf \
+ --disable-dependency-tracking \
+ --with-xmame-dir="${GAMES_DATADIR}"/xmame \
+ $(use_enable nls) \
+ $(use_enable joystick)
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc AUTHORS BUGS ChangeLog NEWS README TODO
+ prepgamesdirs
+}
diff --git a/games-emulation/gxmame/metadata.xml b/games-emulation/gxmame/metadata.xml
new file mode 100644
index 000000000000..3172373dc41a
--- /dev/null
+++ b/games-emulation/gxmame/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">gxmame</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/handy/Manifest b/games-emulation/handy/Manifest
new file mode 100644
index 000000000000..5cdcb736f5f0
--- /dev/null
+++ b/games-emulation/handy/Manifest
@@ -0,0 +1 @@
+DIST Handy-SDL-0.82R1.i386.linux-glibc22.tar.bz2 158228 SHA256 7e92ddae265172d308f996c9a1a2259ad3cec7e2ab39a0422aa86118127ab5b1 SHA512 d1280f29c63b38a9ab525e6e319458f85e64caa07780946b0f54f923a50e0f7a9ead990171bc3a5dc3913e4de470973c6a1cfeea122fe72f7c1f34d4450bea83 WHIRLPOOL c6342b7e0446ef4ae126cb3a4551c9a5b925b82832c49dcbfadc521af3ba78927b7beb8a97762dedd1ed28ae7f6aa3233b01dc522b1f434e99929074697ac74a
diff --git a/games-emulation/handy/handy-0.82.ebuild b/games-emulation/handy/handy-0.82.ebuild
new file mode 100644
index 000000000000..c10eba3cf308
--- /dev/null
+++ b/games-emulation/handy/handy-0.82.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit games
+
+MY_RLS="R1"
+DESCRIPTION="A Atari Lynx emulator for Linux"
+HOMEPAGE="http://sdlemu.ngemu.com/handysdl.php"
+SRC_URI="http://sdlemu.ngemu.com/releases/Handy-SDL-${PV}${MY_RLS}.i386.linux-glibc22.tar.bz2"
+
+# Closed source, but docs/Handy.html says that it "does not contain
+# any copyrighted materials"
+LICENSE="public-domain no-source-code"
+SLOT="0"
+KEYWORDS="-* ~x86"
+RESTRICT="strip"
+IUSE=""
+
+RDEPEND="media-libs/libsdl
+ sys-libs/zlib
+ sys-libs/lib-compat"
+DEPEND=${RDEPEND}
+
+S=${WORKDIR}
+
+QA_PREBUILT="${GAMES_PREFIX_OPT:1}/${PN}/handy"
+
+src_install() {
+ local dir=${GAMES_PREFIX_OPT}/${PN}
+ exeinto "${dir}"
+ newexe sdlhandy handy
+ dohtml -r docs/*
+ games_make_wrapper sdlhandy ./sdlhandy "${dir}" "${dir}"
+ games_make_wrapper handy ./handy "${dir}" "${dir}"
+ prepgamesdirs
+}
diff --git a/games-emulation/handy/metadata.xml b/games-emulation/handy/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/handy/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/hatari/Manifest b/games-emulation/hatari/Manifest
new file mode 100644
index 000000000000..4e33a91f48fe
--- /dev/null
+++ b/games-emulation/hatari/Manifest
@@ -0,0 +1 @@
+DIST hatari-1.8.0.tar.bz2 1985358 SHA256 7ecf486ba578e3b4d7a3d3e86ef3e879d5e5611b39c2504e38ccafdaacb5ffeb SHA512 498a6636eef78e85a4715e9df169d928ce97c0548145a95b41aa3aae28817b8e843de1d1390893863be05e4e9981c89236571ab2eb9239faad23b711542e4fa0 WHIRLPOOL 9e62bdf08247da20e451e032355849cbb0c4b683711ed5cea29f03a52cb5b276e996b9ea4fe5c38ecc09456248bd099eb8b1f35d93e6cba5d00b93a456329a01
diff --git a/games-emulation/hatari/files/hatari-1.8.0-gentoo-docdir.patch b/games-emulation/hatari/files/hatari-1.8.0-gentoo-docdir.patch
new file mode 100644
index 000000000000..715fb189143f
--- /dev/null
+++ b/games-emulation/hatari/files/hatari-1.8.0-gentoo-docdir.patch
@@ -0,0 +1,13 @@
+--- hatari-1.6.1/python-ui/uihelpers.py
++++ hatari-1.6.1/python-ui/uihelpers.py
+@@ -97,9 +97,7 @@
+ # first try whether there are local Hatari docs in standard place
+ # for this Hatari/UI version
+ sep = os.sep
+- path = self.get_binary_path("hatari")
+- path = sep.join(path.split(sep)[:-2]) # remove "bin/hatari"
+- path = path + sep + "share" + sep + "doc" + sep + "hatari" + sep
++ path = "@DOCDIR@"
+ if os.path.exists(path + "manual.html"):
+ return path
+ # if not, point to latest Hatari HG version docs
diff --git a/games-emulation/hatari/files/hatari-1.8.0-gentoo.patch b/games-emulation/hatari/files/hatari-1.8.0-gentoo.patch
new file mode 100644
index 000000000000..4f10d6d9e3ce
--- /dev/null
+++ b/games-emulation/hatari/files/hatari-1.8.0-gentoo.patch
@@ -0,0 +1,112 @@
+--- hatari-1.4.0.orig/src/paths.c
++++ hatari-1.4.0/src/paths.c
+@@ -109,71 +109,6 @@
+ free(pTmpName);
+ }
+
+-
+-/**
+- * Locate the directory where the hatari executable resides
+- */
+-static char *Paths_InitExecDir(const char *argv0)
+-{
+- char *psExecDir; /* Path string where the hatari executable can be found */
+-
+- /* Allocate memory for storing the path string of the executable */
+- psExecDir = malloc(FILENAME_MAX);
+- if (!psExecDir)
+- {
+- fprintf(stderr, "Out of memory (Paths_Init)\n");
+- exit(-1);
+- }
+-
+- /* Determine the bindir...
+- * Start with empty string, then try to use OS specific functions,
+- * and finally analyze the PATH variable if it has not been found yet. */
+- psExecDir[0] = '\0';
+-
+-#if defined(__linux__)
+- {
+- int i;
+- /* On Linux, we can analyze the symlink /proc/self/exe */
+- i = readlink("/proc/self/exe", psExecDir, FILENAME_MAX);
+- if (i > 0)
+- {
+- char *p;
+- psExecDir[i] = '\0';
+- p = strrchr(psExecDir, '/'); /* Search last slash */
+- if (p)
+- *p = 0; /* Strip file name from path */
+- }
+- }
+-//#elif defined(WIN32) || defined(__CEGCC__)
+-// /* On Windows we can use GetModuleFileName for getting the exe path */
+-// GetModuleFileName(NULL, psExecDir, FILENAME_MAX);
+-#endif
+-
+- /* If we do not have the execdir yet, analyze argv[0] and the PATH: */
+- if (psExecDir[0] == 0)
+- {
+- if (strchr(argv0, PATHSEP) == 0)
+- {
+- /* No separator in argv[0], we have to explore PATH... */
+- Paths_GetExecDirFromPATH(argv0, psExecDir, FILENAME_MAX);
+- }
+- else
+- {
+- /* There was a path separator in argv[0], so let's assume a
+- * relative or absolute path to the current directory in argv[0] */
+- char *p;
+- strncpy(psExecDir, argv0, FILENAME_MAX);
+- psExecDir[FILENAME_MAX-1] = 0;
+- p = strrchr(psExecDir, PATHSEP); /* Search last slash */
+- if (p)
+- *p = 0; /* Strip file name from path */
+- }
+- }
+-
+- return psExecDir;
+-}
+-
+-
+ /**
+ * Initialize the users home directory string
+ * and Hatari's home directory (~/.hatari)
+@@ -226,8 +161,6 @@
+ */
+ void Paths_Init(const char *argv0)
+ {
+- char *psExecDir; /* Path string where the hatari executable can be found */
+-
+ /* Init working directory string */
+ if (getcwd(sWorkingDir, FILENAME_MAX) == NULL)
+ {
+@@ -238,27 +171,11 @@
+ /* Init the user's home directory string */
+ Paths_InitHomeDirs();
+
+- /* Get the directory where the executable resides */
+- psExecDir = Paths_InitExecDir(argv0);
+-
+- /* Now create the datadir path name from the bindir path name: */
+- if (psExecDir && strlen(psExecDir) > 0)
+- {
+- snprintf(sDataDir, sizeof(sDataDir), "%s%c%s",
+- psExecDir, PATHSEP, BIN2DATADIR);
+- }
+- else
+- {
+- /* bindir could not be determined, let's assume datadir is relative
+- * to current working directory... */
+- strcpy(sDataDir, BIN2DATADIR);
+- }
++ strcpy(sDataDir, BIN2DATADIR);
+
+ /* And finally make a proper absolute path out of datadir: */
+ File_MakeAbsoluteName(sDataDir);
+
+- free(psExecDir);
+-
+ /* fprintf(stderr, " WorkingDir = %s\n DataDir = %s\n UserHomeDir = %s\n HatariHomeDir = %s\n",
+ sWorkingDir, sDataDir, sUserHomeDir, sHatariHomeDir); */
+ }
diff --git a/games-emulation/hatari/hatari-1.8.0.ebuild b/games-emulation/hatari/hatari-1.8.0.ebuild
new file mode 100644
index 000000000000..203f480051ea
--- /dev/null
+++ b/games-emulation/hatari/hatari-1.8.0.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+inherit eutils toolchain-funcs cmake-utils python-single-r1 games
+
+DESCRIPTION="Atari ST emulator"
+HOMEPAGE="http://hatari.tuxfamily.org/"
+SRC_URI="http://download.tuxfamily.org/hatari/${PV}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE=""
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}
+ media-libs/libsdl[X,sound,video]
+ sys-libs/readline:0
+ media-libs/libpng:0
+ sys-libs/zlib"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+RDEPEND="${RDEPEND}
+ dev-python/pygtk[${PYTHON_USEDEP}]
+ games-emulation/emutos"
+
+pkg_setup() {
+ games_pkg_setup
+ python-single-r1_pkg_setup
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-gentoo.patch \
+ "${FILESDIR}"/${P}-gentoo-docdir.patch
+ # build with newer zlib (bug #387829)
+ sed -i -e '1i#define OF(x) x' src/includes/unzip.h || die
+ sed -i -e '/Encoding/d' ./python-ui/hatariui.desktop || die
+ sed -i -e "s/python/${EPYTHON}/" tools/atari-hd-image.sh || die
+ sed -i \
+ -e "s%conf=.*$%conf=\"${GAMES_SYSCONFDIR}\"%" \
+ -e "s%path=.*$%path=\"${GAMES_DATADIR}/${PN}/hatariui\"%" \
+ python-ui/hatariui || die
+ sed -i -e "s#@DOCDIR@#/usr/share/doc/${PF}/html/#" python-ui/uihelpers.py || die
+ rm -f doc/CMakeLists.txt
+}
+
+src_configure() {
+ mycmakeargs=(
+ "-DCMAKE_VERBOSE_MAKEFILE=TRUE"
+ "-DCMAKE_BUILD_TYPE:STRING=Release"
+ "-DDATADIR=${GAMES_DATADIR}/${PN}"
+ "-DBIN2DATADIR=${GAMES_DATADIR}/${PN}"
+ "-DBINDIR=${GAMES_BINDIR}"
+ "-DICONDIR=/usr/share/pixmaps"
+ "-DDESKTOPDIR=/usr/share/applications"
+ "-DMANDIR=/usr/share/man/man1"
+ "-DDOCDIR=/usr/share/doc/${PF}"
+ )
+ cmake-utils_src_configure
+}
+
+src_install() {
+ DOCS="readme.txt doc/*.txt" cmake-utils_src_install
+ dohtml -r doc/
+ python_fix_shebang "${ED%/}"/usr/share/games/hatari/{hatariui,hconsole}/
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ echo
+ elog "You need a TOS ROM to run hatari. EmuTOS, a free TOS implementation,"
+ elog "has been installed in $(games_get_libdir) with a .img extension (there"
+ elog "are several from which to choose)."
+ elog
+ elog "Another option is to go to http://www.atari.st/ and get a real TOS:"
+ elog " http://www.atari.st/"
+ elog
+ elog "The first time you run hatari, you should configure it to find the"
+ elog "TOS you prefer to use. Be sure to save your settings."
+ echo
+}
diff --git a/games-emulation/hatari/metadata.xml b/games-emulation/hatari/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/hatari/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/higan/Manifest b/games-emulation/higan/Manifest
new file mode 100644
index 000000000000..69de8c5c4db6
--- /dev/null
+++ b/games-emulation/higan/Manifest
@@ -0,0 +1 @@
+DIST higan_v094-source.tar.xz 882732 SHA256 5e149df9d50c1066eb97c0d66665428d75304da782bba5a87078b87fc311151b SHA512 e7e48c76cdc93d2d66db1fa0c71e64903cf4188571b2d5ecb8066dd4e2172a67da4dee68bed6fd0a532b6fd397fa4f537b97de58cc5043a9e970d48d0b66b0da WHIRLPOOL 42e2b628e83b6cb8d87ce82c2e91105b0be06790a1927aa7d52f0b1a181af5d627f467009d15daffd470e3c38a2bb7d67ba84919fb1aa9c8d06ad88ca3163641
diff --git a/games-emulation/higan/files/higan-094-QA.patch b/games-emulation/higan/files/higan-094-QA.patch
new file mode 100644
index 000000000000..69aaedf3d3de
--- /dev/null
+++ b/games-emulation/higan/files/higan-094-QA.patch
@@ -0,0 +1,90 @@
+From: Julian Ospald <hasufell@gentoo.org>
+Date: Sun Jun 9 10:23:38 UTC 2013
+Subject:
+
+--- a/Makefile
++++ b/Makefile
+@@ -13,8 +13,8 @@
+ # console := true
+
+ # compiler
+-flags += -I. -O3 -fomit-frame-pointer
+-link +=
++flags += -I.
++link += $(LDFLAGS)
+ objects := libco
+
+ # profile-guided optimization mode
+@@ -41,14 +41,12 @@
+ endif
+ link += -s -mthreads -luuid -lkernel32 -luser32 -lgdi32 -lcomctl32 -lcomdlg32 -lshell32 -lole32 -lws2_32
+ link += -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
+-else ifeq ($(platform),macosx)
+- flags += -march=native
+ else ifeq ($(platform),linux)
+- flags += -march=native
+- link += -s -Wl,-export-dynamic -lX11 -lXext -ldl
++ flags +=
++ link += -Wl,-export-dynamic -lX11 -lXext -ldl
+ else ifeq ($(platform),bsd)
+- flags += -march=native
+- link += -s -Wl,-export-dynamic -lX11 -lXext
++ flags +=
++ link += -Wl,-export-dynamic -lX11 -lXext
+ else
+ $(error unsupported platform.)
+ endif
+@@ -59,9 +57,9 @@
+ compile = \
+ $(strip \
+ $(if $(filter %.c,$<), \
+- $(compiler) $(cflags) $(flags) $1 -c $< -o $@, \
++ $(compiler) $(cflags) $(flags) $(CFLAGS) $1 -c $< -o $@, \
+ $(if $(filter %.cpp,$<), \
+- $(compiler) $(cppflags) $(flags) $1 -c $< -o $@ \
++ $(compiler) $(cppflags) $(flags) $(CXXFLAGS) $1 -c $< -o $@ \
+ ) \
+ ) \
+ )
+--- a/target-ethos/Makefile
++++ b/target-ethos/Makefile
+@@ -55,10 +55,10 @@
+ obj/ui-tools.o: $(ui)/tools/tools.cpp $(call rwildcard,$(ui)/)
+
+ obj/ruby.o: ruby/ruby.cpp $(call rwildcard,ruby/*)
+- $(compiler) $(rubyflags) -c $< -o $@
++ $(compiler) $(rubyflags) $(CXXFLAGS) -c $< -o $@
+
+ obj/phoenix.o: phoenix/phoenix.cpp $(call rwildcard,phoenix/*)
+- $(compiler) $(phoenixflags) -c $< -o $@
++ $(compiler) $(phoenixflags) $(CXXFLAGS) -c $< -o $@
+
+ obj/resource.o: $(ui)/resource.rc
+ ifeq ($(arch),win32)
+@@ -82,7 +82,7 @@
+ sips -s format icns data/higan.png --out out/$(name).app/Contents/Resources/higan.icns
+ $(strip $(compiler) -o out/$(name).app/Contents/MacOS/$(name) $(objects) $(link))
+ else
+- $(strip $(compiler) -o out/$(name) $(objects) $(link))
++ $(strip $(CXX) $(CXXFLAGS) -o out/$(name) $(objects) $(link))
+ endif
+
+ resource:
+--- a/nall/Makefile
++++ b/nall/Makefile
+@@ -53,11 +53,11 @@
+ link :=
+ endif
+
+- cflags := -x c -std=c99
+- objcflags := -x objective-c -std=c99
+- cppflags := -x c++ -std=c++11
+- objcppflags := -x objective-c++ -std=c++11
+ endif
++cflags := -x c -std=c99
++objcflags := -x objective-c -std=c99
++cppflags := -x c++ -std=c++11
++objcppflags := -x objective-c++ -std=c++11
+
+ # cross-compilation support
+ ifeq ($(arch),x86)
diff --git a/games-emulation/higan/files/higan-wrapper b/games-emulation/higan/files/higan-wrapper
new file mode 100644
index 000000000000..e2d9257a4b65
--- /dev/null
+++ b/games-emulation/higan/files/higan-wrapper
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+[ -e $HOME/.config/ ] || mkdir $HOME/.config/
+
+cp -ru "%GAMES_DATADIR%/higan" $HOME/.config/
+
+exec ${0}.bin "$@"
diff --git a/games-emulation/higan/higan-094.ebuild b/games-emulation/higan/higan-094.ebuild
new file mode 100644
index 000000000000..15962e2148eb
--- /dev/null
+++ b/games-emulation/higan/higan-094.ebuild
@@ -0,0 +1,155 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils gnome2-utils toolchain-funcs qmake-utils games
+
+MY_P=${PN}_v${PV}-source
+
+DESCRIPTION="A Nintendo multi-system emulator formerly known as bsnes"
+HOMEPAGE="http://byuu.org/higan/ https://code.google.com/p/higan/"
+SRC_URI="http://byuu.org/files/${MY_P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="ao +alsa openal opengl oss profile_accuracy +profile_balanced profile_performance pulseaudio qt4 +sdl udev xv"
+REQUIRED_USE="|| ( ao openal alsa pulseaudio oss )
+ || ( xv opengl sdl )
+ || ( profile_accuracy profile_balanced profile_performance )"
+
+RDEPEND="
+ x11-libs/libX11
+ x11-libs/libXext
+ ao? ( media-libs/libao )
+ openal? ( media-libs/openal )
+ alsa? ( media-libs/alsa-lib )
+ pulseaudio? ( media-sound/pulseaudio )
+ xv? ( x11-libs/libXv )
+ opengl? ( virtual/opengl )
+ sdl? ( media-libs/libsdl[X,joystick,video] )
+ udev? ( virtual/udev )
+ !qt4? ( x11-libs/gtk+:2 )
+ qt4? ( >=dev-qt/qtgui-4.5:4 )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+disable_module() {
+ sed -i \
+ -e "s|$1\b||" \
+ "${S}"/target-ethos/Makefile || die
+}
+
+src_prepare() {
+ local i
+
+ epatch "${FILESDIR}"/${P}-QA.patch
+
+ sed -i \
+ -e "/handle/s#/usr/local/lib#/usr/$(get_libdir)#" \
+ nall/dl.hpp || die "fixing libdir failed!"
+
+ # audio modules
+ use ao || disable_module audio.ao
+ use openal || disable_module audio.openal
+ use pulseaudio || { disable_module audio.pulseaudio
+ disable_module audio.pulseaudiosimple ;}
+ use oss || disable_module audio.oss
+ use alsa || disable_module audio.alsa
+
+ # video modules
+ use opengl || disable_module video.glx
+ use xv || disable_module video.xv
+ use sdl || disable_module video.sdl
+
+ # input modules
+ use sdl || disable_module input.sdl
+ use udev || disable_module input.udev
+
+ # regenerate .moc if needed
+ if use qt4; then
+ cd phoenix/qt || die
+ "$(qt4_get_bindir)"/moc -i -I. -o platform.moc platform.moc.hpp || die
+ fi
+
+ for i in profile_accuracy profile_balanced profile_performance ; do
+ if use ${i} ; then
+ cp -dRP "${S}" "${S}_${i}" || die
+ fi
+ done
+}
+
+src_compile() {
+ local mytoolkit i
+
+ if use qt4; then
+ mytoolkit="qt"
+ else
+ mytoolkit="gtk"
+ fi
+
+ for i in profile_accuracy profile_balanced profile_performance ; do
+ if use ${i} ; then
+ cd "${S}_${i}" || die
+ emake \
+ platform="linux" \
+ compiler="$(tc-getCXX)" \
+ profile="${i#profile_}" \
+ phoenix="${mytoolkit}"
+
+ sed \
+ -e "s:%GAMES_DATADIR%:${GAMES_DATADIR}:" \
+ < "${FILESDIR}"/${PN}-wrapper \
+ > out/${PN}-wrapper || die "generating wrapper failed!"
+ fi
+ done
+}
+
+src_install() {
+ local i
+
+ for i in profile_accuracy profile_balanced profile_performance ; do
+ if use ${i} ; then
+ # install higan
+ newgamesbin "${S}_${i}"/out/${PN} ${PN}-${i#profile_}.bin
+ newgamesbin "${S}_${i}"/out/${PN}-wrapper ${PN}-${i#profile_}
+ make_desktop_entry "${PN}-${i#profile_}" "${PN} (${i#profile_})"
+ fi
+ done
+
+ # copy home directory stuff to a global location
+ insinto "${GAMES_DATADIR}"/${PN}
+ doins -r data/cheats.bml profile/*
+
+ # install shaders
+ if use opengl; then
+ insinto "${GAMES_DATADIR}/${PN}/Video Shaders"
+ doins -r shaders/*.shader
+ fi
+
+ doicon -s 48 data/${PN}.png
+
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ games_pkg_preinst
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ elog "optional dependencies:"
+ elog " dev-games/higan-ananke (extra rom load options)"
+ elog " games-util/higan-purify (Rom purifier)"
+
+ games_pkg_postinst
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+}
diff --git a/games-emulation/higan/metadata.xml b/games-emulation/higan/metadata.xml
new file mode 100644
index 000000000000..a4f1fbe55087
--- /dev/null
+++ b/games-emulation/higan/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <use>
+ <flag name='profile_accuracy'>
+ Compile a binary optimized for accuracy</flag>
+ <flag name='profile_balanced'>
+ Compile a binary with balanced optimization</flag>
+ <flag name='profile_performance'>
+ Compile a binary optimized for performance</flag>
+ <flag name='udev'>Enable udev based input</flag>
+ </use>
+</pkgmetadata>
+
diff --git a/games-emulation/hugo/Manifest b/games-emulation/hugo/Manifest
new file mode 100644
index 000000000000..067cbb958858
--- /dev/null
+++ b/games-emulation/hugo/Manifest
@@ -0,0 +1 @@
+DIST hugo-2.12.tar.gz 456991 SHA256 0bc1d0a6c7d8a0906c25611cbc9fb391afb59770c0cd71a7329b1338c1821b8e SHA512 38342e6e7a130caeac711de4f72138a5159c2a34e443ce5e16bcb7ac02fbefd085fa5c48583550d8089bfe3528785853df1863e7d1b32652a7f88300ad09d21d WHIRLPOOL c2e2881ecd267f95c60b5af2419fbd5172120795233fafa87b34f1219c67fcb676df9c74c83e29b905b45fbeb7f0bae95b4c85174229f9450f2cbba34815aac7
diff --git a/games-emulation/hugo/files/hugo-2.12-gcc41.patch b/games-emulation/hugo/files/hugo-2.12-gcc41.patch
new file mode 100644
index 000000000000..14050cc79f16
--- /dev/null
+++ b/games-emulation/hugo/files/hugo-2.12-gcc41.patch
@@ -0,0 +1,11 @@
+--- pce.h.old 2006-05-02 20:06:13.000000000 +0200
++++ pce.h 2006-05-02 20:06:33.000000000 +0200
+@@ -196,7 +196,7 @@
+ extern UChar language;
+ // the current language
+
+-extern int BaseClock, UPeriod;
++extern int UPeriod;
+
+ extern UChar US_encoded_card;
+ // Do we have to swap even and odd bytes in the rom
diff --git a/games-emulation/hugo/hugo-2.12.ebuild b/games-emulation/hugo/hugo-2.12.ebuild
new file mode 100644
index 000000000000..744133d73116
--- /dev/null
+++ b/games-emulation/hugo/hugo-2.12.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic games
+
+DESCRIPTION="PC-Engine (Turbografx16) emulator for linux"
+HOMEPAGE="http://www.zeograd.com/"
+SRC_URI="http://www.zeograd.com/download/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="x86"
+IUSE=""
+
+RDEPEND="x11-libs/gtk+:2
+ media-libs/libsdl[video]
+ media-libs/libvorbis"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}"-gcc41.patch
+ append-cppflags $(pkg-config sdl --cflags)
+
+}
+
+src_install() {
+ dogamesbin hugo
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins -r pixmaps
+ dodoc AUTHORS ChangeLog NEWS README TODO
+ dohtml doc/*html
+ prepgamesdirs
+}
diff --git a/games-emulation/hugo/metadata.xml b/games-emulation/hugo/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/hugo/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/kigb/Manifest b/games-emulation/kigb/Manifest
new file mode 100644
index 000000000000..7c69ac762927
--- /dev/null
+++ b/games-emulation/kigb/Manifest
@@ -0,0 +1 @@
+DIST kigb_lin.tar.gz 477324 SHA256 71adb8018ba80b80b7aa454161d47ec447e74c4797ba752b130d46e79ffcf3b3 SHA512 ca8b10cc05884c92157dde2b034c7e95f28ed7eed771d0383265f942f0cacea791284516b551e96ba07a035068a7039c8faa19ec417ee117b6a350692bbff01d WHIRLPOOL 1772c689e28bd7a6095737b7327867624fe381a452fbf8ec984e8becdb06da37aa914cecf45c2ee3059db8a9563f445c33f8b3f30854304fed6e20c3c42a9f01
diff --git a/games-emulation/kigb/files/kigb b/games-emulation/kigb/files/kigb
new file mode 100644
index 000000000000..7a3e691b7f31
--- /dev/null
+++ b/games-emulation/kigb/files/kigb
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+kigb_dir="${HOME}/.kigb"
+
+if [[ ! -d "${kigb_dir}" ]] ; then
+ mkdir -p "${kigb_dir}"
+ cd "${kigb_dir}"
+ mkdir cfg inp rom save snap state
+ ln -s GENTOODIR/kigb/kigb kigb
+fi
+
+cd "${kigb_dir}"
+exec ./kigb "$@"
diff --git a/games-emulation/kigb/kigb-2.02.ebuild b/games-emulation/kigb/kigb-2.02.ebuild
new file mode 100644
index 000000000000..9eef5dbb6f01
--- /dev/null
+++ b/games-emulation/kigb/kigb-2.02.ebuild
@@ -0,0 +1,41 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit games
+
+DESCRIPTION="A Gameboy (GB, SGB, GBA) Emulator for Linux"
+HOMEPAGE="http://kigb.emuunlim.com/"
+SRC_URI="http://kigb.emuunlim.com/${PN}_lin.tar.gz"
+
+LICENSE="all-rights-reserved"
+SLOT="0"
+KEYWORDS="-* x86"
+IUSE=""
+RESTRICT="mirror bindist strip"
+
+RDEPEND="x11-libs/libXext
+ sys-libs/zlib
+ dev-games/hawknl
+ =virtual/libstdc++-3*"
+
+S=${WORKDIR}
+
+src_prepare() {
+ # use the system version
+ rm -f libNL.so*
+ # wrapper script creates these in the users' home directories.
+ rm -rf cfg inp snap state rom save
+ cp "${FILESDIR}/kigb" "${T}/" || die
+ sed -i \
+ -e "s:GENTOODIR:${GAMES_PREFIX_OPT}:" "${T}/kigb" || die
+}
+
+src_install() {
+ dogamesbin "${T}/kigb"
+ exeinto "${GAMES_PREFIX_OPT}/${PN}"
+ doexe kigb
+ dodoc doc/*
+ prepgamesdirs
+}
diff --git a/games-emulation/kigb/metadata.xml b/games-emulation/kigb/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/kigb/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/lxdream/Manifest b/games-emulation/lxdream/Manifest
new file mode 100644
index 000000000000..2e520ff0169f
--- /dev/null
+++ b/games-emulation/lxdream/Manifest
@@ -0,0 +1 @@
+DIST lxdream-0.9.1.tar.gz 2556802 SHA256 6ab26f1b5149233301d890f4677e1225aceb148fe2f813449c5568055f10ad70 SHA512 f56119e99f82931bb22cc596938caba09f02da9a7e74b6c8ce79880214e3566a9a8091b31f89d5dc56f0802d00ac485ce22c3468350d44b2e1cf140f22983055 WHIRLPOOL 32c43ce7c4f5e5ecad7ad33a8e707ae0f59885c63f98c17eba24ede138bf5cb5db81c36d10e0b4176dc62fc167e6455a6b8f57151f08074f2fc366ebb9abd8b3
diff --git a/games-emulation/lxdream/files/lxdream-0.9.1-glib-single-include.patch b/games-emulation/lxdream/files/lxdream-0.9.1-glib-single-include.patch
new file mode 100644
index 000000000000..7872174ed859
--- /dev/null
+++ b/games-emulation/lxdream/files/lxdream-0.9.1-glib-single-include.patch
@@ -0,0 +1,395 @@
+Index: lxdream-0.9.1/src/aica/audio.c
+===================================================================
+--- lxdream-0.9.1.orig/src/aica/audio.c
++++ lxdream-0.9.1/src/aica/audio.c
+@@ -19,7 +19,7 @@
+
+ #include "aica/aica.h"
+ #include "aica/audio.h"
+-#include <glib/gmem.h>
++#include <glib.h>
+ #include "dream.h"
+ #include <assert.h>
+ #include <string.h>
+Index: lxdream-0.9.1/src/aica/audio.h
+===================================================================
+--- lxdream-0.9.1.orig/src/aica/audio.h
++++ lxdream-0.9.1/src/aica/audio.h
+@@ -20,7 +20,7 @@
+
+ #include <stdint.h>
+ #include <stdio.h>
+-#include <glib/gtypes.h>
++#include <glib.h>
+ #include "gettext.h"
+ #include "plugin.h"
+
+Index: lxdream-0.9.1/src/cocoaui/cocoa_ctrl.m
+===================================================================
+--- lxdream-0.9.1.orig/src/cocoaui/cocoa_ctrl.m
++++ lxdream-0.9.1/src/cocoaui/cocoa_ctrl.m
+@@ -23,7 +23,7 @@
+ #include "maple/maple.h"
+ #include "vmu/vmulist.h"
+
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+
+ #define FIRST_SECONDARY_DEVICE MAPLE_PORTS
+
+Index: lxdream-0.9.1/src/cocoaui/paths_osx.m
+===================================================================
+--- lxdream-0.9.1.orig/src/cocoaui/paths_osx.m
++++ lxdream-0.9.1/src/cocoaui/paths_osx.m
+@@ -19,7 +19,7 @@
+ */
+
+ #include <string.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+
+ #include "lxdream.h"
+ #include "lxpaths.h"
+Index: lxdream-0.9.1/src/config.c
+===================================================================
+--- lxdream-0.9.1.orig/src/config.c
++++ lxdream-0.9.1/src/config.c
+@@ -21,8 +21,7 @@
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+-#include <glib/gmem.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include "dream.h"
+Index: lxdream-0.9.1/src/config.h
+===================================================================
+--- lxdream-0.9.1.orig/src/config.h
++++ lxdream-0.9.1/src/config.h
+@@ -19,8 +19,7 @@
+ #ifndef lxdream_config_H
+ #define lxdream_config_H 1
+
+-#include <glib/gtypes.h>
+-#include <glib/glist.h>
++#include <glib.h>
+ #include "gettext.h"
+
+ #ifdef __cplusplus
+Index: lxdream-0.9.1/src/drivers/input_lirc.c
+===================================================================
+--- lxdream-0.9.1.orig/src/drivers/input_lirc.c
++++ lxdream-0.9.1/src/drivers/input_lirc.c
+@@ -28,7 +28,6 @@
+ #include <dirent.h>
+ #include <ctype.h>
+
+-#include <glib/giochannel.h>
+ #include <glib.h>
+
+ #include <lirc/lirc_client.h>
+Index: lxdream-0.9.1/src/drivers/joy_linux.c
+===================================================================
+--- lxdream-0.9.1.orig/src/drivers/joy_linux.c
++++ lxdream-0.9.1/src/drivers/joy_linux.c
+@@ -32,7 +32,6 @@
+ #include <ctype.h>
+
+ #include <linux/joystick.h>
+-#include <glib/giochannel.h>
+ #include <glib.h>
+
+ #include "lxdream.h"
+Index: lxdream-0.9.1/src/drivers/osx_iokit.m
+===================================================================
+--- lxdream-0.9.1.orig/src/drivers/osx_iokit.m
++++ lxdream-0.9.1/src/drivers/osx_iokit.m
+@@ -19,8 +19,7 @@
+ * GNU General Public License for more details.
+ */
+
+-#include <glib/gmem.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+ #include <sys/param.h>
+ #include <paths.h>
+ #include <string.h>
+Index: lxdream-0.9.1/src/gdlist.c
+===================================================================
+--- lxdream-0.9.1.orig/src/gdlist.c
++++ lxdream-0.9.1/src/gdlist.c
+@@ -19,7 +19,7 @@
+
+ #include <string.h>
+ #include <stdlib.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+ #include <libgen.h>
+ #include "gettext.h"
+ #include "gdrom/gdrom.h"
+Index: lxdream-0.9.1/src/gdrom/gddriver.h
+===================================================================
+--- lxdream-0.9.1.orig/src/gdrom/gddriver.h
++++ lxdream-0.9.1/src/gdrom/gddriver.h
+@@ -24,7 +24,7 @@
+ #include <stdio.h>
+ #include "lxdream.h"
+ #include "gdrom/gdrom.h"
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+
+ #ifdef __cplusplus
+ extern "C" {
+Index: lxdream-0.9.1/src/gdrom/gdi.c
+===================================================================
+--- lxdream-0.9.1.orig/src/gdrom/gdi.c
++++ lxdream-0.9.1/src/gdrom/gdi.c
+@@ -23,7 +23,7 @@
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <sys/stat.h>
+-#include <glib/gutils.h>
++#include <glib.h>
+ #include "gdrom/gddriver.h"
+
+
+Index: lxdream-0.9.1/src/gdrom/gdrom.c
+===================================================================
+--- lxdream-0.9.1.orig/src/gdrom/gdrom.c
++++ lxdream-0.9.1/src/gdrom/gdrom.c
+@@ -20,7 +20,7 @@
+ #include <fcntl.h>
+ #include <errno.h>
+ #include <ctype.h>
+-#include <glib/gutils.h>
++#include <glib.h>
+ #include "gdrom/ide.h"
+ #include "gdrom/gdrom.h"
+ #include "gdrom/gddriver.h"
+Index: lxdream-0.9.1/src/gdrom/gdrom.h
+===================================================================
+--- lxdream-0.9.1.orig/src/gdrom/gdrom.h
++++ lxdream-0.9.1/src/gdrom/gdrom.h
+@@ -22,7 +22,7 @@
+
+ #include "lxdream.h"
+ #include "hook.h"
+-#include <glib/glist.h>
++#include <glib.h>
+
+ #ifdef __cplusplus
+ extern "C" {
+Index: lxdream-0.9.1/src/gdrom/nrg.c
+===================================================================
+--- lxdream-0.9.1.orig/src/gdrom/nrg.c
++++ lxdream-0.9.1/src/gdrom/nrg.c
+@@ -20,7 +20,7 @@
+ #include <assert.h>
+ #include <stdio.h>
+ #include <errno.h>
+-#include <glib/gtypes.h>
++#include <glib.h>
+ #include "gdrom/gddriver.h"
+ #include "dream.h"
+
+Index: lxdream-0.9.1/src/gui.h
+===================================================================
+--- lxdream-0.9.1.orig/src/gui.h
++++ lxdream-0.9.1/src/gui.h
+@@ -19,7 +19,7 @@
+ #ifndef lxdream_gui_H
+ #define lxdream_gui_H
+
+-#include <glib/gtypes.h>
++#include <glib.h>
+
+ #ifdef __cplusplus
+ extern "C" {
+Index: lxdream-0.9.1/src/loader.h
+===================================================================
+--- lxdream-0.9.1.orig/src/loader.h
++++ lxdream-0.9.1/src/loader.h
+@@ -20,7 +20,7 @@
+ #define lxdream_loader_H 1
+
+ #include <stdio.h>
+-#include <glib/gtypes.h>
++#include <glib.h>
+
+ #ifdef __cplusplus
+ extern "C" {
+Index: lxdream-0.9.1/src/lxdream.h
+===================================================================
+--- lxdream-0.9.1.orig/src/lxdream.h
++++ lxdream-0.9.1/src/lxdream.h
+@@ -20,7 +20,7 @@
+ #define lxdream_lxdream_H 1
+
+ #include <stdint.h>
+-#include <glib/gtypes.h>
++#include <glib.h>
+
+ #include "../config.h"
+
+Index: lxdream-0.9.1/src/lxpaths.c
+===================================================================
+--- lxdream-0.9.1.orig/src/lxpaths.c
++++ lxdream-0.9.1/src/lxpaths.c
+@@ -19,8 +19,7 @@
+ #include <ctype.h>
+ #include <unistd.h>
+ #include <wordexp.h>
+-#include <glib/gstrfuncs.h>
+-#include <glib/gutils.h>
++#include <glib.h>
+
+ #include "gui.h"
+ #include "config.h"
+Index: lxdream-0.9.1/src/maple/maple.c
+===================================================================
+--- lxdream-0.9.1.orig/src/maple/maple.c
++++ lxdream-0.9.1/src/maple/maple.c
+@@ -18,7 +18,7 @@
+ #define MODULE maple_module
+
+ #include <assert.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+ #include "dream.h"
+ #include "mem.h"
+ #include "asic.h"
+Index: lxdream-0.9.1/src/mem.c
+===================================================================
+--- lxdream-0.9.1.orig/src/mem.c
++++ lxdream-0.9.1/src/mem.c
+@@ -20,7 +20,7 @@
+ #include <sys/types.h>
+ #include <sys/mman.h>
+ #include <sys/stat.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+ #include <assert.h>
+ #include <stdint.h>
+ #include <stdlib.h>
+Index: lxdream-0.9.1/src/paths_unix.c
+===================================================================
+--- lxdream-0.9.1.orig/src/paths_unix.c
++++ lxdream-0.9.1/src/paths_unix.c
+@@ -18,7 +18,7 @@
+
+ #include <string.h>
+ #include <stdlib.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+
+ #include "lxdream.h"
+ #include "config.h"
+Index: lxdream-0.9.1/src/plugin.c
+===================================================================
+--- lxdream-0.9.1.orig/src/plugin.c
++++ lxdream-0.9.1/src/plugin.c
+@@ -20,8 +20,7 @@
+ #include <dirent.h>
+ #include <dlfcn.h>
+ #include <string.h>
+-#include <glib/gmem.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+ #include "plugin.h"
+ #include "lxpaths.h"
+
+Index: lxdream-0.9.1/src/pvr2/glutil.c
+===================================================================
+--- lxdream-0.9.1.orig/src/pvr2/glutil.c
++++ lxdream-0.9.1/src/pvr2/glutil.c
+@@ -17,7 +17,7 @@
+ */
+
+ #include <string.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+ #include "pvr2/glutil.h"
+
+ gboolean isGLSecondaryColorSupported()
+Index: lxdream-0.9.1/src/sh4/sh4core.h
+===================================================================
+--- lxdream-0.9.1.orig/src/sh4/sh4core.h
++++ lxdream-0.9.1/src/sh4/sh4core.h
+@@ -19,7 +19,7 @@
+ #ifndef lxdream_sh4core_H
+ #define lxdream_sh4core_H 1
+
+-#include <glib/gtypes.h>
++#include <glib.h>
+ #include <stdint.h>
+ #include <stdio.h>
+ #include "mem.h"
+Index: lxdream-0.9.1/src/syscall.h
+===================================================================
+--- lxdream-0.9.1.orig/src/syscall.h
++++ lxdream-0.9.1/src/syscall.h
+@@ -20,7 +20,7 @@
+ #define lxdream_syscall_H 1
+
+ #include <stdint.h>
+-#include <glib/gtypes.h>
++#include <glib.h>
+
+ #ifdef __cplusplus
+ extern "C" {
+Index: lxdream-0.9.1/src/tools/actparse.c
+===================================================================
+--- lxdream-0.9.1.orig/src/tools/actparse.c
++++ lxdream-0.9.1/src/tools/actparse.c
+@@ -21,7 +21,7 @@
+ #include <string.h>
+ #include <ctype.h>
+ #include <sys/stat.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+ #include "tools/gendec.h"
+
+ static int add_action( struct action *actions, struct ruleset *rules, char *operation, const char *file, int line, char *action )
+Index: lxdream-0.9.1/src/tools/gendec.c
+===================================================================
+--- lxdream-0.9.1.orig/src/tools/gendec.c
++++ lxdream-0.9.1/src/tools/gendec.c
+@@ -23,7 +23,7 @@
+ #include <getopt.h>
+ #include <errno.h>
+ #include <ctype.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+ #include <assert.h>
+ #include "tools/gendec.h"
+
+Index: lxdream-0.9.1/src/vmu/vmulist.c
+===================================================================
+--- lxdream-0.9.1.orig/src/vmu/vmulist.c
++++ lxdream-0.9.1/src/vmu/vmulist.c
+@@ -18,8 +18,7 @@
+
+ #include <string.h>
+ #include <stdlib.h>
+-#include <glib/glist.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+ #include "vmulist.h"
+ #include "config.h"
+
+Index: lxdream-0.9.1/src/vmu/vmuvol.c
+===================================================================
+--- lxdream-0.9.1.orig/src/vmu/vmuvol.c
++++ lxdream-0.9.1/src/vmu/vmuvol.c
+@@ -16,8 +16,7 @@
+ * GNU General Public License for more details.
+ */
+
+-#include <glib/gmem.h>
+-#include <glib/gstrfuncs.h>
++#include <glib.h>
+ #include <string.h>
+ #include <unistd.h>
+ #include <stdio.h>
diff --git a/games-emulation/lxdream/lxdream-0.9.1-r2.ebuild b/games-emulation/lxdream/lxdream-0.9.1-r2.ebuild
new file mode 100644
index 000000000000..4147ddf51d7c
--- /dev/null
+++ b/games-emulation/lxdream/lxdream-0.9.1-r2.ebuild
@@ -0,0 +1,63 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit eutils games
+
+DESCRIPTION="An emulator for the Sega Dreamcast system"
+HOMEPAGE="http://www.lxdream.org/"
+SRC_URI="http://www.lxdream.org/count.php?file=${P}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="debug lirc profile pulseaudio sdl"
+
+RDEPEND="lirc? ( app-misc/lirc )
+ media-libs/alsa-lib
+ media-libs/libpng
+ pulseaudio? ( media-sound/pulseaudio )
+ sdl? ( media-libs/libsdl[sound] )
+ virtual/opengl
+ x11-libs/gtk+:2"
+
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ sys-devel/gettext
+ virtual/os-headers"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PN}-0.9.1-glib-single-include.patch"
+
+ # Make .desktop file pass desktop-file-validate
+ sed -i \
+ -e '/Encoding/d' \
+ -e '/FilePattern/d' \
+ -e '/Categories/s|$|;|' \
+ ${PN}.desktop || die "sed failed"
+ # Do not override user-specified CFLAGS
+ sed -i \
+ -e s/'CFLAGS=\"-g -fexceptions\"'/'CFLAGS=\"${CFLAGS} -g -fexceptions\"'/ \
+ -e '/CCOPT/d' \
+ -e '/OBJCOPT/d' \
+ configure || die "sed failed"
+}
+
+src_configure() {
+ egamesconf \
+ --datadir="${GAMES_DATADIR_BASE}" \
+ $(use_enable debug trace) \
+ $(use_enable debug watch) \
+ $(use_enable profile profiled) \
+ $(use_with lirc) \
+ $(use_with pulseaudio pulse) \
+ $(use_with sdl) \
+ --without-esd
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc ChangeLog NEWS README
+ prepgamesdirs
+}
diff --git a/games-emulation/lxdream/metadata.xml b/games-emulation/lxdream/metadata.xml
new file mode 100644
index 000000000000..32d9f17722ef
--- /dev/null
+++ b/games-emulation/lxdream/metadata.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <maintainer>
+ <email>chithanh@gentoo.org</email>
+ <name>Chí-Thanh Christopher Nguyễn</name>
+ </maintainer>
+</pkgmetadata>
+
diff --git a/games-emulation/m64py/Manifest b/games-emulation/m64py/Manifest
new file mode 100644
index 000000000000..ece95c8dc3aa
--- /dev/null
+++ b/games-emulation/m64py/Manifest
@@ -0,0 +1 @@
+DIST m64py-0.2.1.tar.gz 304897 SHA256 6461b494291f22c10ccd60cda4d4750da3c1514e1d5bc2354bad95a9f4cc1525 SHA512 02d5bc4a501f3c9a5851f242119ad6436be9a59b832f27483591353cfad6975da677a124e61330a4430f1813259f5a423bc8413423ee43a3570d74239e33b487 WHIRLPOOL 5998dd86de565e09c392cef6a9bb94978c6ebbfb3169fc30ae075d291ded187efc16fcf0d380c3ae7a85ae74f3b333de786a202a17320348a0d75595f7e5c024
diff --git a/games-emulation/m64py/m64py-0.2.1-r1.ebuild b/games-emulation/m64py/m64py-0.2.1-r1.ebuild
new file mode 100644
index 000000000000..e20ece8b9d1d
--- /dev/null
+++ b/games-emulation/m64py/m64py-0.2.1-r1.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit distutils-r1
+
+DESCRIPTION="A frontend for Mupen64Plus"
+HOMEPAGE="http://m64py.sourceforge.net/"
+SRC_URI="mirror://sourceforge/m64py/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-3 public-domain GPL-2 BSD CC-BY-SA-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+# SDL & libmupen64plus are through ctypes, so they rely on specific ABI
+RDEPEND="media-libs/libsdl:0/0[joystick]
+ dev-python/PyQt4[opengl,${PYTHON_USEDEP}]
+ >=games-emulation/mupen64plus-core-2.0-r1:0/2"
+
+python_prepare_all() {
+ # set the correct search path
+ cat >> src/m64py/platform.py <<-_EOF_
+ SEARCH_DIRS = ["/usr/$(get_libdir)/mupen64plus"]
+_EOF_
+
+ # comment out SDL2 support since our mupen64plus uses SDL1
+ sed -e '/from m64py\.SDL2/s:^:#:' \
+ -e '/QT2SDL2\[/s:^:#:' \
+ -e '/KEYCODE2SCANCODE\[/s:^:#:' \
+ -e '/SCANCODE2KEYCODE\[/s:^:#:' \
+ -i src/m64py/frontend/keymap.py || die
+ sed -e '/--sdl2/d' \
+ -e '/SDL2/s:=.*$:= False:' \
+ -i src/m64py/opts.py || die
+
+ distutils-r1_python_prepare_all
+}
+
+pkg_postinst() {
+ local vr
+ for vr in ${REPLACING_VERSIONS}; do
+ if ! version_is_at_least 0.2.1-r1 ${vr}; then
+ ewarn
+ ewarn "Starting with mupen64plus-2.0-r1, the plugin install path has changed."
+ ewarn "In order for m64py to find mupen64plus, you will either need to set"
+ ewarn "new paths in configuration dialog or remove your configuration file."
+ ewarn "The new paths are:"
+ ewarn
+ ewarn " Library file: /usr/$(get_libdir)/libmupen64plus.so.2.0.0"
+ ewarn " Plugins directory: /usr/$(get_libdir)/mupen64plus"
+ ewarn " Data directory: /usr/share/mupen64plus"
+ fi
+ done
+
+ if ! type -P rar >/dev/null && ! type -P unrar >/dev/null; then
+ elog
+ elog "In order to gain RAR archive support, please install either app-arch/rar"
+ elog "or app-arch/unrar."
+ fi
+
+ if ! type -P 7z >/dev/null \
+ && ! has_version "dev-python/pylzma[${PYTHON_USEDEP}]"; then
+ elog
+ elog "In order to gain 7z archive support, please install either app-arch/p7zip"
+ elog "or dev-python/pylzma."
+ fi
+}
diff --git a/games-emulation/m64py/m64py-0.2.1.ebuild b/games-emulation/m64py/m64py-0.2.1.ebuild
new file mode 100644
index 000000000000..38ffbbff3e05
--- /dev/null
+++ b/games-emulation/m64py/m64py-0.2.1.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit distutils-r1 games
+
+DESCRIPTION="A frontend for Mupen64Plus"
+HOMEPAGE="http://m64py.sourceforge.net/"
+SRC_URI="mirror://sourceforge/m64py/${P}.tar.gz"
+
+LICENSE="GPL-3 LGPL-3 public-domain GPL-2 BSD CC-BY-SA-3.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+# SDL & libmupen64plus are through ctypes, so they rely on specific ABI
+RDEPEND="media-libs/libsdl:0/0[joystick]
+ dev-python/PyQt4[opengl,${PYTHON_USEDEP}]
+ games-emulation/mupen64plus-core:0/2"
+
+python_prepare_all() {
+ # set the correct search path
+ cat >> src/m64py/platform.py <<-_EOF_
+ SEARCH_DIRS = ["$(games_get_libdir)/mupen64plus"]
+_EOF_
+
+ # comment out SDL2 support since our mupen64plus uses SDL1
+ sed -e '/from m64py\.SDL2/s:^:#:' \
+ -e '/QT2SDL2\[/s:^:#:' \
+ -e '/KEYCODE2SCANCODE\[/s:^:#:' \
+ -e '/SCANCODE2KEYCODE\[/s:^:#:' \
+ -i src/m64py/frontend/keymap.py || die
+ sed -e '/--sdl2/d' \
+ -e '/SDL2/s:=.*$:= False:' \
+ -i src/m64py/opts.py || die
+
+ distutils-r1_python_prepare_all
+}
+
+python_install() {
+ distutils-r1_python_install \
+ --install-scripts="${GAMES_BINDIR}"
+}
+
+# games.eclass ABSOLUTELY MUST come last, so we need to clean up the mess
+src_prepare() { distutils-r1_src_prepare; }
+src_configure() { distutils-r1_src_configure; }
+src_compile() { distutils-r1_src_compile; }
+src_test() { distutils-r1_src_test; }
+
+src_install() {
+ distutils-r1_src_install
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+
+ if ! type -P rar >/dev/null && ! type -P unrar >/dev/null; then
+ elog
+ elog "In order to gain RAR archive support, please install either app-arch/rar"
+ elog "or app-arch/unrar."
+ fi
+
+ if ! type -P 7z >/dev/null \
+ && ! has_version "dev-python/pylzma[${PYTHON_USEDEP}]"; then
+ elog
+ elog "In order to gain 7z archive support, please install either app-arch/p7zip"
+ elog "or dev-python/pylzma."
+ fi
+}
diff --git a/games-emulation/m64py/metadata.xml b/games-emulation/m64py/metadata.xml
new file mode 100644
index 000000000000..666b089d291d
--- /dev/null
+++ b/games-emulation/m64py/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>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <maintainer>
+ <email>joker@gentoo.org</email>
+ <name>Christian Birchinger</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">m64py</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/mamory/Manifest b/games-emulation/mamory/Manifest
new file mode 100644
index 000000000000..4404caf5e19c
--- /dev/null
+++ b/games-emulation/mamory/Manifest
@@ -0,0 +1 @@
+DIST mamory-0.2.25.tar.gz 437223 SHA256 81593967a4f334d221ff23e066aa71d939c08d9a6e8b953e3912d76700c65e50 SHA512 d59539646fa61a3964e46123e0c8d09170f5561355e57b8c93dc89c11d99af1a2edeb60389e7f42b14f431c9c495c6ce20c70517ac4977ccaef62f0ed47f0d76 WHIRLPOOL 98437d6a4373a2e7cbd81f9183cf3b4be4e35486903e2104294e59a01c607c13630726aa10027fd3b153f99aaa2256b886eff8488da8209f137af289de201be4
diff --git a/games-emulation/mamory/mamory-0.2.25.ebuild b/games-emulation/mamory/mamory-0.2.25.ebuild
new file mode 100644
index 000000000000..e8049a40aaf4
--- /dev/null
+++ b/games-emulation/mamory/mamory-0.2.25.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit autotools games
+
+DESCRIPTION="ROM management tools and library"
+HOMEPAGE="http://mamory.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+IUSE=""
+
+DEPEND="dev-libs/expat"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ # Make sure the system expat is used
+ sed -i \
+ -e 's/#ifdef.*SYSEXPAT/#if 1/' \
+ mamory/amlxml.c mamory/amlxml.h || die
+
+ # Remove hardcoded CFLAGS options
+ sed -i \
+ -e '/AC_ARG_ENABLE(debug,/ {N;N;N;d}' \
+ configure.ac || die
+
+ # Make it possible for eautoreconf to fix fPIC etc.
+ sed -i \
+ -e '/libcommon_la_LDFLAGS= -static/d' \
+ common/Makefile.am || die
+
+ AT_M4DIR="config" eautoreconf
+}
+
+src_configure() {
+ egamesconf \
+ --includedir=/usr/include
+}
+
+src_install() {
+ default
+ dohtml DOCS/mamory.html
+ prepgamesdirs
+}
diff --git a/games-emulation/mamory/metadata.xml b/games-emulation/mamory/metadata.xml
new file mode 100644
index 000000000000..5c682e73e5bd
--- /dev/null
+++ b/games-emulation/mamory/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">mamory</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/mastergear-bin/Manifest b/games-emulation/mastergear-bin/Manifest
new file mode 100644
index 000000000000..e3f0f93617d0
--- /dev/null
+++ b/games-emulation/mastergear-bin/Manifest
@@ -0,0 +1 @@
+DIST MG20-Linux-80x86-bin.tar.Z 160293 SHA256 51f0af3e1c865abd2ab236e25ff7923851f22bd23a25481a1de1201adea10f5d SHA512 378d12d0977d773bf3aab0a4f138ea13b8ceff4db198849b8447e35ff1c43f9a997d7ee9b3bd2515fa40d4e462ea4dde3c0c8ef52a3680c67ea88db98889b7b4 WHIRLPOOL e8a08a7e8853fcffe5f3a5fb397c29b61292c6923538d9adba74c36ec5898959743c452e01510f3b6d90a0528ff24055cbe289c4a27ff964b2bc2bed157c1b30
diff --git a/games-emulation/mastergear-bin/mastergear-bin-2.0.ebuild b/games-emulation/mastergear-bin/mastergear-bin-2.0.ebuild
new file mode 100644
index 000000000000..862ac548cfe5
--- /dev/null
+++ b/games-emulation/mastergear-bin/mastergear-bin-2.0.ebuild
@@ -0,0 +1,29 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit games
+
+DESCRIPTION="SEGA Master System / Game Gear emulator"
+HOMEPAGE="http://fms.komkon.org/MG/"
+SRC_URI="http://fms.komkon.org/MG/MG${PV/\./}-Linux-80x86-bin.tar.Z"
+
+LICENSE="all-rights-reserved"
+SLOT="0"
+KEYWORDS="x86"
+IUSE=""
+RESTRICT="mirror bindist strip"
+
+RDEPEND="x11-libs/libXext
+ sys-libs/zlib"
+
+S=${WORKDIR}
+
+src_install() {
+ dogamesbin mg
+ insinto /usr/share/doc/${PF}
+ doins CART.ROM SF7000.ROM
+ dohtml MG.html
+ prepgamesdirs
+}
diff --git a/games-emulation/mastergear-bin/metadata.xml b/games-emulation/mastergear-bin/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/mastergear-bin/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/mednafen/Manifest b/games-emulation/mednafen/Manifest
new file mode 100644
index 000000000000..95cfdb7978e3
--- /dev/null
+++ b/games-emulation/mednafen/Manifest
@@ -0,0 +1 @@
+DIST mednafen-0.9.38.4.tar.bz2 3820560 SHA256 3298e2d5c03efbe638c2a98bf74435e306768461c65d2bb9b9a95e99dc463105 SHA512 3eb19a10e97cd285387fcf86eae09f550d248ab9c070750b1c0af0f334cce47ea375227df72cf7cdbc2193b311bab5e09108388a15634f694ef398b1a77ac3df WHIRLPOOL 17ae061668052fa33ce08b56d1aac75935bb91d02961d3dad042c07537ef15aa4374730652508941408764e7deb7cfe0969f80f32e6d642d20a32ac053bba491
diff --git a/games-emulation/mednafen/files/mednafen-0.9.38.4-automake-1.13.patch b/games-emulation/mednafen/files/mednafen-0.9.38.4-automake-1.13.patch
new file mode 100644
index 000000000000..14c69d94ef0e
--- /dev/null
+++ b/games-emulation/mednafen/files/mednafen-0.9.38.4-automake-1.13.patch
@@ -0,0 +1,11 @@
+--- mednafen-0.9.28-wip/mednafen/configure.ac
++++ mednafen-0.9.28-wip/mednafen/configure.ac
+@@ -13,7 +13,7 @@
+ AC_CANONICAL_TARGET
+ AM_INIT_AUTOMAKE([mednafen], $MEDNAFEN_VERSION)
+ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES])
+-AM_CONFIG_HEADER([include/config.h:include/config.h.in])
++AC_CONFIG_HEADERS([include/config.h:include/config.h.in])
+
+ AC_PROG_CC
+ AC_PROG_CPP
diff --git a/games-emulation/mednafen/files/mednafen-0.9.38.4-cflags.patch b/games-emulation/mednafen/files/mednafen-0.9.38.4-cflags.patch
new file mode 100644
index 000000000000..c43af818b6b8
--- /dev/null
+++ b/games-emulation/mednafen/files/mednafen-0.9.38.4-cflags.patch
@@ -0,0 +1,28 @@
+--- configure.ac.orig
++++ configure.ac
+@@ -80,25 +80,6 @@
+ AC_CHECK_LIB([z], [zlibVersion],[], AC_MSG_ERROR([*** zlib not found!]))
+ LIBS="$LIBS -lz"
+
+-OPTIMIZER_FLAGS=""
+-
+-dnl -ffast-math removed January 12, 2013. Don't re-add it, nor any of its sub-options(ESPECIALLY not -funsafe-math-optimizations),
+-dnl it messes up certain code(NES resampler, for example) under certain conditions and alignments of the great celestial squid.
+-dnl
+-dnl In fact, let's explicitly disable it here with -fno-fast-math.
+-dnl
+-dnl -fomit-frame-pointer is required for some x86 inline assembly to compile.
+-dnl
+-dnl November 28, 2014: Use -fwrapv unconditionally instead of -fno-strict-overflow, -fno-strict-overflow is buggy
+-dnl and does not work as documented/implied.
+-dnl
+-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([-fomit-frame-pointer], OPTIMIZER_FLAGS)
+-AX_CFLAGS_GCC_OPTION([-fwrapv], OPTIMIZER_FLAGS)
+-
+-
+ WARNING_FLAGS=""
+ AX_CFLAGS_GCC_OPTION([-Wall], WARNING_FLAGS)
+ AX_CFLAGS_GCC_OPTION([-Wshadow], WARNING_FLAGS)
diff --git a/games-emulation/mednafen/files/mednafen-0.9.38.4-zlib.patch b/games-emulation/mednafen/files/mednafen-0.9.38.4-zlib.patch
new file mode 100644
index 000000000000..5d930dae1b2c
--- /dev/null
+++ b/games-emulation/mednafen/files/mednafen-0.9.38.4-zlib.patch
@@ -0,0 +1,27 @@
+--- mednafen.orig/src/compress/Makefile.am.inc
++++ mednafen/src/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
+--- mednafen.orig/src/file.cpp
++++ mednafen/src/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"
+--- mednafen.orig/src/Makefile.am
++++ mednafen/src/Makefile.am
+@@ -6,7 +6,7 @@
+ bin_PROGRAMS = mednafen
+
+ mednafen_SOURCES = debug.cpp error.cpp mempatcher.cpp settings.cpp endian.cpp mednafen.cpp git.cpp file.cpp general.cpp memory.cpp netplay.cpp state.cpp state_rewind.cpp movie.cpp player.cpp PSFLoader.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.38.4.ebuild b/games-emulation/mednafen/mednafen-0.9.38.4.ebuild
new file mode 100644
index 000000000000..077a4b3af8cc
--- /dev/null
+++ b/games-emulation/mednafen/mednafen-0.9.38.4.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit autotools eutils flag-o-matic pax-utils games
+
+DESCRIPTION="An advanced NES, GB/GBC/GBA, TurboGrafx 16/CD, NGPC and Lynx emulator"
+HOMEPAGE="http://mednafen.sourceforge.net/"
+SRC_URI="mirror://sourceforge/mednafen/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE="alsa altivec cjk debugger jack nls pax_kernel"
+
+RDEPEND="virtual/opengl
+ media-libs/libsndfile
+ dev-libs/libcdio
+ media-libs/libsdl[sound,joystick,opengl,video]
+ media-libs/sdl-net
+ sys-libs/zlib[minizip]
+ 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() {
+ sed -i \
+ -e 's:$(datadir)/locale:/usr/share/locale:' \
+ $(find . -name Makefile.am) \
+ intl/Makefile.in || die
+ epatch \
+ "${FILESDIR}"/${P}-zlib.patch \
+ "${FILESDIR}"/${P}-cflags.patch \
+ "${FILESDIR}"/${P}-automake-1.13.patch
+ eautoreconf
+}
+
+src_configure() {
+ # very sensitive code (bug #539992)
+ strip-flags
+ append-flags -fomit-frame-pointer -fwrapv
+ egamesconf \
+ $(use_enable alsa) \
+ $(use_enable altivec) \
+ $(use_enable cjk cjk-fonts) \
+ $(use_enable debugger) \
+ $(use_enable jack) \
+ $(use_enable nls)
+}
+
+src_install() {
+ DOCS="Documentation/cheats.txt ChangeLog TODO" \
+ default
+ if use pax_kernel; then
+ pax-mark m "${D}${GAMES_BINDIR}"/mednafen || die
+ fi
+ prepgamesdirs
+}
diff --git a/games-emulation/mednafen/metadata.xml b/games-emulation/mednafen/metadata.xml
new file mode 100644
index 000000000000..0b0501c446a4
--- /dev/null
+++ b/games-emulation/mednafen/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <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>
diff --git a/games-emulation/mekanix/Manifest b/games-emulation/mekanix/Manifest
new file mode 100644
index 000000000000..84773eac3307
--- /dev/null
+++ b/games-emulation/mekanix/Manifest
@@ -0,0 +1 @@
+DIST mekanix070.tgz 759553 RMD160 1972c371fea6716a7fedbe5605fb90d0d7c51c69 SHA1 0cb0bde75b600c4766fb81f78c676cc07e3e8957 SHA256 5ed30cbd87c148923db843b4bbb8fdfbfea514c7e0056bd67f56483cf89d64a3
diff --git a/games-emulation/mekanix/mekanix-070.ebuild b/games-emulation/mekanix/mekanix-070.ebuild
new file mode 100644
index 000000000000..1612e5dea56f
--- /dev/null
+++ b/games-emulation/mekanix/mekanix-070.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+inherit games
+
+DESCRIPTION="SG-1000, SC-3000, SF-7000, SSC, SMS, GG, COLECO, and OMV emulator"
+HOMEPAGE="http://www.smspower.org/meka/"
+SRC_URI="http://www.smspower.org/meka/releases/${PN}${PV}.tgz"
+
+LICENSE="mekanix"
+SLOT="0"
+KEYWORDS="x86"
+RESTRICT="strip"
+IUSE=""
+
+RDEPEND="media-libs/libpng
+ x11-libs/libXpm"
+
+S=${WORKDIR}/${PN}
+
+src_install() {
+ local dir="${GAMES_PREFIX_OPT}/${PN}"
+
+ insinto "${dir}"
+ doins * || die "doins failed"
+ fperms a+x "${dir}/meka.exe"
+ games_make_wrapper mekanix ./meka.exe "${dir}"
+ prepgamesdirs
+}
diff --git a/games-emulation/mekanix/metadata.xml b/games-emulation/mekanix/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/mekanix/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/metadata.xml b/games-emulation/metadata.xml
new file mode 100644
index 000000000000..5f57686a0828
--- /dev/null
+++ b/games-emulation/metadata.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE catmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<catmetadata>
+ <longdescription lang="en">
+ The games-emulation category contains game platform emulators.
+ </longdescription>
+ <longdescription lang="de">
+ Die Kategorie games-emulation enthält Emulatoren für verschiedene
+ Spieleplattformen.
+ </longdescription>
+ <longdescription lang="es">
+ La categoría games-emulation contiene emuladores de juegos de plataforma.
+ </longdescription>
+ <longdescription lang="ja">
+ games-emulationカテゴリーにはプラットフォームをエミュレートしたゲームが
+ 含まれています。
+ </longdescription>
+ <longdescription lang="nl">
+ De games-emulation categorie bevat emulators voor verschillende spelcomputers.
+ </longdescription>
+ <longdescription lang="vi">
+ Nhóm games-emulation chứa các bộ mô phỏng nền chơi game.
+ </longdescription>
+ <longdescription lang="it">
+ La categoria games-emulation contiene emulatori di piattaforme di gioco.
+ </longdescription>
+ <longdescription lang="pt">
+ A categoria games-emulation contém emuladores de plataformas de
+ jogos.
+ </longdescription>
+ <longdescription lang="pl">
+ Kategoria games-emulation zawiera emulatory rozmaitych platform dla gier.
+ </longdescription>
+</catmetadata>
+
diff --git a/games-emulation/mupen64plus-audio-sdl/Manifest b/games-emulation/mupen64plus-audio-sdl/Manifest
new file mode 100644
index 000000000000..1def790ff8df
--- /dev/null
+++ b/games-emulation/mupen64plus-audio-sdl/Manifest
@@ -0,0 +1 @@
+DIST mupen64plus-audio-sdl-src-2.0.tar.gz 26084 SHA256 943ffa6b6cdaf0cda2a24469dfa1d8e951c88c41472ded9e5c9ecbc111363286 SHA512 92ee4755c22da5a753374c7c6f5e074bf6c1ab06a0ab27d475566d50f8ed75b636b59ffe1a8c9d3d63558bf5783b999a600703951679f7bab346643c0c86871d WHIRLPOOL 82a56a49f0ffe620917dba92bf135593c7e66e2944ec0688b29cc2d5362221b81f76e162840e315476d959b445d38f3bc1bf05538fbf1fa9de96b616835b2198
diff --git a/games-emulation/mupen64plus-audio-sdl/metadata.xml b/games-emulation/mupen64plus-audio-sdl/metadata.xml
new file mode 100644
index 000000000000..99eb91f82cd6
--- /dev/null
+++ b/games-emulation/mupen64plus-audio-sdl/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>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <maintainer>
+ <email>joker@gentoo.org</email>
+ <name>Christian Birchinger</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">mupen64plus/mupen64plus-audio-sdl</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/mupen64plus-audio-sdl/mupen64plus-audio-sdl-2.0-r1.ebuild b/games-emulation/mupen64plus-audio-sdl/mupen64plus-audio-sdl-2.0-r1.ebuild
new file mode 100644
index 000000000000..30b59708aa6c
--- /dev/null
+++ b/games-emulation/mupen64plus-audio-sdl/mupen64plus-audio-sdl-2.0-r1.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, SDL audio plugin"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="libsamplerate oss speex"
+
+RDEPEND=">=games-emulation/mupen64plus-core-2.0-r1:0=
+ media-libs/libsdl:0=[sound]
+ libsamplerate? ( media-libs/libsamplerate:0= )
+ speex? ( media-libs/speex:0= )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR=/usr/$(get_libdir)
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+
+ NO_SPEEX=$(usex speex 0 1)
+ NO_SRC=$(usex libsamplerate 0 1)
+ NO_OSS=$(usex oss 0 1)
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+}
diff --git a/games-emulation/mupen64plus-audio-sdl/mupen64plus-audio-sdl-2.0.ebuild b/games-emulation/mupen64plus-audio-sdl/mupen64plus-audio-sdl-2.0.ebuild
new file mode 100644
index 000000000000..6ef0a3c09b69
--- /dev/null
+++ b/games-emulation/mupen64plus-audio-sdl/mupen64plus-audio-sdl-2.0.ebuild
@@ -0,0 +1,86 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils toolchain-funcs games
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, SDL audio plugin"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="libsamplerate oss speex"
+
+RDEPEND="games-emulation/mupen64plus-core:0=
+ media-libs/libsdl:0=[sound]
+ libsamplerate? ( media-libs/libsamplerate:0= )
+ speex? ( media-libs/speex:0= )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR="$(games_get_libdir)"
+ PLUGINDIR="$(games_get_libdir)"/mupen64plus
+ SHAREDIR="${GAMES_DATADIR}"/mupen64plus
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+
+ NO_SPEEX=$(usex speex 0 1)
+ NO_SRC=$(usex libsamplerate 0 1)
+ NO_OSS=$(usex oss 0 1)
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+ prepgamesdirs
+}
diff --git a/games-emulation/mupen64plus-core/Manifest b/games-emulation/mupen64plus-core/Manifest
new file mode 100644
index 000000000000..19006ccfa9e7
--- /dev/null
+++ b/games-emulation/mupen64plus-core/Manifest
@@ -0,0 +1 @@
+DIST mupen64plus-core-src-2.0.tar.gz 1127862 SHA256 7e98795dbe4646b858919078f58a6ed94f7cfa30867df6cf44ef33da6aaa7a28 SHA512 6f7391536c23b465af737b3b64f3488bc0275c472e27f97f1d8be61e917c6772cad2c747db8ffa251ba88ba4f4c0d29de2451325f3ea4bcc6049534ef1dac41e WHIRLPOOL c32c97071d911696c9b24a931287ba7da1bdb29434300d984926a2a1b0541660022b6a811f616e8ed18de8d59fdafd168a571b248165c950d80f4e045e25aa53
diff --git a/games-emulation/mupen64plus-core/metadata.xml b/games-emulation/mupen64plus-core/metadata.xml
new file mode 100644
index 000000000000..c2134731fe1b
--- /dev/null
+++ b/games-emulation/mupen64plus-core/metadata.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <maintainer>
+ <email>joker@gentoo.org</email>
+ <name>Christian Birchinger</name>
+ </maintainer>
+ <use>
+ <flag name="new-dynarec">Enable new experimental dynamic recompiler implementation (only for x86 and arm)</flag>
+ <flag name="osd">Overlay emulator messages using on-screen-display</flag>
+ </use>
+ <longdescription>Mupen64Plus is a plugin-based N64 emulator for Linux which is capable of accurately playing many games.
+Included are four MIPS R4300 CPU emulators, with dynamic recompilers for 32-bit x86 and 64-bit amd64 systems.</longdescription>
+ <upstream>
+ <remote-id type="google-code">mupen64plus</remote-id>
+ <remote-id type="github">mupen64plus/mupen64plus-core</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/mupen64plus-core/mupen64plus-core-2.0-r1.ebuild b/games-emulation/mupen64plus-core/mupen64plus-core-2.0-r1.ebuild
new file mode 100644
index 000000000000..8d3cccd00a74
--- /dev/null
+++ b/games-emulation/mupen64plus-core/mupen64plus-core-2.0-r1.ebuild
@@ -0,0 +1,112 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, core library"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0/2"
+KEYWORDS="~amd64 ~x86"
+IUSE="lirc new-dynarec +osd cpu_flags_x86_sse"
+
+RDEPEND="media-libs/libpng:0=
+ media-libs/libsdl:0=[joystick,opengl,video]
+ sys-libs/zlib:0=[minizip]
+ lirc? ( app-misc/lirc:0 )
+ osd? (
+ media-fonts/ttf-bitstream-vera
+ media-libs/freetype:2=
+ virtual/opengl:0=
+ virtual/glu:0=
+ )
+ !<games-emulation/mupen64plus-2.0"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+# block versions using games.eclass
+RDEPEND="${RDEPEND}
+ !<games-emulation/m64py-0.2.1-r1
+ !<games-emulation/mupen64plus-audio-sdl-2.0-r1
+ !<games-emulation/mupen64plus-input-sdl-2.0-r1
+ !<games-emulation/mupen64plus-rsp-hle-2.0-r1
+ !<games-emulation/mupen64plus-ui-console-2.0-r1
+ !<games-emulation/mupen64plus-video-glide64mk2-2.0-r1
+ !<games-emulation/mupen64plus-video-rice-2.0-r1"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR=/usr/$(get_libdir)
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+
+ OSD=$(usex osd 1 0)
+ NO_ASM=$(usex cpu_flags_x86_sse 0 1)
+ LIRC=$(usex lirc 1 0)
+ # (it does not build)
+ # DEBUGGER=$(usex debug 1 0)
+ NEW_DYNAREC=$(usex new-dynarec 1 0)
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+ dodoc -r doc/{emuwiki-api-doc,new_dynarec.txt}
+
+ # replace bundled font with a symlink
+ # TODO: fix the code to not rely on it
+ local font_path=/usr/share/mupen64plus/font.ttf
+ rm "${D%/}/${font_path}" || die
+ if use osd; then
+ dosym /usr/share/fonts/ttf-bitstream-vera/Vera.ttf "${font_path}"
+ fi
+}
diff --git a/games-emulation/mupen64plus-core/mupen64plus-core-2.0.ebuild b/games-emulation/mupen64plus-core/mupen64plus-core-2.0.ebuild
new file mode 100644
index 000000000000..8c690e4fa473
--- /dev/null
+++ b/games-emulation/mupen64plus-core/mupen64plus-core-2.0.ebuild
@@ -0,0 +1,104 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils toolchain-funcs games
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, core library"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0/2"
+KEYWORDS="~amd64 ~x86"
+IUSE="lirc new-dynarec +osd cpu_flags_x86_sse"
+
+RDEPEND="media-libs/libpng:0=
+ media-libs/libsdl:0=[joystick,opengl,video]
+ sys-libs/zlib:0=[minizip]
+ lirc? ( app-misc/lirc:0 )
+ osd? (
+ media-fonts/ttf-bitstream-vera
+ media-libs/freetype:2=
+ virtual/opengl:0=
+ virtual/glu:0=
+ )
+ !<games-emulation/mupen64plus-2.0"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR="$(games_get_libdir)"
+ SHAREDIR="${GAMES_DATADIR}"/mupen64plus
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+
+ OSD=$(usex osd 1 0)
+ NO_ASM=$(usex cpu_flags_x86_sse 0 1)
+ LIRC=$(usex lirc 1 0)
+ # (it does not build)
+ # DEBUGGER=$(usex debug 1 0)
+ NEW_DYNAREC=$(usex new-dynarec 1 0)
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+ dodoc -r doc/{emuwiki-api-doc,new_dynarec.txt}
+
+ # replace bundled font with a symlink
+ # TODO: fix the code to not rely on it
+ local font_path=${GAMES_DATADIR}/mupen64plus/font.ttf
+ rm "${D%/}/${font_path}" || die
+ if use osd; then
+ dosym /usr/share/fonts/ttf-bitstream-vera/Vera.ttf "${font_path}"
+ fi
+ prepgamesdirs
+}
diff --git a/games-emulation/mupen64plus-input-sdl/Manifest b/games-emulation/mupen64plus-input-sdl/Manifest
new file mode 100644
index 000000000000..f0bddf13ebcf
--- /dev/null
+++ b/games-emulation/mupen64plus-input-sdl/Manifest
@@ -0,0 +1 @@
+DIST mupen64plus-input-sdl-src-2.0.tar.gz 43553 SHA256 b6be48e978683cced8c208ad03e27828c17ac7b2da5e699d6c34945db63d95b6 SHA512 adbeb83e01721aa74e5e65c05e4bff2a250c7bf51835a8b2c020752e9bf0bdb0f0672914fc5285ad9da2e6fa44259780aea6415d77914bb34e521f30eecf6747 WHIRLPOOL 647ccef13620c863077ae2eefb6934d966eaa413fe70437a38560e5fa03f479428e4848f2c2f3f38163a122a29f8b118fb50f9f772bfd1df96ab2860044352d7
diff --git a/games-emulation/mupen64plus-input-sdl/metadata.xml b/games-emulation/mupen64plus-input-sdl/metadata.xml
new file mode 100644
index 000000000000..9bc454e0f9f7
--- /dev/null
+++ b/games-emulation/mupen64plus-input-sdl/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>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <maintainer>
+ <email>joker@gentoo.org</email>
+ <name>Christian Birchinger</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">mupen64plus/mupen64plus-input-sdl</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/mupen64plus-input-sdl/mupen64plus-input-sdl-2.0-r1.ebuild b/games-emulation/mupen64plus-input-sdl/mupen64plus-input-sdl-2.0-r1.ebuild
new file mode 100644
index 000000000000..d7aa038d7566
--- /dev/null
+++ b/games-emulation/mupen64plus-input-sdl/mupen64plus-input-sdl-2.0-r1.ebuild
@@ -0,0 +1,77 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, SDL input plugin"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND=">=games-emulation/mupen64plus-core-2.0-r1:0=
+ media-libs/libsdl:0=[joystick]"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR=/usr/$(get_libdir)
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+}
diff --git a/games-emulation/mupen64plus-input-sdl/mupen64plus-input-sdl-2.0.ebuild b/games-emulation/mupen64plus-input-sdl/mupen64plus-input-sdl-2.0.ebuild
new file mode 100644
index 000000000000..11d3fdb1f028
--- /dev/null
+++ b/games-emulation/mupen64plus-input-sdl/mupen64plus-input-sdl-2.0.ebuild
@@ -0,0 +1,80 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils toolchain-funcs games
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, SDL input plugin"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="games-emulation/mupen64plus-core:0=
+ media-libs/libsdl:0=[joystick]"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR="$(games_get_libdir)"
+ PLUGINDIR="$(games_get_libdir)"/mupen64plus
+ SHAREDIR="${GAMES_DATADIR}"/mupen64plus
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+ prepgamesdirs
+}
diff --git a/games-emulation/mupen64plus-rsp-hle/Manifest b/games-emulation/mupen64plus-rsp-hle/Manifest
new file mode 100644
index 000000000000..0b5b6fd8fbba
--- /dev/null
+++ b/games-emulation/mupen64plus-rsp-hle/Manifest
@@ -0,0 +1 @@
+DIST mupen64plus-rsp-hle-src-2.0.tar.gz 46291 SHA256 61c2bd163b3506d206957ba690dfd1b4d2921a6c8a3883ab6a8ef1204de7b736 SHA512 e1caa121d377be0856708fa5c13c234abc0bbb2cab90f40963983baf6230a1d4a4b7da9af0fa2ed6737538265b6392d8a43e9e537ccbd63bbb6ee44da8b29fdf WHIRLPOOL 9b3b1557bfc301390b5069892c4fabead82d7a6f1bf28da7a51ce8345fbbb12e611756d4818f423936517fbc51b0839eb25b3e9acf88160a9857ac7c7eb9ab35
diff --git a/games-emulation/mupen64plus-rsp-hle/metadata.xml b/games-emulation/mupen64plus-rsp-hle/metadata.xml
new file mode 100644
index 000000000000..0387923b798f
--- /dev/null
+++ b/games-emulation/mupen64plus-rsp-hle/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>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <maintainer>
+ <email>joker@gentoo.org</email>
+ <name>Christian Birchinger</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">mupen64plus/mupen64plus-rsp-hle</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/mupen64plus-rsp-hle/mupen64plus-rsp-hle-2.0-r1.ebuild b/games-emulation/mupen64plus-rsp-hle/mupen64plus-rsp-hle-2.0-r1.ebuild
new file mode 100644
index 000000000000..a0b4e5a01076
--- /dev/null
+++ b/games-emulation/mupen64plus-rsp-hle/mupen64plus-rsp-hle-2.0-r1.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, HLE RSP plugin"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND=">=games-emulation/mupen64plus-core-2.0-r1:0="
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR=/usr/$(get_libdir)
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+}
diff --git a/games-emulation/mupen64plus-rsp-hle/mupen64plus-rsp-hle-2.0.ebuild b/games-emulation/mupen64plus-rsp-hle/mupen64plus-rsp-hle-2.0.ebuild
new file mode 100644
index 000000000000..1f5fbde785e4
--- /dev/null
+++ b/games-emulation/mupen64plus-rsp-hle/mupen64plus-rsp-hle-2.0.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils toolchain-funcs games
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, HLE RSP plugin"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="games-emulation/mupen64plus-core:0="
+DEPEND="${RDEPEND}"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR="$(games_get_libdir)"
+ PLUGINDIR="$(games_get_libdir)"/mupen64plus
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+ prepgamesdirs
+}
diff --git a/games-emulation/mupen64plus-ui-console/Manifest b/games-emulation/mupen64plus-ui-console/Manifest
new file mode 100644
index 000000000000..9af1c63c9bb5
--- /dev/null
+++ b/games-emulation/mupen64plus-ui-console/Manifest
@@ -0,0 +1 @@
+DIST mupen64plus-ui-console-src-2.0.tar.gz 37954 SHA256 87b9ac0a5ebbc835baa4e1fba0f50e7467e87da6469aa28fdb196e2040e54877 SHA512 7276e19772cfa047ea75c0c87930d7042a41d7d30912cae7f2c44e37ce6d446e8f5bf4e8ce89e69cabcb05185fe7b59a0ff5d12a7f7bbfa010404c2bedd94ea0 WHIRLPOOL 455a3fbb5eb0027ffbf52693e41f2fe8b5a098e32daa0d532b05f0841a35905beb0ffac9b942165d0b03f975468fff75f953cb9b9de02f8a5e49944e28dfccf8
diff --git a/games-emulation/mupen64plus-ui-console/metadata.xml b/games-emulation/mupen64plus-ui-console/metadata.xml
new file mode 100644
index 000000000000..cccfc63556e5
--- /dev/null
+++ b/games-emulation/mupen64plus-ui-console/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>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <maintainer>
+ <email>joker@gentoo.org</email>
+ <name>Christian Birchinger</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">mupen64plus/mupen64plus-ui-console</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/mupen64plus-ui-console/mupen64plus-ui-console-2.0-r1.ebuild b/games-emulation/mupen64plus-ui-console/mupen64plus-ui-console-2.0-r1.ebuild
new file mode 100644
index 000000000000..af1306e82436
--- /dev/null
+++ b/games-emulation/mupen64plus-ui-console/mupen64plus-ui-console-2.0-r1.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, console UI"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND=">=games-emulation/mupen64plus-core-2.0-r1:0=
+ media-libs/libsdl:0=
+ !<games-emulation/mupen64plus-2.0"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR=/usr/$(get_libdir)
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+}
diff --git a/games-emulation/mupen64plus-ui-console/mupen64plus-ui-console-2.0.ebuild b/games-emulation/mupen64plus-ui-console/mupen64plus-ui-console-2.0.ebuild
new file mode 100644
index 000000000000..9d64d99ef144
--- /dev/null
+++ b/games-emulation/mupen64plus-ui-console/mupen64plus-ui-console-2.0.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils toolchain-funcs games
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, console UI"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE=""
+
+RDEPEND="games-emulation/mupen64plus-core:0=
+ media-libs/libsdl:0=
+ !<games-emulation/mupen64plus-2.0"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ BINDIR="${GAMES_BINDIR}"
+ LIBDIR="$(games_get_libdir)"
+ COREDIR="$(games_get_libdir)/"
+ PLUGINDIR="$(games_get_libdir)"/mupen64plus
+ SHAREDIR="${GAMES_DATADIR}"/mupen64plus
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+ prepgamesdirs
+}
diff --git a/games-emulation/mupen64plus-video-glide64mk2/Manifest b/games-emulation/mupen64plus-video-glide64mk2/Manifest
new file mode 100644
index 000000000000..891c395ef036
--- /dev/null
+++ b/games-emulation/mupen64plus-video-glide64mk2/Manifest
@@ -0,0 +1 @@
+DIST mupen64plus-video-glide64mk2-src-2.0.tar.gz 445166 SHA256 7761594432e90aed2dd12a5f16b30674c65b1f1abad0d98ac6239c3b2c44a4d5 SHA512 043b84927219b574da3c489119007bd115c9fa0f3f476ea9e812c8321a7f1e9309af06bed0b975c00201bc35f925d3b85c3411aa02310fd1ea508191184afa9a WHIRLPOOL b55c7412139b5b31fc919947068a7ad06958b20e54b9ac350cac88af3fec0d03d4f36675c1b60ba330061e652d489113bd7b84f53e7677c3cc1f0039c2a135af
diff --git a/games-emulation/mupen64plus-video-glide64mk2/metadata.xml b/games-emulation/mupen64plus-video-glide64mk2/metadata.xml
new file mode 100644
index 000000000000..7eb8e678ad77
--- /dev/null
+++ b/games-emulation/mupen64plus-video-glide64mk2/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <maintainer>
+ <email>joker@gentoo.org</email>
+ <name>Christian Birchinger</name>
+ </maintainer>
+ <use>
+ <flag name="hires">Support hi-resolution textures (requires <pkg>dev-libs/boost</pkg>)</flag>
+ </use>
+ <upstream>
+ <remote-id type="github">mupen64plus/mupen64plus-video-glide64mk2</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/mupen64plus-video-glide64mk2/mupen64plus-video-glide64mk2-2.0-r1.ebuild b/games-emulation/mupen64plus-video-glide64mk2/mupen64plus-video-glide64mk2-2.0-r1.ebuild
new file mode 100644
index 000000000000..8188bd749b2d
--- /dev/null
+++ b/games-emulation/mupen64plus-video-glide64mk2/mupen64plus-video-glide64mk2-2.0-r1.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, glide64mk2 video plugin"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="hires cpu_flags_x86_sse"
+
+RDEPEND=">=games-emulation/mupen64plus-core-2.0-r1:0=
+ media-libs/libpng:0=
+ media-libs/libsdl:0=
+ sys-libs/zlib:0=
+ virtual/opengl:0=
+ hires? ( dev-libs/boost:0= )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR=/usr/$(get_libdir)
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+
+ NO_ASM=$(usex cpu_flags_x86_sse 0 1)
+ HIRES=$(usex hires 1 0)
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+}
diff --git a/games-emulation/mupen64plus-video-glide64mk2/mupen64plus-video-glide64mk2-2.0.ebuild b/games-emulation/mupen64plus-video-glide64mk2/mupen64plus-video-glide64mk2-2.0.ebuild
new file mode 100644
index 000000000000..8168f533cadd
--- /dev/null
+++ b/games-emulation/mupen64plus-video-glide64mk2/mupen64plus-video-glide64mk2-2.0.ebuild
@@ -0,0 +1,87 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils toolchain-funcs games
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, glide64mk2 video plugin"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="hires cpu_flags_x86_sse"
+
+RDEPEND="games-emulation/mupen64plus-core:0=
+ media-libs/libpng:0=
+ media-libs/libsdl:0=
+ sys-libs/zlib:0=
+ virtual/opengl:0=
+ hires? ( dev-libs/boost:0= )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR="$(games_get_libdir)"
+ PLUGINDIR="$(games_get_libdir)"/mupen64plus
+ SHAREDIR="${GAMES_DATADIR}"/mupen64plus
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+
+ NO_ASM=$(usex cpu_flags_x86_sse 0 1)
+ HIRES=$(usex hires 1 0)
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+ prepgamesdirs
+}
diff --git a/games-emulation/mupen64plus-video-rice/Manifest b/games-emulation/mupen64plus-video-rice/Manifest
new file mode 100644
index 000000000000..0ae3e56f2894
--- /dev/null
+++ b/games-emulation/mupen64plus-video-rice/Manifest
@@ -0,0 +1 @@
+DIST mupen64plus-video-rice-src-2.0.tar.gz 362013 SHA256 3eb076e7c38ab45c9ec752d30e00eca022a9e0c6ead1a22df13ad94902e08238 SHA512 bbab67be20b6d2ed6a246de8a2b955051489ac128ddecff0e3fc54782fc1d17ed8f9e1cded22d215b2c5c865b4b5fe831fffb28803247a2e494746565d23d764 WHIRLPOOL ab4399e0c70351e69995a5f40aa308b4d37489b7997d8a0eae97a183c62eea6976469c1e420c04cd24f9c32e9828d677264ce684e57af2500e7e57047bf98011
diff --git a/games-emulation/mupen64plus-video-rice/metadata.xml b/games-emulation/mupen64plus-video-rice/metadata.xml
new file mode 100644
index 000000000000..9af84f31de74
--- /dev/null
+++ b/games-emulation/mupen64plus-video-rice/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>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <maintainer>
+ <email>joker@gentoo.org</email>
+ <name>Christian Birchinger</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">mupen64plus/mupen64plus-video-rice</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/mupen64plus-video-rice/mupen64plus-video-rice-2.0-r1.ebuild b/games-emulation/mupen64plus-video-rice/mupen64plus-video-rice-2.0-r1.ebuild
new file mode 100644
index 000000000000..00b74b07443c
--- /dev/null
+++ b/games-emulation/mupen64plus-video-rice/mupen64plus-video-rice-2.0-r1.ebuild
@@ -0,0 +1,81 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils multilib toolchain-funcs
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, rice video plugin"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="cpu_flags_x86_sse"
+
+RDEPEND=">=games-emulation/mupen64plus-core-2.0-r1:0=
+ media-libs/libpng:0=
+ media-libs/libsdl:0=[video]
+ virtual/opengl:0="
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR=/usr/$(get_libdir)
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+
+ NO_ASM=$(usex cpu_flags_x86_sse 0 1)
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+}
diff --git a/games-emulation/mupen64plus-video-rice/mupen64plus-video-rice-2.0.ebuild b/games-emulation/mupen64plus-video-rice/mupen64plus-video-rice-2.0.ebuild
new file mode 100644
index 000000000000..14ded5038e87
--- /dev/null
+++ b/games-emulation/mupen64plus-video-rice/mupen64plus-video-rice-2.0.ebuild
@@ -0,0 +1,84 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+MY_P=${PN}-src-${PV}
+inherit eutils toolchain-funcs games
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, rice video plugin"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="https://github.com/mupen64plus/${PN}/releases/download/${PV}/${MY_P}.tar.gz"
+
+LICENSE="GPL-2 LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="cpu_flags_x86_sse"
+
+RDEPEND="games-emulation/mupen64plus-core:0=
+ media-libs/libpng:0=
+ media-libs/libsdl:0=[video]
+ virtual/opengl:0="
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ epatch_user
+
+ # avoid implicitly appending CPU flags
+ sed -i -e 's:-mmmx::g' -e 's:-msse::g' projects/unix/Makefile || die
+}
+
+src_compile() {
+ MAKEARGS=(
+ # Note: please keep this in sync in all of mupen64plus-* packages
+
+ -C projects/unix
+
+ # this basically means: GNU userspace
+ UNAME=Linux
+
+ # verbose output
+ V=1
+
+ CROSS_COMPILE="${CHOST}-"
+ CC="$(tc-getCC)"
+ CXX="$(tc-getCXX)"
+ PKG_CONFIG="$(tc-getPKG_CONFIG)"
+ # usual CFLAGS, CXXFLAGS and LDFLAGS are respected
+ # so we can leave OPTFLAGS empty
+ OPTFLAGS=
+
+ # paths, some of them are used at compile time
+ PREFIX=/usr
+ LIBDIR="$(games_get_libdir)"
+ PLUGINDIR="$(games_get_libdir)"/mupen64plus
+ SHAREDIR="${GAMES_DATADIR}"/mupen64plus
+
+ # disable unwanted magic
+ LDCONFIG=:
+ INSTALL_STRIP_FLAG=
+
+ # Package-specific stuff
+
+ # CROSS_COMPILE causes it to look for ${CHOST}-sdl-config...
+ SDL_CFLAGS="$($(tc-getPKG_CONFIG) --cflags sdl)"
+ SDL_LDLIBS="$($(tc-getPKG_CONFIG) --libs sdl)"
+
+ NO_ASM=$(usex cpu_flags_x86_sse 0 1)
+ )
+
+ use amd64 && MAKEARGS+=( HOST_CPU=x86_64 )
+ use x86 && MAKEARGS+=( HOST_CPU=i386 )
+
+ emake "${MAKEARGS[@]}" all
+}
+
+src_install() {
+ emake "${MAKEARGS[@]}" DESTDIR="${D}" install
+ einstalldocs
+ prepgamesdirs
+}
diff --git a/games-emulation/mupen64plus/Manifest b/games-emulation/mupen64plus/Manifest
new file mode 100644
index 000000000000..bf3a3996592c
--- /dev/null
+++ b/games-emulation/mupen64plus/Manifest
@@ -0,0 +1,3 @@
+DIST Mupen64Plus-1-5-src.tar.gz 2348443 SHA256 58b2da6095ed8f3bcdcb5d7612bb0f1ba81cda1861ca784ef7e46991fd73cf3f SHA512 548be341e69eee543288a0a347ee117341847a032cc0a668a75ab7aaa881e876b6d143d2da9f8ec7580e4b1bbd2b36a3c8f99a0cb8c2301e4b03b593cdee5eb4 WHIRLPOOL fe5e63f07cc50676ef796a96d19e51eef38744f40e1626fd59471a65e530ac78109253ceb4f25cb9df2b4d33f4eecd47be1b9c7fa1a5d7a2304b98bdab0ef137
+DIST mupen64plus-1.5-patches-20091123.tar.bz2 25579 SHA256 b4bebb8105d7ca083b1e3d96d23dea9f2170703d53b0ea75e09b428e73e43187 SHA512 1fccfaed0d0a6d4bc3382a21b1529a173faa4fc718fd4dc6d94a850f5ad3788103041a202774c09f6db9a409b4de256a8b4a746f58860f13c8f69cc6243a9c3f WHIRLPOOL 5ed3fa14eb8a9c0b4fad71d70495125ebfe2313d23edf6155b7056fe9b583ceaeb860cf6b6df574caca315db54af786fda66871621bc1547f929f8f6e6161193
+DIST mupen64plus-1.5-patches-20100507.tar.bz2 33484 SHA256 372e437ab9d53eda23fd63cede33be38114efe527f239ef41b0c904fe208e2ce SHA512 f0265cbcc2e60bac906611a74bb7f5ea94a625d3abeee127fa105a308e9388258e2854ad91256fe14343f9b8837dfe43cb4eca16176a375f07c1259729045213 WHIRLPOOL c3fa3562bda7bd8a01fbc1644fbc7caa511bffec0efde7da479e40066bb8e31952bf98c718ab96b12211429835c458a9ab94c8fe8da540c301c83806e3bb1af1
diff --git a/games-emulation/mupen64plus/files/README.gentoo-patches-20091123 b/games-emulation/mupen64plus/files/README.gentoo-patches-20091123
new file mode 100644
index 000000000000..96994d798b7a
--- /dev/null
+++ b/games-emulation/mupen64plus/files/README.gentoo-patches-20091123
@@ -0,0 +1,55 @@
+All patches below 500 are from the Debian git repository (Nov 23 12:35 CET 2009):
+
+http://git.debian.org/?p=collab-maint/mupen64plus.git;a=tree;f=debian/patches;hb=master
+
+Patches included:
+=================
+
+fix-desktop-file.patch
+destdir.patch
+dejavu-font.patch
+as-needed.patch
+system-libpng.patch
+system-zlib.patch
+system-libbz2.patch
+remove-gln64.patch
+remove-nondfsg-icons.patch
+glide64-noasm.patch
+rice-texturepack-crash.patch
+rice-screenflickering.patch
+static-binutils-libs.patch
+fix-7z-subfolder.patch
+ftbfs-dynarec.patch
+ftbfs-kfreebsd.patch
+ftbfs-debugger.patch
+debian-archs.patch
+ftbfs-glibc210.patch
+version-string.patch
+default-optimisations.patch
+gtk-open-filter.patch
+noexecstack.patch
+fix_readpng.patch
+jttl_fix_romclosed.patch
+rice_nodebug.patch
+interpreter_x86_fldcw.patch
+correct_fpr32_mapping.patch
+load_aidacrate.patch
+load_vistatus.patch
+fix_r0_override.patch
+resume_on_start.patch
+osd-pause-crash.patch
+system-liblzma.patch
+- system-liblzma got changed to work without the droped xdg-basedir.patch
+
+Patches excluded:
+=================
+
+plugin-searchpath.patch
+xdg-basedir.patch
+- Because Gentoo uses different locations like /usr/games/lib(64) and /usr/share/games.
+ The usage of xdg patch location standards would ne nice though.
+
+A big thanks to all the authors of the patches.
+
+Have fun
+Christian Birchinger <joker@gentoo.org>
diff --git a/games-emulation/mupen64plus/files/README.gentoo-patches-20100507 b/games-emulation/mupen64plus/files/README.gentoo-patches-20100507
new file mode 100644
index 000000000000..e6b857a07d48
--- /dev/null
+++ b/games-emulation/mupen64plus/files/README.gentoo-patches-20100507
@@ -0,0 +1,59 @@
+All patches below 500 are from the Debian git repository (May 07 2010):
+
+http://git.debian.org/?p=collab-maint/mupen64plus.git;a=tree;f=debian/patches;hb=master
+
+Patches included:
+=================
+
+fix-desktop-file.patch
+destdir.patch
+- dejavu-font.patch adjusted the font path to the font location on Gentoo systems
+as-needed.patch
+system-libpng.patch
+system-zlib.patch
+system-libbz2.patch
+remove-gln64.patch
+remove-nondfsg-icons.patch
+glide64-noasm.patch
+rice-texturepack-crash.patch
+rice-screenflickering.patch
+static-binutils-libs.patch
+fix-7z-subfolder.patch
+ftbfs-dynarec.patch
+ftbfs-kfreebsd.patch
+ftbfs-debugger.patch
+debian-archs.patch
+ftbfs-glibc210.patch
+version-string.patch
+default-optimisations.patch
+gtk-open-filter.patch
+noexecstack.patch
+fix_readpng.patch
+jttl_fix_romclosed.patch
+rice_nodebug.patch
+interpreter_x86_fldcw.patch
+correct_fpr32_mapping.patch
+load_aidacrate.patch
+load_vistatus.patch
+fix_r0_override.patch
+resume_on_start.patch
+osd-pause-crash.patch
+system-liblzma.patch
+ftbfs-gvariant-type-conflicts.path
+rsp_ucode2_reset.patch
+rsp_hle_bigendian.patch
+rice-crash-vendorstring.patch
+- system-liblzma got changed to work without the droped xdg-basedir.patch
+
+Patches excluded:
+=================
+
+plugin-searchpath.patch
+xdg-basedir.patch
+- Because Gentoo uses different locations like /usr/games/lib(64) and /usr/share/games.
+ The usage of xdg patch location standards would ne nice though.
+
+A big thanks to all the authors of the patches.
+
+Have fun
+Christian Birchinger <joker@gentoo.org>
diff --git a/games-emulation/mupen64plus/files/ftbfs-gvariant-type-conflicts.patch b/games-emulation/mupen64plus/files/ftbfs-gvariant-type-conflicts.patch
new file mode 100644
index 000000000000..e76da1707285
--- /dev/null
+++ b/games-emulation/mupen64plus/files/ftbfs-gvariant-type-conflicts.patch
@@ -0,0 +1,27 @@
+Description: Fix FTBFS due to glib gvariant type definitions
+Forwarded: not-needed
+Bug-Debian: http://bugs.debian.org/577329
+Author: Sven Eckelmann <sven.eckelmann@gmx.de>
+
+---
+diff --git a/rice_video/typedefs.h b/rice_video/typedefs.h
+index 4cded542b06445f043fa1fabf77e4d20c9d52920..b7e16e9c4ba3248f9fed9762f79349c137ee2026 100644
+--- a/rice_video/typedefs.h
++++ b/rice_video/typedefs.h
+@@ -20,10 +20,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ #ifndef _TYPEDEFS_H_
+ #define _TYPEDEFS_H_
+
+-#define uchar unsigned char
+-#define uint16 unsigned short
+-#define uint32 unsigned int
+-#define uint64 unsigned long long
++#include <stdint.h>
++
++typedef uint8_t uchar;
++typedef uint16_t uint16;
++typedef uint32_t uint32;
++typedef uint64_t uint64;
+
+ typedef unsigned char uint8;
+
diff --git a/games-emulation/mupen64plus/files/mupen64plus-1.5-gcc46.patch b/games-emulation/mupen64plus/files/mupen64plus-1.5-gcc46.patch
new file mode 100644
index 000000000000..2608fcd32a77
--- /dev/null
+++ b/games-emulation/mupen64plus/files/mupen64plus-1.5-gcc46.patch
@@ -0,0 +1,11 @@
+--- pre.mk.old 2011-04-14 20:39:21.000000000 +0200
++++ pre.mk 2011-04-14 20:39:57.000000000 +0200
+@@ -319,7 +319,7 @@
+ # tweak flags for 32-bit build on 64-bit system
+ ifeq ($(ARCH), 64BITS_32)
+ CFLAGS += -m32
+- LDFLAGS += -m32 -m elf_i386
++ LDFLAGS += -m32 -Wl,-m,elf_i386
+ endif
+ endif
+ ifeq ($(CPU_ENDIANNESS), BIG)
diff --git a/games-emulation/mupen64plus/files/mupen64plus-1.5-libpng14.patch b/games-emulation/mupen64plus/files/mupen64plus-1.5-libpng14.patch
new file mode 100644
index 000000000000..8d0b447fe96b
--- /dev/null
+++ b/games-emulation/mupen64plus/files/mupen64plus-1.5-libpng14.patch
@@ -0,0 +1,34 @@
+http://bugs.gentoo.org/show_bug.cgi?id=308753
+
+--- rice_video/liblinux/pngrw.c
++++ rice_video/liblinux/pngrw.c
+@@ -136,9 +136,9 @@
+ if (end_info != NULL)
+ png_destroy_read_struct((png_structp *) &png_ptr, (png_infop *) &info_ptr, (png_infop *) &end_info);
+ else if (info_ptr != NULL)
+- png_destroy_read_struct((png_structp *) &png_ptr, (png_infop *) &info_ptr, png_infopp_NULL);
++ png_destroy_read_struct((png_structp *) &png_ptr, (png_infop *) &info_ptr, NULL);
+ else if (png_ptr != NULL)
+- png_destroy_read_struct((png_structp *) &png_ptr, png_infopp_NULL, png_infopp_NULL);
++ png_destroy_read_struct((png_structp *) &png_ptr, NULL, NULL);
+ if (rows)
+ {
+ if (rows[0])
+@@ -162,7 +162,7 @@
+
+ /* check the signature */
+ fread( signature, 1, 8, file );
+- if ( !png_check_sig( signature, 8 ) )
++ if ( png_sig_cmp( signature, 0, 8 ) )
+ longjmp( err_jmp, (int)errUnsupportedFileFormat );
+
+ /* create a pointer to the png read structure */
+@@ -199,7 +199,7 @@
+
+ /* extract the data we need to form the HBITMAP from the PNG header */
+ png_get_IHDR( png_ptr, info_ptr, &Width, &Height, &BitDepth, &ColorType,
+- &InterlaceType, int_p_NULL, int_p_NULL);
++ &InterlaceType, (int *) NULL, (int *) NULL);
+
+ img->width = Width;
+ img->height = Height;
diff --git a/games-emulation/mupen64plus/files/mupen64plus-1.5-minizip.patch b/games-emulation/mupen64plus/files/mupen64plus-1.5-minizip.patch
new file mode 100644
index 000000000000..9ed3d7a0b256
--- /dev/null
+++ b/games-emulation/mupen64plus/files/mupen64plus-1.5-minizip.patch
@@ -0,0 +1,35 @@
+use minizip from system zlib
+
+https://bugs.gentoo.org/383845
+
+--- a/Makefile
++++ b/Makefile
+@@ -101,8 +101,6 @@
+ main/plugin.o \
+ main/rom.o \
+ main/savestates.o \
+- main/zip/ioapi.o \
+- main/zip/unzip.o \
+ main/7zip/7zAlloc.o \
+ main/7zip/7zBuffer.o \
+ main/7zip/7zCrc.o \
+@@ -229,7 +227,7 @@
+ # set primary objects and libraries for all outputs
+ ALL = mupen64plus $(PLUGINS)
+ OBJECTS = $(OBJ_CORE) $(OBJ_DYNAREC) $(OBJ_OPENGL)
+-LIBS = $(SDL_LIBS) $(LIBGL_LIBS) $(LZMA_LIBS) -lbz2
++LIBS = $(SDL_LIBS) $(LIBGL_LIBS) $(LZMA_LIBS) -lbz2 -lminizip
+ STATIC_LIBS =
+ CFLAGS+= $(LZMA_FLAGS)
+
+--- a/main/rom.c
++++ b/main/rom.c
+@@ -27,7 +27,7 @@
+ #include <limits.h>
+ #include <zlib.h>
+
+-#include "zip/unzip.h"
++#include "minizip/unzip.h"
+ #include <bzlib.h>
+ #include <lzma.h>
+ #include "7zip/7zExtract.h"
diff --git a/games-emulation/mupen64plus/metadata.xml b/games-emulation/mupen64plus/metadata.xml
new file mode 100644
index 000000000000..8d1417ef3b1c
--- /dev/null
+++ b/games-emulation/mupen64plus/metadata.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <maintainer>
+ <email>joker@gentoo.org</email>
+ <name>Christian Birchinger</name>
+ </maintainer>
+ <use>
+ <flag name='audio-sdl'>Enable SDL audio plugin.</flag>
+ <flag name='input-sdl'>Enable SDL input plugin.</flag>
+ <flag name='rsp-hle'>Enable HLE RSP plugin.</flag>
+ <flag name='ui-console'>Enable default console UI.</flag>
+ <flag name='ui-m64py'>Enable PyQt4 UI using <pkg>games-emulation/m64py</pkg>.</flag>
+ <flag name='video-glide64mk2'>Enable Glide64mk2 video plugin.</flag>
+ <flag name='video-rice'>Enable Rice video plugin.</flag>
+ </use>
+ <longdescription>Mupen64Plus is a plugin-based N64 emulator for Linux which is capable of accurately playing many games.
+Included are four MIPS R4300 CPU emulators, with dynamic recompilers for 32-bit x86 and 64-bit amd64 systems,
+and necessary plugins for audio, graphical rendering (RDP), signal co-processor (RSP), and input.
+There are 3 OpenGL video plugins included: glN64, RiceVideoLinux, and Glide64.</longdescription>
+ <upstream>
+ <remote-id type="google-code">mupen64plus</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/mupen64plus/mupen64plus-1.5-r1.ebuild b/games-emulation/mupen64plus/mupen64plus-1.5-r1.ebuild
new file mode 100644
index 000000000000..8f348ac98236
--- /dev/null
+++ b/games-emulation/mupen64plus/mupen64plus-1.5-r1.ebuild
@@ -0,0 +1,130 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils flag-o-matic games
+
+MY_P="Mupen64Plus-${PV/./-}-src"
+
+PATCH_VERSION="20091123"
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="http://mupen64plus.googlecode.com/files/${MY_P}.tar.gz mirror://gentoo/${P}-patches-${PATCH_VERSION}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="+gtk libsamplerate lirc qt4 cpu_flags_x86_sse"
+
+# GTK+ is currently required by plugins even if no GUI support is enabled
+RDEPEND="virtual/opengl
+ media-libs/freetype:2
+ media-libs/libpng
+ media-libs/libsdl
+ media-libs/sdl-ttf
+ sys-libs/zlib
+ x11-libs/gtk+:2
+ libsamplerate? ( media-libs/libsamplerate )
+ lirc? ( app-misc/lirc )
+ qt4? ( dev-qt/qtgui:4
+ dev-qt/qtcore:4 )
+ app-arch/xz-utils"
+
+DEPEND="${RDEPEND}
+ dev-lang/yasm
+ virtual/pkgconfig"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ if ! use gtk && ! use qt4; then
+ ewarn "Building ${PN} without any GUI! To get one, enable USE=gtk or USE=qt4."
+ elif use gtk && use qt4; then
+ ewarn "Only one GUI can be built, using GTK+ one."
+ fi
+
+ games_pkg_setup
+}
+
+src_prepare() {
+ EPATCH_SOURCE="${WORKDIR}/patches" EPATCH_SUFFIX="patch" \
+ epatch
+
+ epatch "${FILESDIR}"/${P}-libpng14.patch
+
+ # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=577329
+ epatch "${FILESDIR}"/ftbfs-gvariant-type-conflicts.patch
+
+ sed -i \
+ -e "s:/usr/local/share/mupen64plus:${GAMES_DATADIR}/mupen64plus:" \
+ -e "s:%PUT_PLUGIN_PATH_HERE%:$(games_get_libdir)/${PN}/plugins/:" \
+ main/main.c || die "sed failed"
+
+ # Fix 010_all_fix-desktop-file.patch instead of using sed on the next major bump
+ sed -i \
+ -e "s:^Icon=mupen64plus-large.xpm:Icon=mupen64plus:" \
+ mupen64plus.desktop.in || die "sed failed"
+}
+
+get_opts() {
+ if use amd64 || use x86 ; then
+ echo -n "CPU=X86 ARCH=64BITS$(use x86 && echo -n _32) "
+ fi
+
+ use libsamplerate || echo -n "NO_RESAMP=1 "
+ use lirc && echo -n "LIRC=1 "
+ use cpu_flags_x86_sse || echo -n "NO_ASM=1 "
+
+ echo -n GUI=
+ if use gtk; then
+ echo -n GTK2
+ elif use qt4; then
+ echo -n QT4
+ else
+ echo -n NONE
+ fi
+}
+
+src_compile() {
+ use x86 && use cpu_flags_x86_sse && append-flags -fomit-frame-pointer
+ emake $(get_opts) DBGSYM=1 all || die "make failed"
+}
+
+src_install() {
+ # These are:
+ # 1) prefix - not used really, printed only
+ # 2) SHAREDIR
+ # 3) BINDIR
+ # 4) 'LIBDIR' - where to put plugins in
+ # 5) 'MANDIR' - exact directory to put man file in
+ # 6) APPLICATIONSDIR - where to put .desktop in
+
+ ./install.sh "${D}" \
+ "${D}${GAMES_DATADIR}/${PN}" \
+ "${D}${GAMES_BINDIR}" \
+ "${D}$(games_get_libdir)/${PN}/plugins" \
+ "${D}/usr/share/man/man1" \
+ "${D}/usr/share/applications" \
+ || or die "install.sh failed"
+
+ # Copy icon into system-wide location
+ newicon icons/mupen64plus-large.png ${PN}.png || die "newicon failed"
+
+ # 'Move' docs into correct dir
+ rm -r "${D}${GAMES_DATADIR}/${PN}/doc"
+ dodoc README RELEASE TODO doc/*.txt "${FILESDIR}/README.gentoo-patches-${PATCH_VERSION}" || die "dodoc failed"
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+
+ if use lirc; then
+ elog "For lirc configuration see:"
+ elog "http://code.google.com/p/mupen64plus/wiki/LIRC"
+ fi
+}
diff --git a/games-emulation/mupen64plus/mupen64plus-1.5-r2.ebuild b/games-emulation/mupen64plus/mupen64plus-1.5-r2.ebuild
new file mode 100644
index 000000000000..bc5b6ec852a9
--- /dev/null
+++ b/games-emulation/mupen64plus/mupen64plus-1.5-r2.ebuild
@@ -0,0 +1,138 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI="2"
+
+inherit eutils flag-o-matic games toolchain-funcs
+
+MY_P="Mupen64Plus-${PV/./-}-src"
+
+PATCH_VERSION="20100507"
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI="http://mupen64plus.googlecode.com/files/${MY_P}.tar.gz mirror://gentoo/${P}-patches-${PATCH_VERSION}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="+gtk libsamplerate lirc qt4 cpu_flags_x86_sse"
+
+# GTK+ is currently required by plugins even if no GUI support is enabled
+RDEPEND="virtual/opengl
+ media-libs/freetype:2
+ media-libs/libpng
+ media-libs/libsdl
+ media-libs/sdl-ttf
+ media-fonts/dejavu
+ sys-libs/zlib[minizip]
+ x11-libs/gtk+:2
+ libsamplerate? ( media-libs/libsamplerate )
+ lirc? ( app-misc/lirc )
+ qt4? ( dev-qt/qtgui:4
+ dev-qt/qtcore:4 )
+ app-arch/xz-utils"
+
+DEPEND="${RDEPEND}
+ dev-lang/yasm
+ virtual/pkgconfig"
+
+S="${WORKDIR}/${MY_P}"
+
+pkg_setup() {
+ if [[ ! $(tc-getCC) =~ gcc ]]; then
+ eerror
+ eerror "Compilers like clang and icc are not supported at this point"
+ eerror
+ die "You need gcc to build ${PN}"
+ fi
+
+ if ! use gtk && ! use qt4; then
+ ewarn "Building ${PN} without any GUI! To get one, enable USE=gtk or USE=qt4."
+ elif use gtk && use qt4; then
+ ewarn "Only one GUI can be built, using GTK+ one."
+ fi
+
+ games_pkg_setup
+}
+
+src_prepare() {
+ EPATCH_SOURCE="${WORKDIR}/patches" EPATCH_SUFFIX="patch" \
+ epatch
+
+ rm -rf main/zip
+ epatch "${FILESDIR}"/${P}-minizip.patch #383845
+
+ sed -i \
+ -e "s:/usr/local/share/mupen64plus:${GAMES_DATADIR}/mupen64plus:" \
+ -e "s:%PUT_PLUGIN_PATH_HERE%:$(games_get_libdir)/${PN}/plugins/:" \
+ main/main.c || die "sed failed"
+
+ # Fix 010_all_fix-desktop-file.patch instead of using sed on the next major bump
+ sed -i \
+ -e "s:^Icon=mupen64plus-large.xpm:Icon=mupen64plus:" \
+ mupen64plus.desktop.in || die "sed failed"
+ epatch "${FILESDIR}"/${P}-gcc46.patch
+}
+
+get_opts() {
+ if use amd64 || use x86 ; then
+ echo -n "CPU=X86 ARCH=64BITS$(use x86 && echo -n _32) "
+ fi
+
+ use libsamplerate || echo -n "NO_RESAMP=1 "
+ use lirc && echo -n "LIRC=1 "
+ use cpu_flags_x86_sse || echo -n "NO_ASM=1 "
+
+ echo -n GUI=
+ if use gtk; then
+ echo -n GTK2
+ elif use qt4; then
+ echo -n QT4
+ else
+ echo -n NONE
+ fi
+}
+
+src_compile() {
+ tc-export CC CXX
+ use x86 && use cpu_flags_x86_sse && append-flags -fomit-frame-pointer
+ emake $(get_opts) DBGSYM=1 CC="${CC}" CXX="${CXX}" LD="${CC}" all || die "make failed"
+}
+
+src_install() {
+ # These are:
+ # 1) prefix - not used really, printed only
+ # 2) SHAREDIR
+ # 3) BINDIR
+ # 4) 'LIBDIR' - where to put plugins in
+ # 5) 'MANDIR' - exact directory to put man file in
+ # 6) APPLICATIONSDIR - where to put .desktop in
+
+ ./install.sh "${D}" \
+ "${D}${GAMES_DATADIR}/${PN}" \
+ "${D}${GAMES_BINDIR}" \
+ "${D}$(games_get_libdir)/${PN}/plugins" \
+ "${D}/usr/share/man/man1" \
+ "${D}/usr/share/applications" \
+ || or die "install.sh failed"
+
+ # Copy icon into system-wide location
+ newicon icons/mupen64plus-large.png ${PN}.png || die "newicon failed"
+
+ # 'Move' docs into correct dir
+ rm -r "${D}${GAMES_DATADIR}/${PN}/doc"
+ dodoc README RELEASE TODO doc/*.txt "${FILESDIR}/README.gentoo-patches-${PATCH_VERSION}" || die "dodoc failed"
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+
+ if use lirc; then
+ elog "For lirc configuration see:"
+ elog "http://code.google.com/p/mupen64plus/wiki/LIRC"
+ fi
+}
diff --git a/games-emulation/mupen64plus/mupen64plus-2.0.ebuild b/games-emulation/mupen64plus/mupen64plus-2.0.ebuild
new file mode 100644
index 000000000000..a40068a28b4b
--- /dev/null
+++ b/games-emulation/mupen64plus/mupen64plus-2.0.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+DESCRIPTION="A fork of Mupen64 Nintendo 64 emulator, meta-package"
+HOMEPAGE="http://code.google.com/p/mupen64plus/"
+SRC_URI=""
+
+LICENSE="metapackage"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+audio-sdl +input-sdl +rsp-hle +ui-console +ui-m64py +video-glide64mk2 +video-rice"
+
+RDEPEND="games-emulation/mupen64plus-core
+ audio-sdl? ( games-emulation/mupen64plus-audio-sdl )
+ input-sdl? ( games-emulation/mupen64plus-input-sdl )
+ rsp-hle? ( games-emulation/mupen64plus-rsp-hle )
+ ui-console? ( games-emulation/mupen64plus-ui-console )
+ ui-m64py? ( games-emulation/m64py )
+ video-glide64mk2? ( games-emulation/mupen64plus-video-glide64mk2 )
+ video-rice? ( games-emulation/mupen64plus-video-rice )"
diff --git a/games-emulation/nestopia/Manifest b/games-emulation/nestopia/Manifest
new file mode 100644
index 000000000000..641112b15364
--- /dev/null
+++ b/games-emulation/nestopia/Manifest
@@ -0,0 +1,3 @@
+DIST Nestopia140src.zip 2346187 SHA256 ec503320679062af260135bf38e1fa2376803c75efb74039224fb2ef3b888762 SHA512 54a7c569239c15aa9bd7a5bbe13f67b5a62baccf95f81fb55ad9578872edc11a3e456af7ea67107e96c0c88726e976203058cf971fbb527cd30b644d8d51795a WHIRLPOOL c62959e52e1366ec2966087269a6ac07998d6ae0c24cae00ec2621ea506128eb887eb10ce25ac8c8e82a6c89aea8aa7fad9351f55146ce4b16ae6f81b5c992b3
+DIST nestopia-1.46.2.tgz 1223407 SHA256 4a5065726ad9e7a120a2c6aa39b9c0904090119998a4d690d4deb5e374118fc0 SHA512 3aa87e98aa24b71e5feac5ffe8229e97d407fc0b14567b0ddbe7cc1eaca08a08f435a6fe294fbbd7066054befdfd27602db7c3c0577246b0e8addfe296404a23 WHIRLPOOL 25c43194797e5edca3abc5cb75dba126d9d246e9ab12270521e7fe6c13427b371ba9f92a71ed557271f159711411286b5ac5ab3fe06144760320531c33bf0c02
+DIST nst140_lnx_release_h.zip 250216 SHA256 0b6b11d98fabbb0319c1d0800428f8cba6631ac2808fb4618ced3d7c8d782859 SHA512 eea9b212a26f0d8c294371eeb15a22c1aba595334dd46629767af19671692bd29eda078caa96d4a91f505b4e2764861090578c63dd3715cfa0fce4af7fc39339 WHIRLPOOL 715f33a33a2dd630d35e3a7ca1acdbcdb8843139aa976686324d121fab6cd89a5e666cc952e6097563cda145e17717a823931bdb40067e9d295e747a4902d83d
diff --git a/games-emulation/nestopia/files/nestopia b/games-emulation/nestopia/files/nestopia
new file mode 100644
index 000000000000..e2a6b03e5948
--- /dev/null
+++ b/games-emulation/nestopia/files/nestopia
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# create dir and copy files, if needed
+[ ! -d ~/.nestopia ] && mkdir ~/.nestopia
+[ ! -f ~/.nestopia/nstcontrols ] && cp "%GAMES_DATADIR%/nestopia/nstcontrols" ~/.nestopia/
+[ ! -f ~/.nestopia/NstDatabase.xml ] && cp "%GAMES_DATADIR%/nestopia/NstDatabase".xml ~/.nestopia/
+
+# wrap around the emu
+exec nestopia.bin "$@"
+
diff --git a/games-emulation/nestopia/files/nestopia-1.40-makefile.patch b/games-emulation/nestopia/files/nestopia-1.40-makefile.patch
new file mode 100644
index 000000000000..467e49445ec4
--- /dev/null
+++ b/games-emulation/nestopia/files/nestopia-1.40-makefile.patch
@@ -0,0 +1,69 @@
+--- Makefile.orig 2010-01-24 02:21:57.196476493 -0500
++++ Makefile 2010-01-24 02:27:52.134475800 -0500
+@@ -3,19 +3,20 @@
+ # By R. Belmont
+ #
+
+-CC = gcc
+-CPP = g++
+-CFLAGS = -c -O3 -g3
+-CFLAGS += -DNST_PRAGMA_ONCE_SUPPORT -D_SZ_ONE_DIRECTORY
+-CFLAGS += -Isource -Isource/core -Isource/zlib -Isource/core/api -Isource/core/board -Isource/core/input -Isource/linux/unzip
+-CFLAGS += -Isource/core/vssystem -Isource/linux -Isource/nes_ntsc -I.. -I../nes_ntsc -Isource/linux/7zip
+-CFLAGS += `sdl-config --cflags` `pkg-config --cflags gtk+-2.0`
+-CFLAGS += -finline-limit=2000 --param inline-unit-growth=1000 --param large-function-growth=1000 -finline-functions-called-once
++FLAGS = -c \
++ -DNST_PRAGMA_ONCE_SUPPORT -D_SZ_ONE_DIRECTORY \
++ -Isource -Isource/core -Isource/zlib -Isource/core/api -Isource/core/board -Isource/core/input -Isource/linux/unzip \
++ -Isource/core/vssystem -Isource/linux -Isource/nes_ntsc -I.. -I../nes_ntsc -Isource/linux/7zip \
++ `sdl-config --cflags` `pkg-config --cflags gtk+-2.0` \
++ -finline-limit=2000 --param inline-unit-growth=1000 --param large-function-growth=1000 -finline-functions-called-once
++
++CFLAGS += $(FLAGS)
++CXXFLAGS += $(FLAGS)
+
+ # enable this for input debugging
+ #CFLAGS += -DDEBUG_INPUT
+
+-CPPFLAGS = -Wno-deprecated -fno-rtti
++CXXFLAGS += -Wno-deprecated -fno-rtti
+
+ EXE = nst
+ LIBS = -lm -lz -lasound `sdl-config --libs` `pkg-config --libs gtk+-2.0`
+@@ -144,6 +145,8 @@
+ OBJDIRS = objs objs/core objs/core/api objs/core/board objs/core/input objs/core/vssystem objs/nes_ntsc
+ OBJDIRS += objs/linux objs/linux/7zip objs/linux/unzip
+
++$(shell mkdir $(sort $(OBJDIRS)))
++
+ # build rules
+ objs/%.o: source/%.c
+ @echo Compiling $<...
+@@ -151,24 +154,19 @@
+
+ objs/%.o: source/%.cpp
+ @echo Compiling $<...
+- @$(CC) $(CFLAGS) $(CPPFLAGS) $< -o $@
++ $(CC) $(CXXFLAGS) $< -o $@
+
+ objs/%.o: source/%.o
+ @echo Compiling $<...
+ @$.o) $(CFLAGS) $.oFLAGS) $< -o $@
+
+-all: maketree $(EXE) $(GENNSTCONTROLS)
+-
+-maketree: $(sort $(OBJDIRS))
++all: $(EXE) $(GENNSTCONTROLS)
+
+-$(sort $(OBJDIRS)):
+- @echo Creating output directory $@
+- @mkdir $@
+
+ # link the commandline exe
+ $(EXE): $(OBJS)
+ @echo Linking $@...
+- @$(CPP) -g -o $(EXE) $^ $(LIBS)
++ $(CXX) $(LDFLAGS) -g -o $(EXE) $^ $(LIBS)
+
+ clean:
+ -@rm -f $(OBJS) $(EXE) $(GENNSTCONTROLS)
diff --git a/games-emulation/nestopia/metadata.xml b/games-emulation/nestopia/metadata.xml
new file mode 100644
index 000000000000..542e07eb1484
--- /dev/null
+++ b/games-emulation/nestopia/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">nestopiaue</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/nestopia/nestopia-1.40.ebuild b/games-emulation/nestopia/nestopia-1.40.ebuild
new file mode 100644
index 000000000000..f6d6c03e7b79
--- /dev/null
+++ b/games-emulation/nestopia/nestopia-1.40.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic games
+
+MY_PV="${PV//./}"
+LNX_P="nst${MY_PV}_lnx_release_h"
+DESCRIPTION="NEStopia is a portable Nintendo Entertainment System emulator written in C++"
+HOMEPAGE="http://rbelmont.mameworld.info/?page_id=200"
+SRC_URI="mirror://sourceforge/${PN}/Nestopia${MY_PV}src.zip
+ http://rbelmont.mameworld.info/${LNX_P}.zip"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE=""
+
+RDEPEND=">=x11-libs/gtk+-2.4:2
+ media-libs/alsa-lib
+ >=media-libs/libsdl-1.2.12[sound,joystick,video]
+ sys-libs/zlib
+ virtual/opengl
+ virtual/glu"
+DEPEND="${RDEPEND}
+ app-arch/unzip"
+
+S=${WORKDIR}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-makefile.patch
+ sed \
+ -e "s:%GAMES_DATADIR%:${GAMES_DATADIR}:g" \
+ "${FILESDIR}"/${PN} \
+ > ${PN} \
+ || die "sed failed"
+ strip-flags
+}
+
+src_install() {
+ newgamesbin nst ${PN}.bin
+ dogamesbin ${PN}
+
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins NstDatabase.xml nstcontrols
+
+ make_desktop_entry "${PN}" "Nestopia"
+
+ dodoc README.Linux changelog.txt
+ dohtml -r readme.html doc/*.html doc/details
+
+ prepgamesdirs
+}
diff --git a/games-emulation/nestopia/nestopia-1.46.2.ebuild b/games-emulation/nestopia/nestopia-1.46.2.ebuild
new file mode 100644
index 000000000000..d5d8f73a34c3
--- /dev/null
+++ b/games-emulation/nestopia/nestopia-1.46.2.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils gnome2-utils games
+
+MY_P=${P/ue/}
+DESCRIPTION="A portable Nintendo Entertainment System emulator written in C++"
+HOMEPAGE="http://0ldsk00l.ca/nestopia/"
+SRC_URI="mirror://sourceforge/nestopiaue/${PV%.*}/${MY_P}.tgz"
+
+LICENSE="GPL-2+"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="doc"
+
+RDEPEND="x11-libs/gtk+:3
+ media-libs/libao
+ media-libs/libsdl2[sound,joystick,video]
+ app-arch/libarchive
+ sys-libs/zlib
+ virtual/opengl
+ virtual/glu"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+S=${WORKDIR}/${MY_P}
+
+src_prepare() {
+ sed -i \
+ -e '/^CC /d' \
+ -e '/^CXX /d' \
+ -e '/^LDFLAGS /d' \
+ -e '/^LIBS =/ s/=/+=/' \
+ -e '/^CFLAGS / s/=/+=/' \
+ -e "/^PREFIX / s:=.*:=${GAMES_PREFIX}:" \
+ -e "/^BINDIR / s:=.*:=${GAMES_BINDIR}:" \
+ -e "/^DATADIR / s:=.*:=${GAMES_DATADIR}/${PN}:" \
+ Makefile || die
+}
+
+src_install() {
+ local res
+
+ dogamesbin ${PN}
+
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins -r NstDatabase.xml source/unix/icons
+
+ domenu source/unix/icons/nestopia.desktop
+ for res in 32 48 64 128
+ do
+ newicon -s ${res} source/unix/icons/nestopia${res}.png nestopia.png
+ done
+ doicon -s scalable source/unix/icons/nestopia.svg
+
+ dodoc AUTHORS README.* changelog.txt
+ use doc && dohtml -r readme.html doc/*.html doc/details
+
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ games_pkg_preinst
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+}
diff --git a/games-emulation/nestra/Manifest b/games-emulation/nestra/Manifest
new file mode 100644
index 000000000000..d1507e323519
--- /dev/null
+++ b/games-emulation/nestra/Manifest
@@ -0,0 +1,2 @@
+DIST nestra-0.66.tar.gz 49757 SHA256 6be7743cef85cf3de2da4e7489bfd2329f7f21aa01be9f58801f6dbd9f8e96d6 SHA512 25f9d0c0359b46ddcd451552e7737b0f955a18e7a4ebd30d5494b12f787b9c45a49579207328c06c10efc7f8283bc688eb2061c538523ed257825b2394d978ce WHIRLPOOL 919e030b82e995ad95599c20eb2efed087af5a89a60f76b565122ef6c0d8441026d1b44de7469ed18887980f4da8c6a5c8476157f2cea52085628bcdd686cd46
+DIST nestra_0.66-10.diff.gz 2414 SHA256 5933509a4641afee22275b4c07e8e0f0d136056a7e0e3a4609a1e6c9674e32ea SHA512 4ea1ad97f6c2eca0434dee4031e0486cc1c7c25237a467d4bf33bd0656b52441143855e07b29e1bdcf95514e19fe68ecb8f73d0972d17d9e3b6fd7a92d2db8c6 WHIRLPOOL f4ccdfededfd118a7cd84f49f3a45ffbd460a33f577bf10c7affddd716e4783820ddd95e7664a184a860323dee436c1b45ed889c63ddf7c31a46489b2613b709
diff --git a/games-emulation/nestra/files/nestra-0.66-exec-stack.patch b/games-emulation/nestra/files/nestra-0.66-exec-stack.patch
new file mode 100644
index 000000000000..f5c662e22600
--- /dev/null
+++ b/games-emulation/nestra/files/nestra-0.66-exec-stack.patch
@@ -0,0 +1,10 @@
+--- x86.S.orig 2006-01-09 20:02:58.000000000 -0500
++++ x86.S 2006-01-09 20:03:38.000000000 -0500
+@@ -1458,3 +1458,7 @@
+ leal 0x1(%eax),%ebx
+ popl %eax
+ jmp i_next
++
++#ifdef __ELF__
++.section .note.GNU-stack,"",@progbits
++#endif
diff --git a/games-emulation/nestra/files/nestra-0.66-include.patch b/games-emulation/nestra/files/nestra-0.66-include.patch
new file mode 100644
index 000000000000..b4733b172bba
--- /dev/null
+++ b/games-emulation/nestra/files/nestra-0.66-include.patch
@@ -0,0 +1,73 @@
+--- comptbl.c
++++ comptbl.c
+@@ -9,6 +9,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <errno.h>
++#include <stdlib.h>
+
+ #define ALLOC_SIZE 0x400000 /* 4MB */
+ #define TBL_BASE ((unsigned char *)0x10000000)
+--- d6502.c
++++ d6502.c
+@@ -1,6 +1,7 @@
+ /* 6502 disassembler */
+ /* Public Domain */
+
++#include <stdio.h>
+ #include "globals.h"
+
+ char Opcodes_6502[256][4]={
+--- emu.c
++++ emu.c
+@@ -12,6 +12,7 @@
+ #include <sys/mman.h>
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+
+ #include "mapper.h"
+ #include "io.h"
+--- fb.c
++++ fb.c
+@@ -2,6 +2,8 @@
+ /* Framebuffer/pixmap rendering */
+ /* Public Domain */
+
++#include <stdlib.h>
++#include <string.h>
+ #include <stdio.h>
+ #include "mapper.h"
+ #include "globals.h"
+--- io.c
++++ io.c
+@@ -5,6 +5,7 @@
+ to do I/O operations. */
+
+ #include <stdio.h>
++#include <string.h>
+ #include "mapper.h"
+ #include "io.h"
+ #include "globals.h"
+--- mapper.c
++++ mapper.c
+@@ -1,6 +1,7 @@
+ /* Nestra mapper.c */
+ /* Public Domain */
+
++#include <string.h>
+ #include "mapper.h"
+ #include "consts.h"
+
+--- x11.c
++++ x11.c
+@@ -1,6 +1,9 @@
+ /* Nestra x11.c */
+ /* Public Domain */
+
++#include <stdlib.h>
++#include <string.h>
++#include <stdio.h>
+ #include <X11/Xlib.h>
+ #include <X11/keysym.h>
+ #include <X11/Xutil.h>
diff --git a/games-emulation/nestra/metadata.xml b/games-emulation/nestra/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/nestra/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/nestra/nestra-0.66-r2.ebuild b/games-emulation/nestra/nestra-0.66-r2.ebuild
new file mode 100644
index 000000000000..f0ec4e824580
--- /dev/null
+++ b/games-emulation/nestra/nestra-0.66-r2.ebuild
@@ -0,0 +1,49 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils toolchain-funcs flag-o-matic multilib games
+
+PATCH="${P/-/_}-10.diff"
+DESCRIPTION="NES emulation for Linux/x86"
+HOMEPAGE="http://nestra.linuxgames.com/"
+SRC_URI="http://nestra.linuxgames.com/${P}.tar.gz
+ mirror://debian/pool/contrib/n/nestra/${PATCH}.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE=""
+
+RDEPEND="x11-libs/libX11[abi_x86_32(-)]"
+DEPEND=${RDEPEND}
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ epatch \
+ "${WORKDIR}"/${PATCH} \
+ "${FILESDIR}"/${P}-exec-stack.patch \
+ "${FILESDIR}"/${P}-include.patch
+ append-ldflags -Wl,-z,noexecstack
+ use amd64 && multilib_toolchain_setup x86
+ sed -i \
+ -e "s:-L/usr/X11R6/lib:${LDFLAGS}:" \
+ -e 's:-O2 ::' \
+ -e "s:gcc:$(tc-getCC) ${CFLAGS}:" \
+ -e "s:ld:$(tc-getLD) -m elf_i386 $(raw-ldflags):" \
+ Makefile || die
+}
+
+src_compile() {
+ use amd64 && multilib_toolchain_setup x86
+ games_src_compile
+}
+
+src_install() {
+ dogamesbin nestra
+ dodoc BUGS CHANGES README
+ doman nestra.6
+ prepgamesdirs
+}
diff --git a/games-emulation/openmsx/Manifest b/games-emulation/openmsx/Manifest
new file mode 100644
index 000000000000..d5eeed8d3046
--- /dev/null
+++ b/games-emulation/openmsx/Manifest
@@ -0,0 +1 @@
+DIST openmsx-0.9.1.tar.gz 2975351 SHA256 06b82dd7a06baa52ce3aa96545b28103328258e472bd5d99254f4af17492f33e SHA512 7c4d23963f33e3033dea1d0ad9351e4f38f7434e2e077b6f8fd00cf80e0160b45291ff19be71646178ecafa01e954267dfe4c815578d4abb14c8595a863f98ff WHIRLPOOL 5609f8afe98e52bf393ca9359fa6b48341ad059a910a6190a39c5cc7b226ee84e066e83c361e8a09cac32a3cffc90d9c3c3ed31992e21a25c24d6a3af681ea74
diff --git a/games-emulation/openmsx/files/openmsx-0.9.1-verbose.patch b/games-emulation/openmsx/files/openmsx-0.9.1-verbose.patch
new file mode 100644
index 000000000000..18ac6fdc83b6
--- /dev/null
+++ b/games-emulation/openmsx/files/openmsx-0.9.1-verbose.patch
@@ -0,0 +1,14 @@
+--- build/main.mk.old 2015-01-18 12:18:50.608153217 +0100
++++ build/main.mk 2015-01-18 12:20:00.352861984 +0100
+@@ -541,10 +541,9 @@
+ DEPEND_SUBST=$(patsubst $(SOURCES_PATH)/%.cc,$(DEPEND_PATH)/%.d,$<)
+ $(OBJECTS_FULL): $(INIT_DUMMY_FILE)
+ $(OBJECTS_FULL): $(OBJECTS_PATH)/%.o: $(SOURCES_PATH)/%.cc $(DEPEND_PATH)/%.d
+- @echo "Compiling $(patsubst $(SOURCES_PATH)/%,%,$<)..."
+ @mkdir -p $(@D)
+ @mkdir -p $(patsubst $(OBJECTS_PATH)%,$(DEPEND_PATH)%,$(@D))
+- @$(COMPILE_ENV) $(CXX) \
++ $(COMPILE_ENV) $(CXX) \
+ $(DEPEND_FLAGS) -MMD -MF $(DEPEND_SUBST) \
+ -o $@ $(CXXFLAGS) $(COMPILE_FLAGS) -c $<
+ @touch $@ # Force .o file to be newer than .d file.
diff --git a/games-emulation/openmsx/metadata.xml b/games-emulation/openmsx/metadata.xml
new file mode 100644
index 000000000000..d10b4d57b45e
--- /dev/null
+++ b/games-emulation/openmsx/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">openmsx</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/openmsx/openmsx-0.9.1.ebuild b/games-emulation/openmsx/openmsx-0.9.1.ebuild
new file mode 100644
index 000000000000..c01185fe7f27
--- /dev/null
+++ b/games-emulation/openmsx/openmsx-0.9.1.ebuild
@@ -0,0 +1,65 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils games
+
+DESCRIPTION="MSX emulator that aims for perfection"
+HOMEPAGE="http://openmsx.sourceforge.net/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc ~ppc64 x86"
+IUSE=""
+
+DEPEND="
+ dev-lang/tcl:0=
+ dev-libs/libxml2
+ media-libs/libpng:0
+ media-libs/libsdl[sound,video]
+ media-libs/glew
+ media-libs/sdl-image[png]
+ media-libs/sdl-ttf
+ virtual/opengl"
+RDEPEND="${DEPEND}"
+
+src_prepare() {
+ sed -i \
+ -e '/^LDFLAGS:=/d' \
+ -e '/LINK_FLAGS_PREFIX/d' \
+ -e '/LINK_FLAGS+=/s/-s//' \
+ -e '/LINK_FLAGS+=\$(TARGET_FLAGS)/s/$/ $(LDFLAGS)/' \
+ build/main.mk \
+ || die
+ sed -i -e '/SYMLINK/s:true:false:' build/custom.mk || die
+ sed -i -e 's/GPL.txt//' doc/node.mk || die
+ epatch "${FILESDIR}"/${P}-verbose.patch
+}
+
+src_compile() {
+ emake \
+ CXXFLAGS="${CXXFLAGS}" \
+ INSTALL_SHARE_DIR="${GAMES_DATADIR}"/${PN}
+}
+
+src_install() {
+ emake \
+ INSTALL_BINARY_DIR="${D}${GAMES_BINDIR}" \
+ INSTALL_SHARE_DIR="${D}${GAMES_DATADIR}"/${PN} \
+ INSTALL_DOC_DIR="${D}"/usr/share/doc/${PF} \
+ install
+ dodoc README
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+
+ elog "If you want to if you want to emulate real MSX systems and not"
+ elog "only the free C-BIOS machines, put the system ROMs in one of"
+ elog "the following directories: ${GAMES_DATADIR}/${PN}/systemroms"
+ elog "or ~/.openMSX/share/systemroms"
+}
diff --git a/games-emulation/pcsxr/Manifest b/games-emulation/pcsxr/Manifest
new file mode 100644
index 000000000000..0fb44c6a1c1c
--- /dev/null
+++ b/games-emulation/pcsxr/Manifest
@@ -0,0 +1 @@
+DIST pcsxr-1.9.94.zip 2631125 SHA256 291941eebe695d9133539783dee208fce9d7419f0042964f96bf10ce3eee9fa3 SHA512 c49471c27692fbf22da32d2f5697a1dfed3dbdbfdb86cb789b0ea6cddb2a7da4f3390e4568f4e9385bf30d6baff0f2a591a80f424cf0c640cae0035ba81dce39 WHIRLPOOL 8095fda6821cb7549574f8ff97d75d34350317f0e71ce27f9c540244ca66d3419c1aa4bdac91142cd7304daa7d56689565417f7203eb67f605c81727859a7cea
diff --git a/games-emulation/pcsxr/files/pcsxr-1.9.94-disable-sdl2.patch b/games-emulation/pcsxr/files/pcsxr-1.9.94-disable-sdl2.patch
new file mode 100644
index 000000000000..483ea56660e6
--- /dev/null
+++ b/games-emulation/pcsxr/files/pcsxr-1.9.94-disable-sdl2.patch
@@ -0,0 +1,28 @@
+From b7864d1b8db75eda19a7601f3e2402a885bb251d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 11 Dec 2013 17:19:09 +0100
+Subject: [PATCH] Disable SDL2 check for Gentoo.
+
+The SDL2 support seems immature at the moment, so we'd prefer pcsxr
+using SDL1 even if SDL2 is installed.
+---
+ configure.ac | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index f79cee0..0c79cff 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -26,8 +26,7 @@ AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["${GETTEXT_PACKAGE}"], [gettext domain])
+ PKG_CHECK_MODULES(GLIB2, glib-2.0 >= 2.20, [], AC_MSG_ERROR([*** glib2 >= 2.20 not found!]))
+ PKG_CHECK_MODULES(GTK3, gtk+-3.0 , [], AC_MSG_ERROR([*** libgtk3 >= 3.0 not found!]))
+
+-PKG_CHECK_MODULES([SDL2], [sdl2 >= 2.0.0],
+- [AC_DEFINE([HAVE_SDL2], [1], [Use SDL2])],
++AS_IF([true],
+ [PKG_CHECK_MODULES([SDL], [sdl >= 1.2.12],
+ [AC_DEFINE([HAVE_SDL], [1], [Use SDL])
+ ], AC_MSG_ERROR([*** SDL >= 1.2.12 not found!]))
+--
+1.8.5.1
+
diff --git a/games-emulation/pcsxr/files/pcsxr-1.9.94-install-paths.patch b/games-emulation/pcsxr/files/pcsxr-1.9.94-install-paths.patch
new file mode 100644
index 000000000000..adf2866e1fdf
--- /dev/null
+++ b/games-emulation/pcsxr/files/pcsxr-1.9.94-install-paths.patch
@@ -0,0 +1,223 @@
+From a5b0086e76672083f91ddb4d0350cc99c19604fb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 11 Dec 2013 17:12:58 +0100
+Subject: [PATCH 1/2] Fix install paths for Gentoo.
+
+---
+ data/Makefile.am | 2 +-
+ gui/Makefile.am | 6 +++---
+ libpcsxcore/Makefile.am | 2 +-
+ pixmaps/Makefile.am | 2 +-
+ plugins/bladesio1/Makefile.am | 6 +++---
+ plugins/dfcdrom/Makefile.am | 6 +++---
+ plugins/dfinput/Makefile.am | 6 +++---
+ plugins/dfnet/Makefile.am | 6 +++---
+ plugins/dfsound/Makefile.am | 6 +++---
+ plugins/dfxvideo/Makefile.am | 6 +++---
+ plugins/peopsxgl/Makefile.am | 8 ++++----
+ 11 files changed, 28 insertions(+), 28 deletions(-)
+
+diff --git a/data/Makefile.am b/data/Makefile.am
+index 8f1ce6a..9df8e87 100644
+--- a/data/Makefile.am
++++ b/data/Makefile.am
+@@ -1,7 +1,7 @@
+ glade_DATA = pcsxr.ui
+ gladedir = $(datadir)/pcsxr
+
+-desktopdir = $(datadir)/applications
++desktopdir = $(datarootdir)/applications
+ desktop_DATA = pcsxr.desktop
+
+ EXTRA_DIST = $(glade_DATA) pcsxr.desktop
+diff --git a/gui/Makefile.am b/gui/Makefile.am
+index 5feb39e..6146ef0 100644
+--- a/gui/Makefile.am
++++ b/gui/Makefile.am
+@@ -1,10 +1,10 @@
+ AM_CPPFLAGS = -DPACKAGE_DATA_DIR=\"${datadir}/pcsxr/\" \
+- -DPIXMAPDIR=\"${datadir}/pixmaps/\" \
+- -DLOCALE_DIR=\"${datadir}/locale/\" \
++ -DPIXMAPDIR=\"${datarootdir}/pixmaps/\" \
++ -DLOCALE_DIR=\"${datarootdir}/locale/\" \
+ $(GTK3_CFLAGS) \
+ -I$(top_srcdir)/libpcsxcore -I$(top_srcdir)/include \
+ -DPSEMU_DATA_DIR=\"${datadir}/psemu\" \
+- -DDEF_PLUGIN_DIR=\"${libdir}/games/psemu\"
++ -DDEF_PLUGIN_DIR=\"${libdir}/psemu\"
+
+ bin_PROGRAMS = pcsxr
+
+diff --git a/libpcsxcore/Makefile.am b/libpcsxcore/Makefile.am
+index 1ae5389..9571ea3 100644
+--- a/libpcsxcore/Makefile.am
++++ b/libpcsxcore/Makefile.am
+@@ -1,4 +1,4 @@
+-AM_CPPFLAGS = -DLOCALE_DIR=\"${datadir}/locale/\" \
++AM_CPPFLAGS = -DLOCALE_DIR=\"${datarootdir}/locale/\" \
+ -I$(top_srcdir)/include
+
+ noinst_LIBRARIES = libpcsxcore.a
+diff --git a/pixmaps/Makefile.am b/pixmaps/Makefile.am
+index e77fda4..f7e10da 100644
+--- a/pixmaps/Makefile.am
++++ b/pixmaps/Makefile.am
+@@ -1,7 +1,7 @@
+ pixmapdir = "$(datadir)/pcsxr"
+ pixmap_DATA = pcsxr.png iso-open.png iso-reopen.png cd.png cdr.png gpu.png memcard.png pad.png play.png sio1.png spu.png
+
+-icondir = "$(datadir)/pixmaps"
++icondir = "$(datarootdir)/pixmaps"
+ icon_DATA = pcsxr-icon.png
+
+ EXTRA_DIST = pcsxr.png iso-open.png iso-reopen.png cd.png cdr.png gpu.png memcard.png pad.png play.png sio1.png spu.png pcsxr-icon.png
+diff --git a/plugins/bladesio1/Makefile.am b/plugins/bladesio1/Makefile.am
+index 5b7fee4..75d9588 100644
+--- a/plugins/bladesio1/Makefile.am
++++ b/plugins/bladesio1/Makefile.am
+@@ -1,12 +1,12 @@
+-bindir = @libdir@/games/psemu/
+-libdir = @libdir@/games/psemu/
++bindir = @libdir@/psemu/
++libdir = @libdir@/psemu/
+
+ lib_LTLIBRARIES = libBladeSio1.la
+
+ libBladeSio1_la_SOURCES = cfg.c sio1.c sio1.h fifo.c fifo.h connection.c connection.h
+ libBladeSio1_la_LDFLAGS = -module -avoid-version
+
+-AM_CPPFLAGS = -DLOCALE_DIR=\"${datadir}/locale/\" \
++AM_CPPFLAGS = -DLOCALE_DIR=\"${datarootdir}/locale/\" \
+ -DDATADIR=\"${datadir}/psemu/\" \
+ $(GTK3_CFLAGS) \
+ -I../../libpcsxcore -I../../include
+diff --git a/plugins/dfcdrom/Makefile.am b/plugins/dfcdrom/Makefile.am
+index b4c729f..297b4f9 100644
+--- a/plugins/dfcdrom/Makefile.am
++++ b/plugins/dfcdrom/Makefile.am
+@@ -1,5 +1,5 @@
+-bindir = @libdir@/games/psemu/
+-libdir = @libdir@/games/psemu/
++bindir = @libdir@/psemu/
++libdir = @libdir@/psemu/
+
+ lib_LTLIBRARIES = libDFCdrom.la
+
+@@ -21,7 +21,7 @@ libDFCdrom_la_CFLAGS += -DUSE_LIBCDIO=1 $(LIBCDIO_CFLAGS)
+ libDFCdrom_la_LIBADD += $(LIBCDIO_LIBS)
+ endif
+
+-AM_CPPFLAGS = -DLOCALE_DIR=\"${datadir}/locale/\" \
++AM_CPPFLAGS = -DLOCALE_DIR=\"${datarootdir}/locale/\" \
+ -DDATADIR=\"${datadir}/psemu/\" \
+ $(GTK3_CFLAGS) \
+ -I../../libpcsxcore -I../../include
+diff --git a/plugins/dfinput/Makefile.am b/plugins/dfinput/Makefile.am
+index f270ca7..0f7f9b5 100644
+--- a/plugins/dfinput/Makefile.am
++++ b/plugins/dfinput/Makefile.am
+@@ -1,5 +1,5 @@
+-bindir = @libdir@/games/psemu/
+-libdir = @libdir@/games/psemu/
++bindir = @libdir@/psemu/
++libdir = @libdir@/psemu/
+
+ lib_LTLIBRARIES = libDFInput.la
+
+@@ -7,7 +7,7 @@ libDFInput_la_SOURCES = cfg.c pad.c pad.h sdljoy.c xkb.c analog.c util.c util.h
+ libDFInput_la_LDFLAGS = -module -avoid-version
+ libDFInput_la_LIBADD = -lpthread -lX11 $(SDL2_LIBS) $(SDL_LIBS)
+
+-AM_CPPFLAGS = -DLOCALE_DIR=\"${datadir}/locale/\" \
++AM_CPPFLAGS = -DLOCALE_DIR=\"${datarootdir}/locale/\" \
+ -DDATADIR=\"${datadir}/psemu/\" \
+ $(GTK3_CFLAGS) \
+ -I../../include -I../../libpcsxcore $(SDL2_CFLAGS) $(SDL_CFLAGS)
+diff --git a/plugins/dfnet/Makefile.am b/plugins/dfnet/Makefile.am
+index 004df63..fff3dba 100644
+--- a/plugins/dfnet/Makefile.am
++++ b/plugins/dfnet/Makefile.am
+@@ -1,12 +1,12 @@
+-bindir = @libdir@/games/psemu/
+-libdir = @libdir@/games/psemu/
++bindir = @libdir@/psemu/
++libdir = @libdir@/psemu/
+
+ lib_LTLIBRARIES = libDFNet.la
+
+ libDFNet_la_SOURCES = dfnet.c dfnet.h unix.c cfg.c
+ libDFNet_la_LDFLAGS = -module -avoid-version
+
+-AM_CPPFLAGS = -DLOCALE_DIR=\"${datadir}/locale/\" \
++AM_CPPFLAGS = -DLOCALE_DIR=\"${datarootdir}/locale/\" \
+ -DDATADIR=\"${datadir}/psemu/\" \
+ $(GTK3_CFLAGS) \
+ -I../../libpcsxcore -I../../include
+diff --git a/plugins/dfsound/Makefile.am b/plugins/dfsound/Makefile.am
+index 5325555..15515b8 100644
+--- a/plugins/dfsound/Makefile.am
++++ b/plugins/dfsound/Makefile.am
+@@ -1,7 +1,7 @@
+ AM_CPPFLAGS = -I../../include
+
+-bindir = @libdir@/games/psemu/
+-libdir = @libdir@/games/psemu/
++bindir = @libdir@/psemu/
++libdir = @libdir@/psemu/
+
+ lib_LTLIBRARIES = libDFSound.la
+
+@@ -46,7 +46,7 @@ libDFSound_la_CPPFLAGS += -DUSENULL=1
+ endif
+
+ bin_PROGRAMS = cfgDFSound
+-cfgDFSound_CPPFLAGS = -DLOCALE_DIR=\"${datadir}/locale/\" \
++cfgDFSound_CPPFLAGS = -DLOCALE_DIR=\"${datarootdir}/locale/\" \
+ -DDATADIR=\"${datadir}/psemu/\" \
+ $(GTK3_CFLAGS) $(AM_CPPFLAGS)
+ cfgDFSound_SOURCES = spucfg-0.1df/main.c
+diff --git a/plugins/dfxvideo/Makefile.am b/plugins/dfxvideo/Makefile.am
+index 2af76fd..0515690 100644
+--- a/plugins/dfxvideo/Makefile.am
++++ b/plugins/dfxvideo/Makefile.am
+@@ -6,14 +6,14 @@ SUFFIXES = .asm
+ $(LIBTOOL) --tag=CC --mode=compile \
+ $(STRIP_FPIC) $(NASM) -f elf -d ELF -I${srcdir}/ $<
+
+-AM_CPPFLAGS = -DLOCALE_DIR=\"${datadir}/locale/\" \
++AM_CPPFLAGS = -DLOCALE_DIR=\"${datarootdir}/locale/\" \
+ -DDATADIR=\"${datadir}/psemu/\" \
+ $(GTK3_CFLAGS)\
+ -I../../libpcsxcore \
+ -I../../include
+
+-bindir = @libdir@/games/psemu/
+-libdir = @libdir@/games/psemu/
++bindir = @libdir@/psemu/
++libdir = @libdir@/psemu/
+
+ lib_LTLIBRARIES = libDFXVideo.la
+
+diff --git a/plugins/peopsxgl/Makefile.am b/plugins/peopsxgl/Makefile.am
+index 99c9554..e3af49f 100644
+--- a/plugins/peopsxgl/Makefile.am
++++ b/plugins/peopsxgl/Makefile.am
+@@ -1,11 +1,11 @@
+-AM_CPPFLAGS = -DPIXMAPDIR=\"${datadir}/pixmaps/\" \
+- -DLOCALE_DIR=\"${datadir}/locale/\" \
++AM_CPPFLAGS = -DPIXMAPDIR=\"${datarootdir}/pixmaps/\" \
++ -DLOCALE_DIR=\"${datarootdir}/locale/\" \
+ -DDATADIR=\"${datadir}/psemu/\" \
+ $(GTK3_CFLAGS) \
+ -I../../libpcsxcore -I../../include
+
+-bindir = @libdir@/games/psemu/
+-libdir = @libdir@/games/psemu/
++bindir = @libdir@/psemu/
++libdir = @libdir@/psemu/
+
+ lib_LTLIBRARIES = libpeopsxgl.la
+
+--
+1.8.5.1
+
diff --git a/games-emulation/pcsxr/metadata.xml b/games-emulation/pcsxr/metadata.xml
new file mode 100644
index 000000000000..f8bb87dde512
--- /dev/null
+++ b/games-emulation/pcsxr/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <use>
+ <flag name='cdio'>Use libcdio for CD support</flag>
+ <flag name='sdl'>Use SDL sound backend (other parts of SDL are used unconditionally)</flag>
+ </use>
+</pkgmetadata>
diff --git a/games-emulation/pcsxr/pcsxr-1.9.94-r1.ebuild b/games-emulation/pcsxr/pcsxr-1.9.94-r1.ebuild
new file mode 100644
index 000000000000..9130f9d16e45
--- /dev/null
+++ b/games-emulation/pcsxr/pcsxr-1.9.94-r1.ebuild
@@ -0,0 +1,111 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools eutils multilib versionator
+
+DESCRIPTION="PCSX-Reloaded: a fork of PCSX, the discontinued Playstation emulator"
+HOMEPAGE="http://pcsxr.codeplex.com"
+# codeplex doesn't support direct downloads but GPL-2 doesn't mind me
+# mirroring it.
+SRC_URI="http://dev.gentoo.org/~mgorny/dist/${P}.zip"
+
+LICENSE="GPL-2 public-domain"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="alsa cdio ffmpeg nls openal opengl oss pulseaudio +sdl"
+
+# pcsxr supports both SDL1 and SDL2 but uses the newer version installed
+# since SDL is not properly slotted in Gentoo, just fix it on SDL2
+
+RDEPEND="dev-libs/glib:2=
+ media-libs/libsdl:0=[joystick]
+ sys-libs/zlib:0=
+ x11-libs/gtk+:3=
+ x11-libs/libX11:0=
+ x11-libs/libXext:0=
+ x11-libs/libXtst:0=
+ x11-libs/libXv:0=
+ alsa? ( media-libs/alsa-lib:0= )
+ cdio? ( dev-libs/libcdio:0= )
+ ffmpeg? ( virtual/ffmpeg:0= )
+ nls? ( virtual/libintl:0= )
+ openal? ( media-libs/openal:0= )
+ opengl? ( virtual/opengl:0=
+ x11-libs/libXxf86vm:0= )
+ pulseaudio? ( media-sound/pulseaudio:0= )
+ sdl? ( media-libs/libsdl:0=[sound] )"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-util/intltool
+ x11-proto/videoproto
+ nls? ( sys-devel/gettext:0 )
+ x86? ( dev-lang/nasm )"
+
+REQUIRED_USE="?? ( alsa openal oss pulseaudio sdl )"
+
+# it's only the .po file check that fails :)
+RESTRICT=test
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ local PATCHES=(
+ "${FILESDIR}"/${P}-disable-sdl2.patch
+ )
+
+ epatch "${PATCHES[@]}"
+ epatch_user
+ eautoreconf
+}
+
+src_configure() {
+ local sound_backend
+
+ if use alsa; then
+ sound_backend=alsa
+ elif use oss; then
+ sound_backend=oss
+ elif use pulseaudio; then
+ sound_backend=pulseaudio
+ elif use sdl; then
+ sound_backend=sdl
+ elif use openal; then
+ sound_backend=openal
+ else
+ sound_backend=null
+ fi
+
+ local myconf=(
+ $(use_enable nls)
+ $(use_enable cdio libcdio)
+ $(use_enable opengl)
+ $(use_enable ffmpeg ccdda)
+ --enable-sound=${sound_backend}
+ )
+
+ econf "${myconf[@]}"
+}
+
+src_install() {
+ default
+ prune_libtool_files --all
+
+ dodoc doc/{keys,tweaks}.txt
+}
+
+pkg_postinst() {
+ local vr
+ for vr in ${REPLACING_VERSIONS}; do
+ if ! version_is_at_least 1.9.94-r1 ${vr}; then
+ ewarn "Starting with pcsxr-1.9.94-r1, the plugin install path has changed."
+ ewarn "In order for pcsxr to find plugins, you will need to remove stale"
+ ewarn "symlinks from ~/.pcsxr/plugins. You can do this using the following"
+ ewarn "command (as your regular user):"
+ ewarn
+ ewarn " $ find ~/.pcsxr/plugins/ -type l -delete"
+ fi
+ done
+}
diff --git a/games-emulation/pcsxr/pcsxr-1.9.94.ebuild b/games-emulation/pcsxr/pcsxr-1.9.94.ebuild
new file mode 100644
index 000000000000..db64c8ec1d1f
--- /dev/null
+++ b/games-emulation/pcsxr/pcsxr-1.9.94.ebuild
@@ -0,0 +1,101 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools eutils games
+
+DESCRIPTION="PCSX-Reloaded: a fork of PCSX, the discontinued Playstation emulator"
+HOMEPAGE="http://pcsxr.codeplex.com"
+# codeplex doesn't support direct downloads but GPL-2 doesn't mind me
+# mirroring it.
+SRC_URI="http://dev.gentoo.org/~mgorny/dist/${P}.zip"
+
+LICENSE="GPL-2 public-domain"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="alsa cdio ffmpeg nls openal opengl oss pulseaudio +sdl"
+
+# pcsxr supports both SDL1 and SDL2 but uses the newer version installed
+# since SDL is not properly slotted in Gentoo, just fix it on SDL2
+
+RDEPEND="dev-libs/glib:2=
+ media-libs/libsdl:0=[joystick]
+ sys-libs/zlib:0=
+ x11-libs/gtk+:3=
+ x11-libs/libX11:0=
+ x11-libs/libXext:0=
+ x11-libs/libXtst:0=
+ x11-libs/libXv:0=
+ alsa? ( media-libs/alsa-lib:0= )
+ cdio? ( dev-libs/libcdio:0= )
+ ffmpeg? ( virtual/ffmpeg:0= )
+ nls? ( virtual/libintl:0= )
+ openal? ( media-libs/openal:0= )
+ opengl? ( virtual/opengl:0=
+ x11-libs/libXxf86vm:0= )
+ pulseaudio? ( media-sound/pulseaudio:0= )
+ sdl? ( media-libs/libsdl:0=[sound] )"
+DEPEND="${RDEPEND}
+ app-arch/unzip
+ dev-util/intltool
+ x11-proto/videoproto
+ nls? ( sys-devel/gettext:0 )
+ x86? ( dev-lang/nasm )"
+
+REQUIRED_USE="?? ( alsa openal oss pulseaudio sdl )"
+
+# it's only the .po file check that fails :)
+RESTRICT=test
+
+S=${WORKDIR}/${PN}
+
+src_prepare() {
+ local PATCHES=(
+ "${FILESDIR}"/${P}-disable-sdl2.patch
+ "${FILESDIR}"/${P}-install-paths.patch
+ )
+
+ epatch "${PATCHES[@]}"
+ epatch_user
+ eautoreconf
+}
+
+src_configure() {
+ local sound_backend
+
+ if use alsa; then
+ sound_backend=alsa
+ elif use oss; then
+ sound_backend=oss
+ elif use pulseaudio; then
+ sound_backend=pulseaudio
+ elif use sdl; then
+ sound_backend=sdl
+ elif use openal; then
+ sound_backend=openal
+ else
+ sound_backend=null
+ fi
+
+ local myeconfargs=(
+ --datarootdir="${EPREFIX%/}"/usr/share
+
+ $(use_enable nls)
+ $(use_enable cdio libcdio)
+ $(use_enable opengl)
+ $(use_enable ffmpeg ccdda)
+ --enable-sound=${sound_backend}
+ )
+
+ egamesconf "${myeconfargs[@]}"
+}
+
+src_install() {
+ default
+ prune_libtool_files --all
+
+ dodoc doc/{keys,tweaks}.txt
+ prepgamesdirs
+}
diff --git a/games-emulation/raine/Manifest b/games-emulation/raine/Manifest
new file mode 100644
index 000000000000..938dea719e58
--- /dev/null
+++ b/games-emulation/raine/Manifest
@@ -0,0 +1 @@
+DIST raines-0.51.9.tar.bz2 2095980 SHA256 6d58f36790025e53aa0897f21cef845b9355081fd75c9a5ce4ef96f275dd0427 SHA512 e21346d72c63d8ba1bc6832bd885fa9ec0865c788742e572ef9941d3a4fd3f23710d076253d7a50878ef512ff3024e57098c0ba28c0c794bdefa994b8b7780bf WHIRLPOOL b9d1a0406e150779c37b139344a157f55fefb9345fe6ae17f36796c63d8a97b77494fd9b3b9e26983f447fa4bacbafac7b2d89750af45ea3af11f0137883eb67
diff --git a/games-emulation/raine/files/raine-0.51.9-ldflags.patch b/games-emulation/raine/files/raine-0.51.9-ldflags.patch
new file mode 100644
index 000000000000..f011cd6a1e5c
--- /dev/null
+++ b/games-emulation/raine/files/raine-0.51.9-ldflags.patch
@@ -0,0 +1,11 @@
+--- makefile.old 2010-10-08 10:04:46.000000000 +0200
++++ makefile 2010-10-08 10:05:25.000000000 +0200
+@@ -995,7 +995,7 @@
+ else
+ @echo Linking Raine...
+ endif
+- $(LDV) $(LFLAGS) -g -Wall -Wno-write-strings -o $(RAINE_EXE) $(OBJS) $(LIBS) -lstdc++
++ $(LDV) $(LDFLAGS) $(LFLAGS) -g -Wall -Wno-write-strings -o $(RAINE_EXE) $(OBJS) $(LIBS) -lstdc++
+
+ converter: source/bonus/converter.c
+ $(CCV) $(CFLAGS) -c $< -o $(OBJDIR)/converter.o
diff --git a/games-emulation/raine/files/raine-0.51.9-libpng15.patch b/games-emulation/raine/files/raine-0.51.9-libpng15.patch
new file mode 100644
index 000000000000..675df24801dc
--- /dev/null
+++ b/games-emulation/raine/files/raine-0.51.9-libpng15.patch
@@ -0,0 +1,13 @@
+http://bugs.gentoo.org/388255
+
+--- source/savepng.c
++++ source/savepng.c
+@@ -203,7 +203,7 @@
+ goto Error;
+
+ /* Set error handling. */
+- if (setjmp(png_ptr->jmpbuf)) {
++ if (setjmp(png_jmpbuf(png_ptr))) {
+ /* If we get here, we had a problem reading the file. */
+ goto Error;
+ }
diff --git a/games-emulation/raine/files/raine-0.51.9-underlink.patch b/games-emulation/raine/files/raine-0.51.9-underlink.patch
new file mode 100644
index 000000000000..e9eb42bedbb3
--- /dev/null
+++ b/games-emulation/raine/files/raine-0.51.9-underlink.patch
@@ -0,0 +1,11 @@
+--- makefile.old 2011-06-16 08:25:35.000000000 +0200
++++ makefile 2011-06-16 08:25:57.000000000 +0200
+@@ -294,7 +294,7 @@
+ LIBS_DEBUG = -lz `allegro-config --libs ` `libpng-config --ldflags`
+ LIBS_STATIC = -lz `allegro-config --static` `libpng-config --static --ldflags`
+ else
+- LIBS = -lz `libpng-config --ldflags`
++ LIBS = -lz -lm `libpng-config --ldflags`
+ LIBS_DEBUG = -lz `libpng-config --ldflags`
+ LIBS_STATIC = -lz `libpng-config --static --ldflags`
+ endif
diff --git a/games-emulation/raine/metadata.xml b/games-emulation/raine/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/raine/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/raine/raine-0.51.9.ebuild b/games-emulation/raine/raine-0.51.9.ebuild
new file mode 100644
index 000000000000..5cc957ae5e3b
--- /dev/null
+++ b/games-emulation/raine/raine-0.51.9.ebuild
@@ -0,0 +1,58 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit flag-o-matic eutils games
+
+DESCRIPTION="R A I N E M680x0 Arcade Emulation"
+HOMEPAGE="http://rainemu.swishparty.co.uk/"
+SRC_URI="http://rainemu.swishparty.co.uk/html/archive/raines-${PV}.tar.bz2"
+
+LICENSE="Artistic"
+SLOT="0"
+KEYWORDS="x86"
+IUSE=""
+
+RDEPEND="dev-cpp/muParser
+ media-libs/libsdl[sound,joystick,video]
+ sys-libs/zlib
+ media-libs/sdl-image[png]
+ media-libs/sdl-ttf"
+DEPEND="${RDEPEND}
+ dev-lang/nasm
+ app-arch/unzip"
+
+src_prepare() {
+ echo > detect-cpu
+ echo > cpuinfo
+ sed -i \
+ -e "/^NEO/s:^:#:" \
+ -e "s:nasmw:nasm:" \
+ -e "/bindir/s:=.*:=\$(DESTDIR)${GAMES_BINDIR}:" \
+ -e "/sharedir =/s:=.*:=\$(DESTDIR)${GAMES_DATADIR}:" \
+ -e "/mandir/s:=.*:=\$(DESTDIR)/usr/share/man/man6:" \
+ makefile || die
+ epatch "${FILESDIR}"/${P}-ldflags.patch \
+ "${FILESDIR}"/${P}-underlink.patch \
+ "${FILESDIR}"/${P}-libpng15.patch
+ has_version '>=sys-libs/zlib-1.2.5.1-r1' && \
+ sed -i -e '1i#define OF(x) x' source/mini-unzip/ioapi.h
+ append-ldflags -Wl,-z,noexecstack
+}
+
+src_compile() {
+ local myopts
+
+ emake \
+ _MARCH="${CFLAGS}" \
+ VERBOSE=1 \
+ ${myopts}
+}
+
+src_install() {
+ default
+ keepdir "${GAMES_DATADIR}"/${PN}/{roms,artwork,emudx,scripts/raine}
+ dodoc docs/readme.txt
+ prepgamesdirs
+}
diff --git a/games-emulation/sdlmame/Manifest b/games-emulation/sdlmame/Manifest
new file mode 100644
index 000000000000..0bb3d4b43992
--- /dev/null
+++ b/games-emulation/sdlmame/Manifest
@@ -0,0 +1,4 @@
+DIST mame0148s.zip 33822494 SHA256 78d8a68ba53934fdfc895f450c08682dada81f7ec3e74a98fb042539506d9321 SHA512 a520115e2e82b2da3200ffa1fa56f668f95c3e26a927bcdb30a34e73053e55d26a6a6c1ec95eae1237bce1d2d0cd276b84466705fd5f53ac77827d06ea04bc03 WHIRLPOOL c6de71c198396977475110ab5840b7eaa6e5074519adffc286dd539ab916ea951fa1c307218b0d144cdc8aeeb096216106a3c21a6d53b42c04dc75e8103be04a
+DIST mame0149s.zip 35160585 SHA256 0e41b5773bea217d3ca04002903ac5ef569e6f5b67c05c72496d2cd7993b0a6b SHA512 4b8bd72e93f71fdb52c643776ecefb87fe605effe3f8c1724156cf7fafb8107330d92914eb14208a170cd5a0ee2775e7ea8d8edd0b525a35bbb0d5514172c1c3 WHIRLPOOL c5821ffc0f640e93986cd88f9e530be36e5ba0405a5dbc69a5021c828248dc74541340d5d9d49ece19635b5239bbaeeeb93bad2800fc46e9f441d8ffd3751ca5
+DIST sdlmame-ui.bdf.gz 114727 SHA256 f2ec11dd926bbeae8647e68607107516a30790239464939f3e99a0f62fc7f17e SHA512 67ba1bc632c1ac51b97acf8c1061477edd3519fea3d1233951723741c926ff72e259c274babb036abf4db92f217db507c58a6fc6e438db4b14c5fe5789b2ed64 WHIRLPOOL 2150053b38d8318804bf40cdcd9cdefdd2976c4cfab563c90021f0d9be0a0a57174166ece8b51658d9f2192e07343f198358299667a1db32f146c9fb9c528956
+DIST sdlmame0148u1_diff.zip 3386949 SHA256 27378d09e50f31ca0dd4f39df4c474016671946657eb7af9ea5aa0ffbae1d9bb SHA512 f62aa8ebfc3cfa96d2fd5e58c921cc2adfbe3704a745ef49bc247060ecd3333ecc12e1a3add810c6237f3f7a1946cf1b9d46e6d72aeb87baffebadb933de44de WHIRLPOOL 550f2e777363f307b8e56b4ec31f4852abe89434af5ce596bd6e6023f35a728e4078033b1edc4b302e0cf50fa646a190ec02be9329127379405aec2e9b591531
diff --git a/games-emulation/sdlmame/files/mame-0.139.ini.in b/games-emulation/sdlmame/files/mame-0.139.ini.in
new file mode 100644
index 000000000000..7b69f182a356
--- /dev/null
+++ b/games-emulation/sdlmame/files/mame-0.139.ini.in
@@ -0,0 +1,270 @@
+#
+# CORE CONFIGURATION OPTIONS
+#
+readconfig 1
+writeconfig 0
+
+#
+# CORE SEARCH PATH OPTIONS
+#
+rompath $HOME/.sdlmame/roms;@GAMES_DATADIR@/sdlmame/roms
+samplepath $HOME/.sdlmame/samples;@GAMES_DATADIR@/sdlmame/samples
+artpath $HOME/.sdlmame/artwork;@GAMES_DATADIR@/sdlmame/artwork
+ctrlrpath $HOME/.sdlmame/ctrlr;@GAMES_SYSCONFDIR@/sdlmame/ctrlr;@GAMES_DATADIR@/sdlmame/ctrlr
+inipath $HOME/.sdlmame;@GAMES_SYSCONFDIR@/sdlmame
+fontpath $HOME/.sdlmame;@GAMES_DATADIR@/sdlmame
+cheatpath $HOME/.sdlmame/cheats;@GAMES_SYSCONFDIR@/sdlmame/cheats;@GAMES_DATADIR@/sdlmame/cheats
+crosshairpath $HOME/.sdlmame/crosshair;@GAMES_DATADIR@/sdlmame/crosshair
+
+#
+# CORE OUTPUT DIRECTORY OPTIONS
+#
+cfg_directory $HOME/.sdlmame/cfg
+nvram_directory $HOME/.sdlmame/nvram
+memcard_directory $HOME/.sdlmame/memcard
+input_directory $HOME/.sdlmame/inp
+state_directory $HOME/.sdlmame/sta
+snapshot_directory $HOME/.sdlmame/snap
+diff_directory $HOME/.sdlmame/diff
+comment_directory $HOME/.sdlmame/comments
+
+#
+# CORE STATE/PLAYBACK OPTIONS
+#
+state
+autosave 0
+playback
+record
+mngwrite
+aviwrite
+wavwrite
+snapname %g/%i
+snapsize auto
+snapview internal
+burnin 0
+
+#
+# CORE PERFORMANCE OPTIONS
+#
+autoframeskip 0
+frameskip 0
+seconds_to_run 0
+throttle 1
+sleep 1
+speed 1.0
+refreshspeed 0
+
+#
+# CORE ROTATION OPTIONS
+#
+rotate 1
+ror 0
+rol 0
+autoror 0
+autorol 0
+flipx 0
+flipy 0
+
+#
+# CORE ARTWORK OPTIONS
+#
+artwork_crop 0
+use_backdrops 1
+use_overlays 1
+use_bezels 1
+
+#
+# CORE SCREEN OPTIONS
+#
+brightness 1.0
+contrast 1.0
+gamma 1.0
+pause_brightness 0.65
+
+#
+# CORE VECTOR OPTIONS
+#
+antialias 1
+beam 1.0
+flicker 0
+
+#
+# CORE SOUND OPTIONS
+#
+sound 1
+samplerate 48000
+samples 1
+volume 0
+
+#
+# CORE INPUT OPTIONS
+#
+coin_lockout 1
+ctrlr
+mouse 0
+joystick 1
+lightgun 0
+multikeyboard 0
+multimouse 0
+steadykey 0
+offscreen_reload 0
+joystick_map auto
+joystick_deadzone 0.3
+joystick_saturation 0.85
+natural 0
+uimodekey auto
+
+#
+# CORE INPUT AUTOMATIC ENABLE OPTIONS
+#
+paddle_device keyboard
+adstick_device keyboard
+pedal_device keyboard
+dial_device keyboard
+trackball_device keyboard
+lightgun_device keyboard
+positional_device keyboard
+mouse_device mouse
+
+#
+# CORE DEBUGGING OPTIONS
+#
+log 0
+verbose 0
+update_in_pause 0
+debug 0
+debugscript
+debug_internal 0
+
+#
+# CORE MISC OPTIONS
+#
+bios
+cheat 0
+skip_gameinfo 0
+
+#
+# DEBUGGING OPTIONS
+#
+oslog 0
+
+#
+# PERFORMANCE OPTIONS
+#
+multithreading 0
+numprocessors auto
+sdlvideofps 0
+
+#
+# VIDEO OPTIONS
+#
+video soft
+numscreens 1
+window 0
+maximize 1
+keepaspect 1
+unevenstretch 1
+effect none
+centerh 1
+centerv 1
+waitvsync 0
+scalemode none
+
+#
+# OpenGL-SPECIFIC OPTIONS
+#
+filter 1
+prescale 1
+gl_forcepow2texture 0
+gl_notexturerect 0
+gl_vbo 1
+gl_pbo 1
+gl_glsl 0
+gl_glsl_filter 1
+glsl_shader_mame0 none
+glsl_shader_mame1 none
+glsl_shader_mame2 none
+glsl_shader_mame3 none
+glsl_shader_mame4 none
+glsl_shader_mame5 none
+glsl_shader_mame6 none
+glsl_shader_mame7 none
+glsl_shader_mame8 none
+glsl_shader_mame9 none
+glsl_shader_screen0 none
+glsl_shader_screen1 none
+glsl_shader_screen2 none
+glsl_shader_screen3 none
+glsl_shader_screen4 none
+glsl_shader_screen5 none
+glsl_shader_screen6 none
+glsl_shader_screen7 none
+glsl_shader_screen8 none
+glsl_shader_screen9 none
+gl_glsl_vid_attr 1
+
+#
+# PER-WINDOW VIDEO OPTIONS
+#
+screen auto
+aspect auto
+resolution auto
+view auto
+screen0 auto
+aspect0 auto
+resolution0 auto
+view0 auto
+screen1 auto
+aspect1 auto
+resolution1 auto
+view1 auto
+screen2 auto
+aspect2 auto
+resolution2 auto
+view2 auto
+screen3 auto
+aspect3 auto
+resolution3 auto
+view3 auto
+
+#
+# FULL SCREEN OPTIONS
+#
+switchres 0
+useallheads 0
+
+#
+# SOUND OPTIONS
+#
+audio_latency 3
+
+#
+# SDL KEYBOARD MAPPING
+#
+keymap 0
+keymap_file $HOME/.sdlmame/keymap.dat
+#keymap_file @GAMES_DATADIR@/sdlmame/keymaps/km-be.txt
+#keymap_file @GAMES_DATADIR@/sdlmame/keymaps/km-ch.txt
+#keymap_file @GAMES_DATADIR@/sdlmame/keymaps/km-de.txt
+#keymap_file @GAMES_DATADIR@/sdlmame/keymaps/km-fr.txt
+#keymap_file @GAMES_DATADIR@/sdlmame/keymaps/km_it.txt
+
+#
+# SDL JOYSTICK MAPPING
+#
+joy_idx1 auto
+joy_idx2 auto
+joy_idx3 auto
+joy_idx4 auto
+joy_idx5 auto
+joy_idx6 auto
+joy_idx7 auto
+joy_idx8 auto
+sixaxis 0
+
+#
+# SDL LOWLEVEL DRIVER OPTIONS
+#
+videodriver auto
+audiodriver auto
+gl_lib auto
diff --git a/games-emulation/sdlmame/files/sdlmame-0.144-makefile.patch b/games-emulation/sdlmame/files/sdlmame-0.144-makefile.patch
new file mode 100644
index 000000000000..f69cfe437441
--- /dev/null
+++ b/games-emulation/sdlmame/files/sdlmame-0.144-makefile.patch
@@ -0,0 +1,79 @@
+--- work.orig/makefile 2011-11-09 22:40:30.000000000 -0500
++++ work/makefile 2011-11-16 19:24:24.615419949 -0500
+@@ -435,9 +435,6 @@
+ CPPONLYFLAGS += -x c++ -std=gnu++98
+ COBJFLAGS += -x objective-c++
+
+-# this speeds it up a bit by piping between the preprocessor/compiler/assembler
+-CCOMFLAGS += -pipe
+-
+ # add -g if we need symbols, and ensure we have frame pointers
+ ifdef SYMBOLS
+ CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer
+@@ -442,7 +442,6 @@
+
+ # add -v if we need verbose build information
+ ifdef VERBOSE
+-CCOMFLAGS += -v
+ endif
+
+ # add profiling information for the compiler
+@@ -453,23 +450,6 @@
+ CCOMFLAGS += -pg
+ endif
+
+-# add the optimization flag
+-CCOMFLAGS += -O$(OPTIMIZE)
+-
+-# if we are optimizing, include optimization options
+-# and make all errors into warnings
+-ifneq ($(OPTIMIZE),0)
+-ifneq ($(TARGETOS),os2)
+-ifndef NOWERROR
+-CCOMFLAGS += -Werror -fno-strict-aliasing $(ARCHOPTS)
+-else
+-CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
+-endif
+-else
+-CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
+-endif
+-endif
+-
+ # add a basic set of warnings
+ CCOMFLAGS += \
+ -Wall \
+@@ -524,20 +504,6 @@
+ endif
+
+
+-#-------------------------------------------------
+-# linking flags
+-#-------------------------------------------------
+-
+-# LDFLAGS are used generally; LDFLAGSEMULATOR are additional
+-# flags only used when linking the core emulator
+-LDFLAGS =
+-ifneq ($(TARGETOS),macosx)
+-ifneq ($(TARGETOS),os2)
+-ifneq ($(TARGETOS),solaris)
+-LDFLAGS = -Wl,--warn-common
+-endif
+-endif
+-endif
+ LDFLAGSEMULATOR =
+
+ # add profiling information for the linker
+@@ -545,13 +511,6 @@
+ LDFLAGS += -pg
+ endif
+
+-# strip symbols and other metadata in non-symbols and non profiling builds
+-ifndef SYMBOLS
+-ifneq ($(TARGETOS),macosx)
+-LDFLAGS += -s
+-endif
+-endif
+-
+ # output a map file (emulator only)
+ ifdef MAP
+ LDFLAGSEMULATOR += -Wl,-Map,$(FULLNAME).map
diff --git a/games-emulation/sdlmame/files/sdlmame-0.144-no-opengl.patch b/games-emulation/sdlmame/files/sdlmame-0.144-no-opengl.patch
new file mode 100644
index 000000000000..87eeae5b50c7
--- /dev/null
+++ b/games-emulation/sdlmame/files/sdlmame-0.144-no-opengl.patch
@@ -0,0 +1,11 @@
+--- ./src/osd/sdl/osdsdl.h.orig
++++ ./src/osd/sdl/osdsdl.h
+@@ -225,6 +225,8 @@
+ const char *audio_driver() const { return value(SDLOPTION_AUDIODRIVER); }
+ #if USE_OPENGL
+ const char *gl_lib() const { return value(SDLOPTION_GL_LIB); }
++#else
++ const char *gl_lib() const { return NULL; }
+ #endif
+
+ private:
diff --git a/games-emulation/sdlmame/files/sdlmame-0.148_p1-makefile.patch b/games-emulation/sdlmame/files/sdlmame-0.148_p1-makefile.patch
new file mode 100644
index 000000000000..7ba59692f2e3
--- /dev/null
+++ b/games-emulation/sdlmame/files/sdlmame-0.148_p1-makefile.patch
@@ -0,0 +1,177 @@
+--- makefile
++++ makefile
+@@ -314,13 +314,14 @@
+ endif
+
+ # compiler, linker and utilities
+-AR = @ar
+-CC = @gcc
+-LD = @g++
++AR ?= @ar
++CC ?= @gcc
++CXX ?= @g++
++LD = $(CXX)
+ MD = -mkdir$(EXE)
+ RM = @rm -f
+ OBJDUMP = @objdump
+-PYTHON = @python
++PYTHON ?= @python
+
+
+ #-------------------------------------------------
+@@ -455,7 +456,7 @@
+
+ # CFLAGS is defined based on C or C++ targets
+ # (remember, expansion only happens when used, so doing it here is ok)
+-CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
++CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS)
+
+ # we compile C-only to C89 standard with GNU extensions
+ # we compile C++ code to C++98 standard with GNU extensions
+@@ -463,9 +464,6 @@
+ CPPONLYFLAGS += -x c++ -std=gnu++98
+ COBJFLAGS += -x objective-c++
+
+-# this speeds it up a bit by piping between the preprocessor/compiler/assembler
+-CCOMFLAGS += -pipe
+-
+ # add -g if we need symbols, and ensure we have frame pointers
+ ifdef SYMBOLS
+ CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer
+@@ -479,19 +477,6 @@
+ # add profiling information for the compiler
+ ifdef PROFILE
+ CCOMFLAGS += -pg
+-endif
+-
+-# add the optimization flag
+-CCOMFLAGS += -O$(OPTIMIZE)
+-
+-# add the error warning flag
+-ifndef NOWERROR
+-CCOMFLAGS += -Werror
+-endif
+-
+-# if we are optimizing, include optimization options
+-ifneq ($(OPTIMIZE),0)
+-CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
+ endif
+
+ # add a basic set of warnings
+@@ -565,26 +550,11 @@
+
+ # LDFLAGS are used generally; LDFLAGSEMULATOR are additional
+ # flags only used when linking the core emulator
+-LDFLAGS =
+-ifneq ($(TARGETOS),macosx)
+-ifneq ($(TARGETOS),os2)
+-ifneq ($(TARGETOS),solaris)
+-LDFLAGS = -Wl,--warn-common
+-endif
+-endif
+-endif
+ LDFLAGSEMULATOR =
+
+ # add profiling information for the linker
+ ifdef PROFILE
+ LDFLAGS += -pg
+-endif
+-
+-# strip symbols and other metadata in non-symbols and non profiling builds
+-ifndef SYMBOLS
+-ifneq ($(TARGETOS),macosx)
+-LDFLAGS += -s
+-endif
+ endif
+
+ # output a map file (emulator only)
+--- src/osd/sdl/sdl.mak
++++ src/osd/sdl/sdl.mak
+@@ -24,6 +24,8 @@
+ # uncomment and edit next line to specify a distribution
+ # supported debian-stable, ubuntu-intrepid
+
++PKG_CONFIG ?= pkg-config
++
+ # DISTRO = debian-stable
+ # DISTRO = ubuntu-intrepid
+ # DISTRO = gcc44-generic
+@@ -91,9 +93,9 @@
+ endif
+
+ ifdef SDL_INSTALL_ROOT
+-SDL_CONFIG = $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
+ else
+-SDL_CONFIG = $(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_LIBVER)-config
+ endif
+
+ ifeq ($(SDL_LIBVER),sdl2)
+@@ -190,8 +192,8 @@
+ SDL_NETWORK = taptun
+
+ ifndef NO_USE_MIDI
+-INCPATH += `pkg-config --cflags alsa`
+-LIBS += `pkg-config --libs alsa`
++INCPATH += $(shell $(PKG_CONFIG) --cflags alsa)
++LIBS += $(shell $(PKG_CONFIG) --libs alsa)
+ endif
+
+ endif
+@@ -476,10 +478,10 @@
+ # Remove the "/SDL" component from the include path so that we can compile
+ # files (header files are #include "SDL/something.h", so the extra "/SDL"
+ # causes a significant problem)
+-INCPATH += `sdl-config --cflags | sed 's:/SDL::'`
++INCPATH += $(shell $(SDL_CONFIG) --cflags | sed 's:/SDL::')
+ CCOMFLAGS += -DNO_SDL_GLEXT
+ # Remove libSDLmain, as its symbols conflict with SDLMain_tmpl.m
+-LIBS += `sdl-config --libs | sed 's/-lSDLmain//'` -lpthread
++LIBS += $(shell $(SDL_CONFIG) --libs | sed 's/-lSDLmain//') -lpthread
+ DEFS += -DMACOSX_USE_LIBSDL
+ endif # MACOSX_USE_LIBSDL
+
+@@ -532,8 +534,8 @@
+ endif
+ endif
+
+-INCPATH += `pkg-config --cflags fontconfig`
+-LIBS += `pkg-config --libs fontconfig`
++INCPATH += $(shell $(PKG_CONFIG) --cflags fontconfig)
++LIBS += $(shell $(PKG_CONFIG) --libs fontconfig)
+
+ ifeq ($(SDL_LIBVER),sdl2)
+ LIBS += -lSDL2_ttf
+@@ -616,8 +618,8 @@
+
+ ifeq ($(BASE_TARGETOS),os2)
+
+-INCPATH += `sdl-config --cflags`
+-LIBS += `sdl-config --libs`
++INCPATH += $(shell $(SDL_CONFIG) --cflags)
++LIBS += $(shell $(SDL_CONFIG) --libs)
+
+ endif # OS2
+
+@@ -690,15 +692,15 @@
+
+ # the new debugger relies on GTK+ in addition to the base SDLMAME needs
+ # Non-X11 builds can not use the debugger
+-INCPATH += `pkg-config --cflags-only-I gtk+-2.0` `pkg-config --cflags-only-I gconf-2.0`
+-CCOMFLAGS += `pkg-config --cflags-only-other gtk+-2.0` `pkg-config --cflags-only-other gconf-2.0`
+-LIBS += `pkg-config --libs gtk+-2.0` `pkg-config --libs gconf-2.0`
++INCPATH += $(shell $(PKG_CONFIG) --cflags-only-I gtk+-2.0 gconf-2.0)
++CCOMFLAGS += $(shell $(PKG_CONFIG) --cflags-only-other gtk+-2.0 gconf-2.0)
++LIBS += $(shell $(PKG_CONFIG) --libs gtk+-2.0 gconf-2.0)
+ #CCOMFLAGS += -DGTK_DISABLE_DEPRECATED
+
+ # The newer debugger uses QT
+ ifdef USE_QTDEBUG
+-INCPATH += `pkg-config QtGui --cflags`
+-LIBS += `pkg-config QtGui --libs`
++INCPATH += $(shell $(PKG_CONFIG) QtGui --cflags)
++LIBS += $(shell $(PKG_CONFIG) QtGui --libs)
+ endif
+
+ # some systems still put important things in a different prefix
diff --git a/games-emulation/sdlmame/files/sdlmame-0.148_p1-no-opengl.patch b/games-emulation/sdlmame/files/sdlmame-0.148_p1-no-opengl.patch
new file mode 100644
index 000000000000..7b339ba71a59
--- /dev/null
+++ b/games-emulation/sdlmame/files/sdlmame-0.148_p1-no-opengl.patch
@@ -0,0 +1,12 @@
+diff -Naur a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h
+--- a/src/osd/sdl/osdsdl.h 2012-07-11 20:49:55.070264487 +0200
++++ b/src/osd/sdl/osdsdl.h 2012-07-11 20:51:45.976264395 +0200
+@@ -216,6 +216,8 @@
+ const char *audio_driver() const { return value(SDLOPTION_AUDIODRIVER); }
+ #if USE_OPENGL
+ const char *gl_lib() const { return value(SDLOPTION_GL_LIB); }
++#else
++ const char *gl_lib() const { return NULL; }
+ #endif
+
+ private:
diff --git a/games-emulation/sdlmame/files/sdlmame-0.149-QA.patch b/games-emulation/sdlmame/files/sdlmame-0.149-QA.patch
new file mode 100644
index 000000000000..97e4b8f41c10
--- /dev/null
+++ b/games-emulation/sdlmame/files/sdlmame-0.149-QA.patch
@@ -0,0 +1,191 @@
+commit 938cfdf1f01bcc9ac736249ee6458a774d560738
+Author: hasufell <hasufell@gentoo.org>
+Date: Tue Jun 25 23:48:02 2013 +0200
+
+ QA: respect several environment variables
+
+ such as CC,CFLAGS,PKG_CONFIG...
+
+diff --git a/makefile b/makefile
+index ad6ae2d..dd4598d 100644
+--- a/makefile
++++ b/makefile
+@@ -317,13 +317,15 @@ BUILD_EXE = $(EXE)
+ endif
+
+ # compiler, linker and utilities
+-AR = @ar
+-CC = @gcc
+-LD = @g++
++AR ?= @ar
++CC ?= @gcc
++CXX ?= @g++
++LD = $(CXX)
+ MD = -mkdir$(EXE)
+ RM = @rm -f
+ OBJDUMP = @objdump
+-PYTHON = @python
++PYTHON ?= @python
++PKG_CONFIG ?= pkg-config
+
+
+ #-------------------------------------------------
+@@ -458,7 +460,7 @@ CPPONLYFLAGS =
+
+ # CFLAGS is defined based on C or C++ targets
+ # (remember, expansion only happens when used, so doing it here is ok)
+-CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
++CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS)
+
+ # we compile C-only to C89 standard with GNU extensions
+ # we compile C++ code to C++98 standard with GNU extensions
+@@ -466,9 +468,6 @@ CONLYFLAGS += -std=gnu89
+ CPPONLYFLAGS += -x c++ -std=gnu++98
+ COBJFLAGS += -x objective-c++
+
+-# this speeds it up a bit by piping between the preprocessor/compiler/assembler
+-CCOMFLAGS += -pipe
+-
+ # add -g if we need symbols, and ensure we have frame pointers
+ ifdef SYMBOLS
+ CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer
+@@ -484,19 +483,6 @@ ifdef PROFILE
+ CCOMFLAGS += -pg
+ endif
+
+-# add the optimization flag
+-CCOMFLAGS += -O$(OPTIMIZE)
+-
+-# add the error warning flag
+-ifndef NOWERROR
+-CCOMFLAGS += -Werror
+-endif
+-
+-# if we are optimizing, include optimization options
+-ifneq ($(OPTIMIZE),0)
+-CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
+-endif
+-
+ # add a basic set of warnings
+ CCOMFLAGS += \
+ -Wall \
+@@ -576,14 +562,6 @@ endif
+
+ # LDFLAGS are used generally; LDFLAGSEMULATOR are additional
+ # flags only used when linking the core emulator
+-LDFLAGS =
+-ifneq ($(TARGETOS),macosx)
+-ifneq ($(TARGETOS),os2)
+-ifneq ($(TARGETOS),solaris)
+-LDFLAGS = -Wl,--warn-common
+-endif
+-endif
+-endif
+ LDFLAGSEMULATOR =
+
+ # add profiling information for the linker
+@@ -591,13 +569,6 @@ ifdef PROFILE
+ LDFLAGS += -pg
+ endif
+
+-# strip symbols and other metadata in non-symbols and non profiling builds
+-ifndef SYMBOLS
+-ifneq ($(TARGETOS),macosx)
+-LDFLAGS += -s
+-endif
+-endif
+-
+ # output a map file (emulator only)
+ ifdef MAP
+ LDFLAGSEMULATOR += -Wl,-Map,$(FULLNAME).map
+diff --git a/src/osd/sdl/sdl.mak b/src/osd/sdl/sdl.mak
+index 84332ef..36655d3 100644
+--- a/src/osd/sdl/sdl.mak
++++ b/src/osd/sdl/sdl.mak
+@@ -24,6 +24,8 @@
+ # uncomment and edit next line to specify a distribution
+ # supported debian-stable, ubuntu-intrepid
+
++PKG_CONFIG ?= pkg-config
++
+ # DISTRO = debian-stable
+ # DISTRO = ubuntu-intrepid
+ # DISTRO = gcc44-generic
+@@ -88,9 +90,9 @@ SDL_LIBVER = sdl
+ endif
+
+ ifdef SDL_INSTALL_ROOT
+-SDL_CONFIG = $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
+ else
+-SDL_CONFIG = $(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_LIBVER)-config
+ endif
+
+ ifeq ($(SDL_LIBVER),sdl2)
+@@ -187,8 +189,8 @@ SYNC_IMPLEMENTATION = tc
+ SDL_NETWORK = taptun
+
+ ifndef NO_USE_MIDI
+-INCPATH += `pkg-config --cflags alsa`
+-LIBS += `pkg-config --libs alsa`
++INCPATH += $(shell $(PKG_CONFIG) --cflags alsa)
++LIBS += $(shell $(PKG_CONFIG) --libs alsa)
+ endif
+
+ endif
+@@ -478,10 +480,10 @@ else
+ # Remove the "/SDL" component from the include path so that we can compile
+ # files (header files are #include "SDL/something.h", so the extra "/SDL"
+ # causes a significant problem)
+-INCPATH += `sdl-config --cflags | sed 's:/SDL::'`
++INCPATH += $(shell $(SDL_CONFIG) --cflags | sed 's:/SDL::')
+ CCOMFLAGS += -DNO_SDL_GLEXT
+ # Remove libSDLmain, as its symbols conflict with SDLMain_tmpl.m
+-LIBS += `sdl-config --libs | sed 's/-lSDLmain//'` -lpthread
++LIBS += $(shell $(SDL_CONFIG) --libs | sed 's/-lSDLmain//') -lpthread
+ DEFS += -DMACOSX_USE_LIBSDL
+ endif # MACOSX_USE_LIBSDL
+
+@@ -534,8 +536,8 @@ INCPATH += -I$(SDL_INSTALL_ROOT)/include/directfb
+ endif
+ endif
+
+-INCPATH += `pkg-config --cflags fontconfig`
+-LIBS += `pkg-config --libs fontconfig`
++INCPATH += $(shell $(PKG_CONFIG) --cflags fontconfig)
++LIBS += $(shell $(PKG_CONFIG) --libs fontconfig)
+
+ ifeq ($(SDL_LIBVER),sdl2)
+ LIBS += -lSDL2_ttf
+@@ -620,8 +622,8 @@ endif # Win32
+
+ ifeq ($(BASE_TARGETOS),os2)
+
+-INCPATH += `sdl-config --cflags`
+-LIBS += `sdl-config --libs`
++INCPATH += $(shell $(SDL_CONFIG) --cflags)
++LIBS += $(shell $(SDL_CONFIG) --libs)
+
+ endif # OS2
+
+@@ -696,14 +698,14 @@ LIBS += -lX11 -lXinerama
+
+ # The newer debugger uses QT
+ ifndef NO_USE_QTDEBUG
+-INCPATH += `pkg-config QtGui --cflags`
+-LIBS += `pkg-config QtGui --libs`
++INCPATH += $(shell $(PKG_CONFIG) QtGui --cflags)
++LIBS += $(shell $(PKG_CONFIG) QtGui --libs)
+ else
+ # the old-new debugger relies on GTK+ in addition to the base SDLMAME needs
+ # Non-X11 builds can not use the debugger
+-INCPATH += `pkg-config --cflags-only-I gtk+-2.0` `pkg-config --cflags-only-I gconf-2.0`
+-CCOMFLAGS += `pkg-config --cflags-only-other gtk+-2.0` `pkg-config --cflags-only-other gconf-2.0`
+-LIBS += `pkg-config --libs gtk+-2.0` `pkg-config --libs gconf-2.0`
++INCPATH += $(shell $(PKG_CONFIG) --cflags-only-I gtk+-2.0 gconf-2.0)
++CCOMFLAGS += $(shell $(PKG_CONFIG) --cflags-only-other gtk+-2.0 gconf-2.0)
++LIBS += $(shell $(PKG_CONFIG) --libs gtk+-2.0 gconf-2.0)
+ endif
+
+ # some systems still put important things in a different prefix
diff --git a/games-emulation/sdlmame/files/sdlmame-0.149-debugger-linking.patch b/games-emulation/sdlmame/files/sdlmame-0.149-debugger-linking.patch
new file mode 100644
index 000000000000..6c7cd5d64199
--- /dev/null
+++ b/games-emulation/sdlmame/files/sdlmame-0.149-debugger-linking.patch
@@ -0,0 +1,28 @@
+commit ec92ac2b0180b101c30748e62eb8b76cdf0cb439
+Author: hasufell <hasufell@gentoo.org>
+Date: Wed Jun 26 14:33:01 2013 +0200
+
+ remove unneeded linking
+
+ if we don't build the debugger, we don't want gtk+ linking
+
+diff --git a/src/osd/sdl/sdl.mak b/src/osd/sdl/sdl.mak
+index 36655d3..2089707 100644
+--- a/src/osd/sdl/sdl.mak
++++ b/src/osd/sdl/sdl.mak
+@@ -696,6 +696,7 @@ else
+ DEFS += -DSDLMAME_X11
+ LIBS += -lX11 -lXinerama
+
++ifneq ($(NO_DEBUGGER),1)
+ # The newer debugger uses QT
+ ifndef NO_USE_QTDEBUG
+ INCPATH += $(shell $(PKG_CONFIG) QtGui --cflags)
+@@ -707,6 +708,7 @@ INCPATH += $(shell $(PKG_CONFIG) --cflags-only-I gtk+-2.0 gconf-2.0)
+ CCOMFLAGS += $(shell $(PKG_CONFIG) --cflags-only-other gtk+-2.0 gconf-2.0)
+ LIBS += $(shell $(PKG_CONFIG) --libs gtk+-2.0 gconf-2.0)
+ endif
++endif # NO_DEBUGGER
+
+ # some systems still put important things in a different prefix
+ LIBS += -L/usr/X11/lib -L/usr/X11R6/lib -L/usr/openwin/lib
diff --git a/games-emulation/sdlmame/files/sdlmame-0.149-no-opengl.patch b/games-emulation/sdlmame/files/sdlmame-0.149-no-opengl.patch
new file mode 100644
index 000000000000..cd32cd35d075
--- /dev/null
+++ b/games-emulation/sdlmame/files/sdlmame-0.149-no-opengl.patch
@@ -0,0 +1,19 @@
+commit 6ee372b3693857372a7b4855039ad1a94d3aebca
+Author: hasufell <hasufell@gentoo.org>
+Date: Tue Jun 25 23:51:12 2013 +0200
+
+ fix for disabled opengl
+
+diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h
+index ed0b66b..03d68f9 100644
+--- a/src/osd/sdl/osdsdl.h
++++ b/src/osd/sdl/osdsdl.h
+@@ -219,6 +219,8 @@ public:
+ const char *audio_driver() const { return value(SDLOPTION_AUDIODRIVER); }
+ #if USE_OPENGL
+ const char *gl_lib() const { return value(SDLOPTION_GL_LIB); }
++#else
++ const char *gl_lib() const { return NULL; }
+ #endif
+
+ private:
diff --git a/games-emulation/sdlmame/files/sdlmame-0.149-system-lua.patch b/games-emulation/sdlmame/files/sdlmame-0.149-system-lua.patch
new file mode 100644
index 000000000000..8460497f1d68
--- /dev/null
+++ b/games-emulation/sdlmame/files/sdlmame-0.149-system-lua.patch
@@ -0,0 +1,33 @@
+commit ea514c9ded266aa365976649d88fa5593ef7ebf5
+Author: hasufell <hasufell@gentoo.org>
+Date: Tue Jun 25 23:48:26 2013 +0200
+
+ add switch to use system lua
+
+diff --git a/makefile b/makefile
+index dd4598d..bdf22d2 100644
+--- a/makefile
++++ b/makefile
+@@ -228,6 +228,9 @@ BUILD_JPEGLIB = 1
+ # uncomment next line to build PortMidi as part of MAME/MESS build
+ BUILD_MIDILIB = 1
+
++# uncomment next line to build Lua-5.2 as part of MAME/MESS build
++BUILD_LUA = 1
++
+ # uncomment next line to include the symbols
+ # SYMBOLS = 1
+
+@@ -664,7 +667,12 @@ SOFTFLOAT = $(OBJ)/libsoftfloat.a
+ FORMATS_LIB = $(OBJ)/libformats.a
+
+ # add LUA library
++ifeq ($(BUILD_LUA),1)
+ LUA_LIB = $(OBJ)/liblua.a
++else
++LIBS += $(shell $(PKG_CONFIG) --libs lua)
++INCPATH += $(shell $(PKG_CONFIG) --cflags lua)
++endif
+
+ # add PortMidi MIDI library
+ ifeq ($(BUILD_MIDILIB),1)
diff --git a/games-emulation/sdlmame/files/vector.ini b/games-emulation/sdlmame/files/vector.ini
new file mode 100644
index 000000000000..d4906e34ccd7
--- /dev/null
+++ b/games-emulation/sdlmame/files/vector.ini
@@ -0,0 +1,9 @@
+#
+# Specific options file for vector games
+#
+
+#
+# VIDEO OPTIONS
+#
+video soft
+yuvmode yv12
diff --git a/games-emulation/sdlmame/metadata.xml b/games-emulation/sdlmame/metadata.xml
new file mode 100644
index 000000000000..f8f417e8c63a
--- /dev/null
+++ b/games-emulation/sdlmame/metadata.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+<longdescription>
+SDLMAME is a port of the popular MAME[tm]. There are a few principles that guide it's development:
+
+1) run on Linux/Unix, Mac OS X, and other SDL supported operating systems with as few changes as
+possible to the base Win32 code. This means we can track changes faster than larger more conventional
+ports such as MacMAME, and we also maintain what I call "Firefox compatibilty" where learning a major
+app only needs to be done once per application, and it then applies across many operating systems. If
+you can use the command-line Win32 MAME, you already know how to use SDLMAME on any platform you may
+encounter it on.
+
+2) MAME developers are important. By keeping quickly up to date, we make it easy for people on
+non-Windows platforms to make and submit changes to the core MAME code, and we offer native
+implementations of MAME's multi-window GUI debugger on both Linux/Unix and Mac OS X.
+</longdescription>
+</pkgmetadata>
diff --git a/games-emulation/sdlmame/sdlmame-0.148_p1-r1.ebuild b/games-emulation/sdlmame/sdlmame-0.148_p1-r1.ebuild
new file mode 100644
index 000000000000..efc1b52ad281
--- /dev/null
+++ b/games-emulation/sdlmame/sdlmame-0.148_p1-r1.ebuild
@@ -0,0 +1,186 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+inherit eutils flag-o-matic python-any-r1 games
+
+MY_PV=${PV/.}
+MY_CONF_PN=${PN/sdl}
+MY_P=sdlmame${MY_PV}
+MY_P=${MY_P%%_p*}
+MY_CONF_VER="0.139"
+
+# patches
+SRC_URI="$(for PATCH_VER in $(seq 1 ${PV##*_p}) ; do echo "http://dev.gentoo.org/~hasufell/distfiles/${MY_P}u${PATCH_VER}_diff.zip"; done)"
+
+DESCRIPTION="Multiple Arcade Machine Emulator (SDL)"
+HOMEPAGE="http://mamedev.org/"
+# Upstream doesn't allow fetching with unknown User-Agent such as wget
+SRC_URI="$SRC_URI http://dev.gentoo.org/~hasufell/distfiles/${MY_P/sdl}s.zip"
+if [[ ${PN} == "sdlmame" ]] ; then
+ SRC_URI="$SRC_URI http://www.netswarm.net/misc/sdlmame-ui.bdf.gz"
+fi
+
+LICENSE="XMAME"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE="X alsa debug opengl"
+REQUIRED_USE="debug? ( X )"
+
+RDEPEND="dev-libs/expat
+ media-libs/fontconfig
+ media-libs/flac
+ >=media-libs/libsdl-1.2.10[X,sound,joystick,opengl?,video]
+ media-libs/sdl-ttf
+ sys-libs/zlib
+ virtual/jpeg
+ alsa? ( media-libs/alsa-lib )
+ X? (
+ gnome-base/gconf
+ x11-libs/gtk+:2
+ x11-libs/libX11
+ x11-libs/libXinerama
+ )"
+DEPEND="${RDEPEND}
+ ${PYTHON_DEPS}
+ app-arch/unzip
+ media-libs/alsa-lib
+ virtual/pkgconfig
+ X? ( x11-proto/xineramaproto )"
+
+S=${WORKDIR}
+
+# Function to disable a makefile option
+disable_feature() {
+ sed -i \
+ -e "/$1.*=/s:^:# :" \
+ "${S}"/makefile \
+ || die "sed failed"
+}
+
+# Function to enable a makefile option
+enable_feature() {
+ sed -i \
+ -e "/^#.*$1.*=/s:^#::" \
+ "${S}"/${2:-makefile} \
+ || die "sed failed"
+}
+
+pkg_setup() {
+ games_pkg_setup
+ python-any-r1_pkg_setup
+}
+
+src_unpack() {
+ default
+ unpack ./mame.zip
+ rm -f mame.zip
+}
+
+src_prepare() {
+ if [[ $PV == *_p* ]] ; then
+ edos2unix $(find $(grep +++ *diff | awk '{ print $2 }' | sort -u) 2>/dev/null) *diff
+ einfo "Patching release with source updates"
+ epatch ${MY_PV%%_p*}*.diff
+ fi
+ edos2unix src/osd/sdl/osdsdl.h
+
+ epatch \
+ "${FILESDIR}"/${P}-makefile.patch \
+ "${FILESDIR}"/${P}-no-opengl.patch
+
+ # Don't compile zlib and expat
+ einfo "Disabling embedded libraries: expat, flac, jpeg, zlib"
+ disable_feature BUILD_EXPAT
+ disable_feature BUILD_FLAC
+ disable_feature BUILD_JPEG
+ disable_feature BUILD_ZLIB
+
+ if use amd64; then
+ einfo "Enabling 64-bit support"
+ enable_feature PTR64
+ fi
+
+ if use ppc; then
+ einfo "Enabling PPC support"
+ enable_feature BIGENDIAN
+ fi
+
+ if use debug; then
+ einfo "Enabling debug support"
+ enable_feature DEBUG
+ fi
+
+ if ! use opengl ; then
+ einfo "Disabling opengl support"
+ enable_feature NO_OPENGL src/osd/sdl/sdl.mak
+ fi
+
+ if ! use alsa ; then
+ einfo "Disabling alsa midi support"
+ enable_feature NO_USE_MIDI src/osd/sdl/sdl.mak
+ fi
+
+ if ! use X ; then
+ einfo "Disabling X support"
+ enable_feature NO_X11 src/osd/sdl/sdl.mak
+ fi
+}
+
+src_compile() {
+ emake \
+ TARGET="${PN#sdl}" \
+ NAME="${PN}" \
+ OPT_FLAGS='-DINI_PATH=\"\$$HOME/.'${PN}'\;'"${GAMES_SYSCONFDIR}/${PN}"'\"' \
+ NO_DEBUGGER=$(usex debug "0" "1") default
+}
+
+src_install() {
+ newgamesbin ${PN}$(use amd64 && echo 64)$(use debug && echo d) ${PN}
+
+ newman src/osd/sdl/man/${PN#sdl}.6 ${PN}.6
+
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins -r src/osd/sdl/keymaps
+ [[ ${PN} == "sdlmame" ]] && newins sdlmame-ui.bdf ui.bdf
+
+ insinto "${GAMES_SYSCONFDIR}/${PN}"
+ doins "${FILESDIR}"/vector.ini
+
+ sed \
+ -e "s:@GAMES_SYSCONFDIR@:${GAMES_SYSCONFDIR}:" \
+ -e "s:@GAMES_DATADIR@:${GAMES_DATADIR}:" \
+ "${FILESDIR}/${MY_CONF_PN}-${MY_CONF_VER}".ini.in > "${D}/${GAMES_SYSCONFDIR}/${PN}/${MY_CONF_PN}".ini \
+ || die "sed failed"
+
+ dodoc docs/{config,mame,newvideo}.txt
+ if [[ ${PN} == "sdlmame" ]] ; then
+ dodoc whatsnew*.txt
+ else
+ dodoc messnew*.txt
+ fi
+
+ keepdir \
+ "${GAMES_DATADIR}/${PN}"/{ctrlr,cheats,roms,samples,artwork,crosshair} \
+ "${GAMES_SYSCONFDIR}/${PN}"/{ctrlr,cheats}
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+
+ elog "optional dependencies:"
+ elog " games-emulation/sdlmametools (development tools)"
+ echo
+ elog "It's strongly recommended that you change either the system-wide"
+ elog "${MY_CONF_PN}.ini at \"${GAMES_SYSCONFDIR}/${PN}\" or use a per-user setup at \$HOME/.${PN}"
+
+ if use opengl; then
+ echo
+ elog "You built ${PN} with opengl support and should set"
+ elog "\"video\" to \"opengl\" in ${MY_CONF_PN}.ini to take advantage of that"
+ fi
+}
diff --git a/games-emulation/sdlmame/sdlmame-0.149.ebuild b/games-emulation/sdlmame/sdlmame-0.149.ebuild
new file mode 100644
index 000000000000..b5d95f52a2c1
--- /dev/null
+++ b/games-emulation/sdlmame/sdlmame-0.149.ebuild
@@ -0,0 +1,194 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+inherit eutils flag-o-matic python-any-r1 games
+
+MY_PV=${PV/.}
+MY_CONF_PN=${PN/sdl}
+MY_P=sdlmame${MY_PV}
+MY_P=${MY_P%%_p*}
+MY_CONF_VER="0.139"
+
+# patches
+SRC_URI="$(for PATCH_VER in $(seq 1 ${PV##*_p}) ; do echo "http://dev.gentoo.org/~hasufell/distfiles/${MY_P}u${PATCH_VER}_diff.zip"; done)"
+
+DESCRIPTION="Multiple Arcade Machine Emulator (SDL)"
+HOMEPAGE="http://mamedev.org/"
+# Upstream doesn't allow fetching with unknown User-Agent such as wget
+SRC_URI="$SRC_URI http://dev.gentoo.org/~hasufell/distfiles/${MY_P/sdl}s.zip"
+if [[ ${PN} == "sdlmame" ]] ; then
+ SRC_URI="$SRC_URI http://www.netswarm.net/misc/sdlmame-ui.bdf.gz"
+fi
+
+LICENSE="XMAME"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE="X alsa debug opengl"
+REQUIRED_USE="debug? ( X )"
+
+RDEPEND=">=dev-lang/lua-5.2
+ dev-libs/expat
+ media-libs/fontconfig
+ media-libs/flac
+ >=media-libs/libsdl-1.2.10[sound,joystick,opengl?,video]
+ media-libs/sdl-ttf
+ sys-libs/zlib
+ virtual/jpeg
+ alsa? ( media-libs/alsa-lib )
+ debug? (
+ x11-libs/gtk+:2
+ gnome-base/gconf
+ )
+ X? (
+ x11-libs/libX11
+ x11-libs/libXinerama
+ )"
+DEPEND="${RDEPEND}
+ ${PYTHON_DEPS}
+ app-arch/unzip
+ virtual/pkgconfig
+ X? ( x11-proto/xineramaproto )"
+
+S=${WORKDIR}
+
+# Function to disable a makefile option
+disable_feature() {
+ sed -i \
+ -e "/$1.*=/s:^:# :" \
+ "${S}"/${2:-makefile} \
+ || die "sed failed"
+}
+
+# Function to enable a makefile option
+enable_feature() {
+ sed -i \
+ -e "/^#.*$1.*=/s:^#::" \
+ "${S}"/${2:-makefile} \
+ || die "sed failed"
+}
+
+pkg_setup() {
+ games_pkg_setup
+ python-any-r1_pkg_setup
+}
+
+src_unpack() {
+ default
+ unpack ./mame.zip
+ rm -f mame.zip
+}
+
+src_prepare() {
+ if [[ $PV == *_p* ]] ; then
+ edos2unix $(find $(grep +++ *diff | awk '{ print $2 }' | sort -u) 2>/dev/null) *diff
+ einfo "Patching release with source updates"
+ epatch ${MY_PV%%_p*}*.diff
+ fi
+ edos2unix makefile src/osd/sdl/{osdsdl.h,sdl.mak}
+
+ epatch \
+ "${FILESDIR}"/${P}-QA.patch \
+ "${FILESDIR}"/${P}-system-lua.patch \
+ "${FILESDIR}"/${P}-no-opengl.patch \
+ "${FILESDIR}"/${P}-debugger-linking.patch
+
+ # Don't compile zlib and expat
+ einfo "Disabling embedded libraries: expat, flac, jpeg, zlib, lua"
+ disable_feature BUILD_EXPAT
+ disable_feature BUILD_FLAC
+ disable_feature BUILD_JPEG
+ disable_feature BUILD_ZLIB
+ disable_feature BUILD_LUA
+
+ if use amd64; then
+ einfo "Enabling 64-bit support"
+ enable_feature PTR64
+ fi
+
+ if use ppc; then
+ einfo "Enabling PPC support"
+ enable_feature BIGENDIAN
+ fi
+
+ if use debug; then
+ einfo "Enabling debug support"
+ enable_feature DEBUG
+ enable_feature DEBUG src/osd/sdl/sdl.mak
+ fi
+
+ enable_feature NO_USE_QTDEBUG src/osd/sdl/sdl.mak
+
+ if ! use opengl ; then
+ einfo "Disabling opengl support"
+ enable_feature NO_OPENGL src/osd/sdl/sdl.mak
+ fi
+
+ if ! use alsa ; then
+ einfo "Disabling alsa midi support"
+ enable_feature NO_USE_MIDI src/osd/sdl/sdl.mak
+ fi
+
+ if ! use X ; then
+ einfo "Disabling X support"
+ enable_feature NO_X11 src/osd/sdl/sdl.mak
+ fi
+}
+
+src_compile() {
+ emake \
+ TARGET="${PN#sdl}" \
+ NAME="${PN}" \
+ OPT_FLAGS='-DINI_PATH=\"\$$HOME/.'${PN}'\;'"${GAMES_SYSCONFDIR}/${PN}"'\"' \
+ NO_DEBUGGER=$(usex debug "0" "1") default
+}
+
+src_install() {
+ newgamesbin ${PN}$(use amd64 && echo 64)$(use debug && echo d) ${PN}
+
+ newman src/osd/sdl/man/${PN#sdl}.6 ${PN}.6
+
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins -r src/osd/sdl/keymaps
+ [[ ${PN} == "sdlmame" ]] && newins sdlmame-ui.bdf ui.bdf
+
+ insinto "${GAMES_SYSCONFDIR}/${PN}"
+ doins "${FILESDIR}"/vector.ini
+
+ sed \
+ -e "s:@GAMES_SYSCONFDIR@:${GAMES_SYSCONFDIR}:" \
+ -e "s:@GAMES_DATADIR@:${GAMES_DATADIR}:" \
+ "${FILESDIR}/${MY_CONF_PN}-${MY_CONF_VER}".ini.in > "${D}/${GAMES_SYSCONFDIR}/${PN}/${MY_CONF_PN}".ini \
+ || die "sed failed"
+
+ dodoc docs/{config,mame,newvideo}.txt
+ if [[ ${PN} == "sdlmame" ]] ; then
+ dodoc whatsnew*.txt
+ else
+ dodoc messnew*.txt
+ fi
+
+ keepdir \
+ "${GAMES_DATADIR}/${PN}"/{ctrlr,cheats,roms,samples,artwork,crosshair} \
+ "${GAMES_SYSCONFDIR}/${PN}"/{ctrlr,cheats}
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+
+ elog "optional dependencies:"
+ elog " games-emulation/sdlmametools (development tools)"
+ echo
+ elog "It's strongly recommended that you change either the system-wide"
+ elog "${MY_CONF_PN}.ini at \"${GAMES_SYSCONFDIR}/${PN}\" or use a per-user setup at \$HOME/.${PN}"
+
+ if use opengl; then
+ echo
+ elog "You built ${PN} with opengl support and should set"
+ elog "\"video\" to \"opengl\" in ${MY_CONF_PN}.ini to take advantage of that"
+ fi
+}
diff --git a/games-emulation/sdlmametools/Manifest b/games-emulation/sdlmametools/Manifest
new file mode 100644
index 000000000000..f0e246118259
--- /dev/null
+++ b/games-emulation/sdlmametools/Manifest
@@ -0,0 +1,3 @@
+DIST mame0148s.zip 33822494 SHA256 78d8a68ba53934fdfc895f450c08682dada81f7ec3e74a98fb042539506d9321 SHA512 a520115e2e82b2da3200ffa1fa56f668f95c3e26a927bcdb30a34e73053e55d26a6a6c1ec95eae1237bce1d2d0cd276b84466705fd5f53ac77827d06ea04bc03 WHIRLPOOL c6de71c198396977475110ab5840b7eaa6e5074519adffc286dd539ab916ea951fa1c307218b0d144cdc8aeeb096216106a3c21a6d53b42c04dc75e8103be04a
+DIST mame0149s.zip 35160585 SHA256 0e41b5773bea217d3ca04002903ac5ef569e6f5b67c05c72496d2cd7993b0a6b SHA512 4b8bd72e93f71fdb52c643776ecefb87fe605effe3f8c1724156cf7fafb8107330d92914eb14208a170cd5a0ee2775e7ea8d8edd0b525a35bbb0d5514172c1c3 WHIRLPOOL c5821ffc0f640e93986cd88f9e530be36e5ba0405a5dbc69a5021c828248dc74541340d5d9d49ece19635b5239bbaeeeb93bad2800fc46e9f441d8ffd3751ca5
+DIST sdlmame0148u1_diff.zip 3386949 SHA256 27378d09e50f31ca0dd4f39df4c474016671946657eb7af9ea5aa0ffbae1d9bb SHA512 f62aa8ebfc3cfa96d2fd5e58c921cc2adfbe3704a745ef49bc247060ecd3333ecc12e1a3add810c6237f3f7a1946cf1b9d46e6d72aeb87baffebadb933de44de WHIRLPOOL 550f2e777363f307b8e56b4ec31f4852abe89434af5ce596bd6e6023f35a728e4078033b1edc4b302e0cf50fa646a190ec02be9329127379405aec2e9b591531
diff --git a/games-emulation/sdlmametools/files/sdlmametools-0.148_p1-makefile.patch b/games-emulation/sdlmametools/files/sdlmametools-0.148_p1-makefile.patch
new file mode 100644
index 000000000000..7ba59692f2e3
--- /dev/null
+++ b/games-emulation/sdlmametools/files/sdlmametools-0.148_p1-makefile.patch
@@ -0,0 +1,177 @@
+--- makefile
++++ makefile
+@@ -314,13 +314,14 @@
+ endif
+
+ # compiler, linker and utilities
+-AR = @ar
+-CC = @gcc
+-LD = @g++
++AR ?= @ar
++CC ?= @gcc
++CXX ?= @g++
++LD = $(CXX)
+ MD = -mkdir$(EXE)
+ RM = @rm -f
+ OBJDUMP = @objdump
+-PYTHON = @python
++PYTHON ?= @python
+
+
+ #-------------------------------------------------
+@@ -455,7 +456,7 @@
+
+ # CFLAGS is defined based on C or C++ targets
+ # (remember, expansion only happens when used, so doing it here is ok)
+-CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
++CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS)
+
+ # we compile C-only to C89 standard with GNU extensions
+ # we compile C++ code to C++98 standard with GNU extensions
+@@ -463,9 +464,6 @@
+ CPPONLYFLAGS += -x c++ -std=gnu++98
+ COBJFLAGS += -x objective-c++
+
+-# this speeds it up a bit by piping between the preprocessor/compiler/assembler
+-CCOMFLAGS += -pipe
+-
+ # add -g if we need symbols, and ensure we have frame pointers
+ ifdef SYMBOLS
+ CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer
+@@ -479,19 +477,6 @@
+ # add profiling information for the compiler
+ ifdef PROFILE
+ CCOMFLAGS += -pg
+-endif
+-
+-# add the optimization flag
+-CCOMFLAGS += -O$(OPTIMIZE)
+-
+-# add the error warning flag
+-ifndef NOWERROR
+-CCOMFLAGS += -Werror
+-endif
+-
+-# if we are optimizing, include optimization options
+-ifneq ($(OPTIMIZE),0)
+-CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
+ endif
+
+ # add a basic set of warnings
+@@ -565,26 +550,11 @@
+
+ # LDFLAGS are used generally; LDFLAGSEMULATOR are additional
+ # flags only used when linking the core emulator
+-LDFLAGS =
+-ifneq ($(TARGETOS),macosx)
+-ifneq ($(TARGETOS),os2)
+-ifneq ($(TARGETOS),solaris)
+-LDFLAGS = -Wl,--warn-common
+-endif
+-endif
+-endif
+ LDFLAGSEMULATOR =
+
+ # add profiling information for the linker
+ ifdef PROFILE
+ LDFLAGS += -pg
+-endif
+-
+-# strip symbols and other metadata in non-symbols and non profiling builds
+-ifndef SYMBOLS
+-ifneq ($(TARGETOS),macosx)
+-LDFLAGS += -s
+-endif
+ endif
+
+ # output a map file (emulator only)
+--- src/osd/sdl/sdl.mak
++++ src/osd/sdl/sdl.mak
+@@ -24,6 +24,8 @@
+ # uncomment and edit next line to specify a distribution
+ # supported debian-stable, ubuntu-intrepid
+
++PKG_CONFIG ?= pkg-config
++
+ # DISTRO = debian-stable
+ # DISTRO = ubuntu-intrepid
+ # DISTRO = gcc44-generic
+@@ -91,9 +93,9 @@
+ endif
+
+ ifdef SDL_INSTALL_ROOT
+-SDL_CONFIG = $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
+ else
+-SDL_CONFIG = $(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_LIBVER)-config
+ endif
+
+ ifeq ($(SDL_LIBVER),sdl2)
+@@ -190,8 +192,8 @@
+ SDL_NETWORK = taptun
+
+ ifndef NO_USE_MIDI
+-INCPATH += `pkg-config --cflags alsa`
+-LIBS += `pkg-config --libs alsa`
++INCPATH += $(shell $(PKG_CONFIG) --cflags alsa)
++LIBS += $(shell $(PKG_CONFIG) --libs alsa)
+ endif
+
+ endif
+@@ -476,10 +478,10 @@
+ # Remove the "/SDL" component from the include path so that we can compile
+ # files (header files are #include "SDL/something.h", so the extra "/SDL"
+ # causes a significant problem)
+-INCPATH += `sdl-config --cflags | sed 's:/SDL::'`
++INCPATH += $(shell $(SDL_CONFIG) --cflags | sed 's:/SDL::')
+ CCOMFLAGS += -DNO_SDL_GLEXT
+ # Remove libSDLmain, as its symbols conflict with SDLMain_tmpl.m
+-LIBS += `sdl-config --libs | sed 's/-lSDLmain//'` -lpthread
++LIBS += $(shell $(SDL_CONFIG) --libs | sed 's/-lSDLmain//') -lpthread
+ DEFS += -DMACOSX_USE_LIBSDL
+ endif # MACOSX_USE_LIBSDL
+
+@@ -532,8 +534,8 @@
+ endif
+ endif
+
+-INCPATH += `pkg-config --cflags fontconfig`
+-LIBS += `pkg-config --libs fontconfig`
++INCPATH += $(shell $(PKG_CONFIG) --cflags fontconfig)
++LIBS += $(shell $(PKG_CONFIG) --libs fontconfig)
+
+ ifeq ($(SDL_LIBVER),sdl2)
+ LIBS += -lSDL2_ttf
+@@ -616,8 +618,8 @@
+
+ ifeq ($(BASE_TARGETOS),os2)
+
+-INCPATH += `sdl-config --cflags`
+-LIBS += `sdl-config --libs`
++INCPATH += $(shell $(SDL_CONFIG) --cflags)
++LIBS += $(shell $(SDL_CONFIG) --libs)
+
+ endif # OS2
+
+@@ -690,15 +692,15 @@
+
+ # the new debugger relies on GTK+ in addition to the base SDLMAME needs
+ # Non-X11 builds can not use the debugger
+-INCPATH += `pkg-config --cflags-only-I gtk+-2.0` `pkg-config --cflags-only-I gconf-2.0`
+-CCOMFLAGS += `pkg-config --cflags-only-other gtk+-2.0` `pkg-config --cflags-only-other gconf-2.0`
+-LIBS += `pkg-config --libs gtk+-2.0` `pkg-config --libs gconf-2.0`
++INCPATH += $(shell $(PKG_CONFIG) --cflags-only-I gtk+-2.0 gconf-2.0)
++CCOMFLAGS += $(shell $(PKG_CONFIG) --cflags-only-other gtk+-2.0 gconf-2.0)
++LIBS += $(shell $(PKG_CONFIG) --libs gtk+-2.0 gconf-2.0)
+ #CCOMFLAGS += -DGTK_DISABLE_DEPRECATED
+
+ # The newer debugger uses QT
+ ifdef USE_QTDEBUG
+-INCPATH += `pkg-config QtGui --cflags`
+-LIBS += `pkg-config QtGui --libs`
++INCPATH += $(shell $(PKG_CONFIG) QtGui --cflags)
++LIBS += $(shell $(PKG_CONFIG) QtGui --libs)
+ endif
+
+ # some systems still put important things in a different prefix
diff --git a/games-emulation/sdlmametools/files/sdlmametools-0.148_p1-no-opengl.patch b/games-emulation/sdlmametools/files/sdlmametools-0.148_p1-no-opengl.patch
new file mode 100644
index 000000000000..7b339ba71a59
--- /dev/null
+++ b/games-emulation/sdlmametools/files/sdlmametools-0.148_p1-no-opengl.patch
@@ -0,0 +1,12 @@
+diff -Naur a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h
+--- a/src/osd/sdl/osdsdl.h 2012-07-11 20:49:55.070264487 +0200
++++ b/src/osd/sdl/osdsdl.h 2012-07-11 20:51:45.976264395 +0200
+@@ -216,6 +216,8 @@
+ const char *audio_driver() const { return value(SDLOPTION_AUDIODRIVER); }
+ #if USE_OPENGL
+ const char *gl_lib() const { return value(SDLOPTION_GL_LIB); }
++#else
++ const char *gl_lib() const { return NULL; }
+ #endif
+
+ private:
diff --git a/games-emulation/sdlmametools/files/sdlmametools-0.149-QA.patch b/games-emulation/sdlmametools/files/sdlmametools-0.149-QA.patch
new file mode 100644
index 000000000000..97e4b8f41c10
--- /dev/null
+++ b/games-emulation/sdlmametools/files/sdlmametools-0.149-QA.patch
@@ -0,0 +1,191 @@
+commit 938cfdf1f01bcc9ac736249ee6458a774d560738
+Author: hasufell <hasufell@gentoo.org>
+Date: Tue Jun 25 23:48:02 2013 +0200
+
+ QA: respect several environment variables
+
+ such as CC,CFLAGS,PKG_CONFIG...
+
+diff --git a/makefile b/makefile
+index ad6ae2d..dd4598d 100644
+--- a/makefile
++++ b/makefile
+@@ -317,13 +317,15 @@ BUILD_EXE = $(EXE)
+ endif
+
+ # compiler, linker and utilities
+-AR = @ar
+-CC = @gcc
+-LD = @g++
++AR ?= @ar
++CC ?= @gcc
++CXX ?= @g++
++LD = $(CXX)
+ MD = -mkdir$(EXE)
+ RM = @rm -f
+ OBJDUMP = @objdump
+-PYTHON = @python
++PYTHON ?= @python
++PKG_CONFIG ?= pkg-config
+
+
+ #-------------------------------------------------
+@@ -458,7 +460,7 @@ CPPONLYFLAGS =
+
+ # CFLAGS is defined based on C or C++ targets
+ # (remember, expansion only happens when used, so doing it here is ok)
+-CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
++CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS)
+
+ # we compile C-only to C89 standard with GNU extensions
+ # we compile C++ code to C++98 standard with GNU extensions
+@@ -466,9 +468,6 @@ CONLYFLAGS += -std=gnu89
+ CPPONLYFLAGS += -x c++ -std=gnu++98
+ COBJFLAGS += -x objective-c++
+
+-# this speeds it up a bit by piping between the preprocessor/compiler/assembler
+-CCOMFLAGS += -pipe
+-
+ # add -g if we need symbols, and ensure we have frame pointers
+ ifdef SYMBOLS
+ CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer
+@@ -484,19 +483,6 @@ ifdef PROFILE
+ CCOMFLAGS += -pg
+ endif
+
+-# add the optimization flag
+-CCOMFLAGS += -O$(OPTIMIZE)
+-
+-# add the error warning flag
+-ifndef NOWERROR
+-CCOMFLAGS += -Werror
+-endif
+-
+-# if we are optimizing, include optimization options
+-ifneq ($(OPTIMIZE),0)
+-CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
+-endif
+-
+ # add a basic set of warnings
+ CCOMFLAGS += \
+ -Wall \
+@@ -576,14 +562,6 @@ endif
+
+ # LDFLAGS are used generally; LDFLAGSEMULATOR are additional
+ # flags only used when linking the core emulator
+-LDFLAGS =
+-ifneq ($(TARGETOS),macosx)
+-ifneq ($(TARGETOS),os2)
+-ifneq ($(TARGETOS),solaris)
+-LDFLAGS = -Wl,--warn-common
+-endif
+-endif
+-endif
+ LDFLAGSEMULATOR =
+
+ # add profiling information for the linker
+@@ -591,13 +569,6 @@ ifdef PROFILE
+ LDFLAGS += -pg
+ endif
+
+-# strip symbols and other metadata in non-symbols and non profiling builds
+-ifndef SYMBOLS
+-ifneq ($(TARGETOS),macosx)
+-LDFLAGS += -s
+-endif
+-endif
+-
+ # output a map file (emulator only)
+ ifdef MAP
+ LDFLAGSEMULATOR += -Wl,-Map,$(FULLNAME).map
+diff --git a/src/osd/sdl/sdl.mak b/src/osd/sdl/sdl.mak
+index 84332ef..36655d3 100644
+--- a/src/osd/sdl/sdl.mak
++++ b/src/osd/sdl/sdl.mak
+@@ -24,6 +24,8 @@
+ # uncomment and edit next line to specify a distribution
+ # supported debian-stable, ubuntu-intrepid
+
++PKG_CONFIG ?= pkg-config
++
+ # DISTRO = debian-stable
+ # DISTRO = ubuntu-intrepid
+ # DISTRO = gcc44-generic
+@@ -88,9 +90,9 @@ SDL_LIBVER = sdl
+ endif
+
+ ifdef SDL_INSTALL_ROOT
+-SDL_CONFIG = $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
+ else
+-SDL_CONFIG = $(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_LIBVER)-config
+ endif
+
+ ifeq ($(SDL_LIBVER),sdl2)
+@@ -187,8 +189,8 @@ SYNC_IMPLEMENTATION = tc
+ SDL_NETWORK = taptun
+
+ ifndef NO_USE_MIDI
+-INCPATH += `pkg-config --cflags alsa`
+-LIBS += `pkg-config --libs alsa`
++INCPATH += $(shell $(PKG_CONFIG) --cflags alsa)
++LIBS += $(shell $(PKG_CONFIG) --libs alsa)
+ endif
+
+ endif
+@@ -478,10 +480,10 @@ else
+ # Remove the "/SDL" component from the include path so that we can compile
+ # files (header files are #include "SDL/something.h", so the extra "/SDL"
+ # causes a significant problem)
+-INCPATH += `sdl-config --cflags | sed 's:/SDL::'`
++INCPATH += $(shell $(SDL_CONFIG) --cflags | sed 's:/SDL::')
+ CCOMFLAGS += -DNO_SDL_GLEXT
+ # Remove libSDLmain, as its symbols conflict with SDLMain_tmpl.m
+-LIBS += `sdl-config --libs | sed 's/-lSDLmain//'` -lpthread
++LIBS += $(shell $(SDL_CONFIG) --libs | sed 's/-lSDLmain//') -lpthread
+ DEFS += -DMACOSX_USE_LIBSDL
+ endif # MACOSX_USE_LIBSDL
+
+@@ -534,8 +536,8 @@ INCPATH += -I$(SDL_INSTALL_ROOT)/include/directfb
+ endif
+ endif
+
+-INCPATH += `pkg-config --cflags fontconfig`
+-LIBS += `pkg-config --libs fontconfig`
++INCPATH += $(shell $(PKG_CONFIG) --cflags fontconfig)
++LIBS += $(shell $(PKG_CONFIG) --libs fontconfig)
+
+ ifeq ($(SDL_LIBVER),sdl2)
+ LIBS += -lSDL2_ttf
+@@ -620,8 +622,8 @@ endif # Win32
+
+ ifeq ($(BASE_TARGETOS),os2)
+
+-INCPATH += `sdl-config --cflags`
+-LIBS += `sdl-config --libs`
++INCPATH += $(shell $(SDL_CONFIG) --cflags)
++LIBS += $(shell $(SDL_CONFIG) --libs)
+
+ endif # OS2
+
+@@ -696,14 +698,14 @@ LIBS += -lX11 -lXinerama
+
+ # The newer debugger uses QT
+ ifndef NO_USE_QTDEBUG
+-INCPATH += `pkg-config QtGui --cflags`
+-LIBS += `pkg-config QtGui --libs`
++INCPATH += $(shell $(PKG_CONFIG) QtGui --cflags)
++LIBS += $(shell $(PKG_CONFIG) QtGui --libs)
+ else
+ # the old-new debugger relies on GTK+ in addition to the base SDLMAME needs
+ # Non-X11 builds can not use the debugger
+-INCPATH += `pkg-config --cflags-only-I gtk+-2.0` `pkg-config --cflags-only-I gconf-2.0`
+-CCOMFLAGS += `pkg-config --cflags-only-other gtk+-2.0` `pkg-config --cflags-only-other gconf-2.0`
+-LIBS += `pkg-config --libs gtk+-2.0` `pkg-config --libs gconf-2.0`
++INCPATH += $(shell $(PKG_CONFIG) --cflags-only-I gtk+-2.0 gconf-2.0)
++CCOMFLAGS += $(shell $(PKG_CONFIG) --cflags-only-other gtk+-2.0 gconf-2.0)
++LIBS += $(shell $(PKG_CONFIG) --libs gtk+-2.0 gconf-2.0)
+ endif
+
+ # some systems still put important things in a different prefix
diff --git a/games-emulation/sdlmametools/files/sdlmametools-0.149-debugger-linking.patch b/games-emulation/sdlmametools/files/sdlmametools-0.149-debugger-linking.patch
new file mode 100644
index 000000000000..6c7cd5d64199
--- /dev/null
+++ b/games-emulation/sdlmametools/files/sdlmametools-0.149-debugger-linking.patch
@@ -0,0 +1,28 @@
+commit ec92ac2b0180b101c30748e62eb8b76cdf0cb439
+Author: hasufell <hasufell@gentoo.org>
+Date: Wed Jun 26 14:33:01 2013 +0200
+
+ remove unneeded linking
+
+ if we don't build the debugger, we don't want gtk+ linking
+
+diff --git a/src/osd/sdl/sdl.mak b/src/osd/sdl/sdl.mak
+index 36655d3..2089707 100644
+--- a/src/osd/sdl/sdl.mak
++++ b/src/osd/sdl/sdl.mak
+@@ -696,6 +696,7 @@ else
+ DEFS += -DSDLMAME_X11
+ LIBS += -lX11 -lXinerama
+
++ifneq ($(NO_DEBUGGER),1)
+ # The newer debugger uses QT
+ ifndef NO_USE_QTDEBUG
+ INCPATH += $(shell $(PKG_CONFIG) QtGui --cflags)
+@@ -707,6 +708,7 @@ INCPATH += $(shell $(PKG_CONFIG) --cflags-only-I gtk+-2.0 gconf-2.0)
+ CCOMFLAGS += $(shell $(PKG_CONFIG) --cflags-only-other gtk+-2.0 gconf-2.0)
+ LIBS += $(shell $(PKG_CONFIG) --libs gtk+-2.0 gconf-2.0)
+ endif
++endif # NO_DEBUGGER
+
+ # some systems still put important things in a different prefix
+ LIBS += -L/usr/X11/lib -L/usr/X11R6/lib -L/usr/openwin/lib
diff --git a/games-emulation/sdlmametools/files/sdlmametools-0.149-no-opengl.patch b/games-emulation/sdlmametools/files/sdlmametools-0.149-no-opengl.patch
new file mode 100644
index 000000000000..cd32cd35d075
--- /dev/null
+++ b/games-emulation/sdlmametools/files/sdlmametools-0.149-no-opengl.patch
@@ -0,0 +1,19 @@
+commit 6ee372b3693857372a7b4855039ad1a94d3aebca
+Author: hasufell <hasufell@gentoo.org>
+Date: Tue Jun 25 23:51:12 2013 +0200
+
+ fix for disabled opengl
+
+diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h
+index ed0b66b..03d68f9 100644
+--- a/src/osd/sdl/osdsdl.h
++++ b/src/osd/sdl/osdsdl.h
+@@ -219,6 +219,8 @@ public:
+ const char *audio_driver() const { return value(SDLOPTION_AUDIODRIVER); }
+ #if USE_OPENGL
+ const char *gl_lib() const { return value(SDLOPTION_GL_LIB); }
++#else
++ const char *gl_lib() const { return NULL; }
+ #endif
+
+ private:
diff --git a/games-emulation/sdlmametools/files/sdlmametools-0.149-system-lua.patch b/games-emulation/sdlmametools/files/sdlmametools-0.149-system-lua.patch
new file mode 100644
index 000000000000..8460497f1d68
--- /dev/null
+++ b/games-emulation/sdlmametools/files/sdlmametools-0.149-system-lua.patch
@@ -0,0 +1,33 @@
+commit ea514c9ded266aa365976649d88fa5593ef7ebf5
+Author: hasufell <hasufell@gentoo.org>
+Date: Tue Jun 25 23:48:26 2013 +0200
+
+ add switch to use system lua
+
+diff --git a/makefile b/makefile
+index dd4598d..bdf22d2 100644
+--- a/makefile
++++ b/makefile
+@@ -228,6 +228,9 @@ BUILD_JPEGLIB = 1
+ # uncomment next line to build PortMidi as part of MAME/MESS build
+ BUILD_MIDILIB = 1
+
++# uncomment next line to build Lua-5.2 as part of MAME/MESS build
++BUILD_LUA = 1
++
+ # uncomment next line to include the symbols
+ # SYMBOLS = 1
+
+@@ -664,7 +667,12 @@ SOFTFLOAT = $(OBJ)/libsoftfloat.a
+ FORMATS_LIB = $(OBJ)/libformats.a
+
+ # add LUA library
++ifeq ($(BUILD_LUA),1)
+ LUA_LIB = $(OBJ)/liblua.a
++else
++LIBS += $(shell $(PKG_CONFIG) --libs lua)
++INCPATH += $(shell $(PKG_CONFIG) --cflags lua)
++endif
+
+ # add PortMidi MIDI library
+ ifeq ($(BUILD_MIDILIB),1)
diff --git a/games-emulation/sdlmametools/metadata.xml b/games-emulation/sdlmametools/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/sdlmametools/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/sdlmametools/sdlmametools-0.148_p1.ebuild b/games-emulation/sdlmametools/sdlmametools-0.148_p1.ebuild
new file mode 100644
index 000000000000..c2fa17874ce1
--- /dev/null
+++ b/games-emulation/sdlmametools/sdlmametools-0.148_p1.ebuild
@@ -0,0 +1,123 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+inherit eutils flag-o-matic python-any-r1 games
+
+MY_PV=${PV/.}
+MY_P=${PN%tools}${MY_PV}
+MY_P=${MY_P%%_p*}
+
+# patches
+SRC_URI="$(for PATCH_VER in $(seq 1 ${PV##*_p}) ; do echo "http://dev.gentoo.org/~hasufell/distfiles/${MY_P}u${PATCH_VER}_diff.zip"; done)"
+
+DESCRIPTION="Set of development tools shared between sdlmame and sdlmess"
+HOMEPAGE="http://mamedev.org/"
+# Upstream doesn't allow fetching with unknown User-Agent such as wget
+SRC_URI="$SRC_URI http://dev.gentoo.org/~hasufell/distfiles/${MY_P/sdl}s.zip"
+
+LICENSE="XMAME"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE="X debug"
+REQUIRED_USE="debug? ( X )"
+
+RDEPEND="
+ dev-libs/expat
+ media-libs/flac
+ >=media-libs/libsdl-1.2.10
+ media-libs/sdl-ttf
+ sys-libs/zlib
+ X? (
+ x11-libs/libX11
+ )"
+DEPEND="${RDEPEND}
+ ${PYTHON_DEPS}
+ app-arch/unzip
+ virtual/pkgconfig
+ X? ( x11-proto/xineramaproto )"
+
+S=${WORKDIR}
+
+# Function to disable a makefile option
+disable_feature() {
+ sed -i \
+ -e "/$1.*=/s:^:# :" \
+ "${S}"/makefile \
+ || die "sed failed"
+}
+
+# Function to enable a makefile option
+enable_feature() {
+ sed -i \
+ -e "/^#.*$1.*=/s:^#::" \
+ "${S}"/${2:-makefile} \
+ || die "sed failed"
+}
+
+pkg_setup() {
+ games_pkg_setup
+ python-any-r1_pkg_setup
+}
+
+src_unpack() {
+ default
+ unpack ./mame.zip
+ rm -f mame.zip
+}
+
+src_prepare() {
+ if [[ $PV == *_p* ]] ; then
+ edos2unix $(find $(grep +++ *diff | awk '{ print $2 }' | sort -u) 2>/dev/null) *diff
+ einfo "Patching release with source updates"
+ epatch ${MY_PV%%_p*}*.diff
+ fi
+ edos2unix src/osd/sdl/osdsdl.h
+
+ epatch \
+ "${FILESDIR}"/${P}-makefile.patch \
+ "${FILESDIR}"/${P}-no-opengl.patch
+
+ # Don't compile zlib and expat
+ einfo "Disabling embedded libraries: expat, flac, jpeg, zlib"
+ disable_feature BUILD_EXPAT
+ disable_feature BUILD_FLAC
+ disable_feature BUILD_JPEG
+ disable_feature BUILD_ZLIB
+
+ if use amd64; then
+ einfo "Enabling 64-bit support"
+ enable_feature PTR64
+ fi
+
+ if use ppc; then
+ einfo "Enabling PPC support"
+ enable_feature BIGENDIAN
+ fi
+
+ if use debug; then
+ einfo "Enabling debug support"
+ enable_feature DEBUG
+ fi
+
+ if ! use X ; then
+ einfo "Disabling X support"
+ enable_feature NO_X11 src/osd/sdl/sdl.mak
+ fi
+}
+
+src_compile() {
+ emake \
+ NO_DEBUGGER=$(usex debug "0" "1") tools
+}
+
+src_install() {
+ for i in chdman jedutil ldresample ldverify regrep romcmp testkeys ; do
+ newgamesbin ${i} sdlmame-${i}
+ [[ -f src/osd/sdl/man/${i}.1 ]] && newman src/osd/sdl/man/${i}.1 sdlmame-${i}.1
+ done
+
+ prepgamesdirs
+}
diff --git a/games-emulation/sdlmametools/sdlmametools-0.149.ebuild b/games-emulation/sdlmametools/sdlmametools-0.149.ebuild
new file mode 100644
index 000000000000..f40990650c07
--- /dev/null
+++ b/games-emulation/sdlmametools/sdlmametools-0.149.ebuild
@@ -0,0 +1,118 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+inherit eutils flag-o-matic python-any-r1 games
+
+MY_PV=${PV/.}
+MY_P=${PN%tools}${MY_PV}
+MY_P=${MY_P%%_p*}
+
+# patches
+SRC_URI="$(for PATCH_VER in $(seq 1 ${PV##*_p}) ; do echo "http://dev.gentoo.org/~hasufell/distfiles/${MY_P}u${PATCH_VER}_diff.zip"; done)"
+
+DESCRIPTION="Set of development tools shared between sdlmame and sdlmess"
+HOMEPAGE="http://mamedev.org/"
+# Upstream doesn't allow fetching with unknown User-Agent such as wget
+SRC_URI="$SRC_URI http://dev.gentoo.org/~hasufell/distfiles/${MY_P/sdl}s.zip"
+
+LICENSE="XMAME"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+IUSE=""
+
+RDEPEND="
+ dev-libs/expat
+ media-libs/flac
+ >=media-libs/libsdl-1.2.10
+ media-libs/sdl-ttf
+ sys-libs/zlib"
+DEPEND="${RDEPEND}
+ ${PYTHON_DEPS}
+ app-arch/unzip
+ virtual/pkgconfig"
+
+S=${WORKDIR}
+
+# Function to disable a makefile option
+disable_feature() {
+ sed -i \
+ -e "/$1.*=/s:^:# :" \
+ "${S}"/${2:-makefile} \
+ || die "sed failed"
+}
+
+# Function to enable a makefile option
+enable_feature() {
+ sed -i \
+ -e "/^#.*$1.*=/s:^#::" \
+ "${S}"/${2:-makefile} \
+ || die "sed failed"
+}
+
+pkg_setup() {
+ games_pkg_setup
+ python-any-r1_pkg_setup
+}
+
+src_unpack() {
+ default
+ unpack ./mame.zip
+ rm -f mame.zip
+}
+
+src_prepare() {
+ if [[ $PV == *_p* ]] ; then
+ edos2unix $(find $(grep +++ *diff | awk '{ print $2 }' | sort -u) 2>/dev/null) *diff
+ einfo "Patching release with source updates"
+ epatch ${MY_PV%%_p*}*.diff
+ fi
+ edos2unix makefile src/osd/sdl/{osdsdl.h,sdl.mak}
+
+ epatch \
+ "${FILESDIR}"/${P}-QA.patch \
+ "${FILESDIR}"/${P}-system-lua.patch \
+ "${FILESDIR}"/${P}-no-opengl.patch \
+ "${FILESDIR}"/${P}-debugger-linking.patch
+
+ # Don't compile zlib and expat
+ einfo "Disabling embedded libraries: expat, flac, jpeg, zlib, lua"
+ disable_feature BUILD_EXPAT
+ disable_feature BUILD_FLAC
+ disable_feature BUILD_JPEG
+ disable_feature BUILD_ZLIB
+
+ # unused, avoid linking
+# disable_feature BUILD_LUA
+
+ if use amd64; then
+ einfo "Enabling 64-bit support"
+ enable_feature PTR64
+ fi
+
+ if use ppc; then
+ einfo "Enabling PPC support"
+ enable_feature BIGENDIAN
+ fi
+
+ enable_feature NO_USE_MIDI src/osd/sdl/sdl.mak
+ enable_feature NO_USE_QTDEBUG src/osd/sdl/sdl.mak
+ enable_feature NO_OPENGL src/osd/sdl/sdl.mak
+ enable_feature NO_X11 src/osd/sdl/sdl.mak
+}
+
+src_compile() {
+ emake \
+ NO_DEBUGGER=1 tools
+}
+
+src_install() {
+ for i in chdman jedutil ldresample ldverify romcmp testkeys ; do
+ newgamesbin ${i} sdlmame-${i}
+ newman src/osd/sdl/man/${i}.1 sdlmame-${i}.1
+ done
+
+ prepgamesdirs
+}
diff --git a/games-emulation/sdlmess/Manifest b/games-emulation/sdlmess/Manifest
new file mode 100644
index 000000000000..f0e246118259
--- /dev/null
+++ b/games-emulation/sdlmess/Manifest
@@ -0,0 +1,3 @@
+DIST mame0148s.zip 33822494 SHA256 78d8a68ba53934fdfc895f450c08682dada81f7ec3e74a98fb042539506d9321 SHA512 a520115e2e82b2da3200ffa1fa56f668f95c3e26a927bcdb30a34e73053e55d26a6a6c1ec95eae1237bce1d2d0cd276b84466705fd5f53ac77827d06ea04bc03 WHIRLPOOL c6de71c198396977475110ab5840b7eaa6e5074519adffc286dd539ab916ea951fa1c307218b0d144cdc8aeeb096216106a3c21a6d53b42c04dc75e8103be04a
+DIST mame0149s.zip 35160585 SHA256 0e41b5773bea217d3ca04002903ac5ef569e6f5b67c05c72496d2cd7993b0a6b SHA512 4b8bd72e93f71fdb52c643776ecefb87fe605effe3f8c1724156cf7fafb8107330d92914eb14208a170cd5a0ee2775e7ea8d8edd0b525a35bbb0d5514172c1c3 WHIRLPOOL c5821ffc0f640e93986cd88f9e530be36e5ba0405a5dbc69a5021c828248dc74541340d5d9d49ece19635b5239bbaeeeb93bad2800fc46e9f441d8ffd3751ca5
+DIST sdlmame0148u1_diff.zip 3386949 SHA256 27378d09e50f31ca0dd4f39df4c474016671946657eb7af9ea5aa0ffbae1d9bb SHA512 f62aa8ebfc3cfa96d2fd5e58c921cc2adfbe3704a745ef49bc247060ecd3333ecc12e1a3add810c6237f3f7a1946cf1b9d46e6d72aeb87baffebadb933de44de WHIRLPOOL 550f2e777363f307b8e56b4ec31f4852abe89434af5ce596bd6e6023f35a728e4078033b1edc4b302e0cf50fa646a190ec02be9329127379405aec2e9b591531
diff --git a/games-emulation/sdlmess/files/mess-0.148.ini.in b/games-emulation/sdlmess/files/mess-0.148.ini.in
new file mode 100644
index 000000000000..91d4db10aa44
--- /dev/null
+++ b/games-emulation/sdlmess/files/mess-0.148.ini.in
@@ -0,0 +1,283 @@
+#
+# CORE CONFIGURATION OPTIONS
+#
+readconfig 1
+writeconfig 0
+
+#
+# CORE SEARCH PATH OPTIONS
+#
+rompath $HOME/.sdlmess/roms;@GAMES_DATADIR@/sdlmess/roms
+hashpath hash
+samplepath $HOME/.sdlmess/samples;@GAMES_DATADIR@/sdlmess/samples
+artpath $HOME/.sdlmess/artwork;@GAMES_DATADIR@/sdlmess/artwork
+ctrlrpath $HOME/.sdlmess/ctrlr;@GAMES_SYSCONFDIR@/sdlmess/ctrlr;@GAMES_DATADIR@/sdlmess/ctrlr
+inipath $HOME/.sdlmess;@GAMES_SYSCONFDIR@/sdlmess
+fontpath $HOME/.sdlmess;@GAMES_DATADIR@/sdlmess
+cheatpath $HOME/.sdlmess/cheats;@GAMES_SYSCONFDIR@/sdlmess/cheats;@GAMES_DATADIR@/sdlmess/cheats
+crosshairpath $HOME/.sdlmess/crosshair;@GAMES_DATADIR@/sdlmess/crosshair
+
+#
+# CORE OUTPUT DIRECTORY OPTIONS
+#
+cfg_directory $HOME/.sdlmess/cfg
+nvram_directory $HOME/.sdlmess/nvram
+memcard_directory $HOME/.sdlmess/memcard
+input_directory $HOME/.sdlmess/inp
+state_directory $HOME/.sdlmess/sta
+snapshot_directory $HOME/.sdlmess/snap
+diff_directory $HOME/.sdlmess/diff
+comment_directory $HOME/.sdlmess/comments
+
+#
+# CORE STATE/PLAYBACK OPTIONS
+#
+state
+autosave 0
+playback
+record
+mngwrite
+aviwrite
+wavwrite
+snapname %g/%i
+snapsize auto
+snapview internal
+burnin 0
+
+#
+# CORE PERFORMANCE OPTIONS
+#
+autoframeskip 0
+frameskip 0
+seconds_to_run 0
+throttle 1
+sleep 1
+speed 1.0
+refreshspeed 0
+
+#
+# CORE ROTATION OPTIONS
+#
+rotate 1
+ror 0
+rol 0
+autoror 0
+autorol 0
+flipx 0
+flipy 0
+
+#
+# CORE ARTWORK OPTIONS
+#
+artwork_crop 0
+use_backdrops 1
+use_overlays 1
+use_bezels 1
+use_cpanels 1
+use_marquees 1
+
+#
+# CORE SCREEN OPTIONS
+#
+brightness 1.0
+contrast 1.0
+gamma 1.0
+pause_brightness 0.65
+effect none
+
+#
+# CORE VECTOR OPTIONS
+#
+antialias 1
+beam 1.0
+flicker 0
+
+#
+# CORE SOUND OPTIONS
+#
+sound 1
+samplerate 48000
+samples 1
+volume 0
+
+#
+# CORE INPUT OPTIONS
+#
+coin_lockout 1
+ctrlr
+mouse 0
+joystick 1
+lightgun 0
+multikeyboard 0
+multimouse 0
+steadykey 0
+ui_active 0
+offscreen_reload 0
+joystick_map auto
+joystick_deadzone 0.3
+joystick_saturation 0.85
+natural 0
+joystick_contradictory 0
+coin_impulse 0
+
+#
+# CORE INPUT AUTOMATIC ENABLE OPTIONS
+#
+paddle_device keyboard
+adstick_device keyboard
+pedal_device keyboard
+dial_device keyboard
+trackball_device keyboard
+lightgun_device keyboard
+positional_device keyboard
+mouse_device mouse
+
+#
+# CORE DEBUGGING OPTIONS
+#
+log 0
+verbose 0
+update_in_pause 0
+debug 0
+debugscript
+debug_internal 0
+
+#
+# CORE MISC OPTIONS
+#
+bios
+cheat 0
+skip_gameinfo 0
+uifont default
+ramsize
+confirm_quit 0
+ui_mouse 0
+
+#
+# DEBUGGING OPTIONS
+#
+oslog 0
+watchdog 0
+
+#
+# PERFORMANCE OPTIONS
+#
+multithreading 0
+numprocessors auto
+sdlvideofps 0
+bench 0
+
+#
+# VIDEO OPTIONS
+#
+video soft
+numscreens 1
+window 0
+maximize 1
+keepaspect 1
+unevenstretch 1
+centerh 1
+centerv 1
+waitvsync 0
+syncrefresh 0
+scalemode none
+
+#
+# OpenGL-SPECIFIC OPTIONS
+#
+filter 1
+prescale 1
+gl_forcepow2texture 0
+gl_notexturerect 0
+gl_vbo 1
+gl_pbo 1
+gl_glsl 0
+gl_glsl_filter 1
+glsl_shader_mame0 none
+glsl_shader_mame1 none
+glsl_shader_mame2 none
+glsl_shader_mame3 none
+glsl_shader_mame4 none
+glsl_shader_mame5 none
+glsl_shader_mame6 none
+glsl_shader_mame7 none
+glsl_shader_mame8 none
+glsl_shader_mame9 none
+glsl_shader_screen0 none
+glsl_shader_screen1 none
+glsl_shader_screen2 none
+glsl_shader_screen3 none
+glsl_shader_screen4 none
+glsl_shader_screen5 none
+glsl_shader_screen6 none
+glsl_shader_screen7 none
+glsl_shader_screen8 none
+glsl_shader_screen9 none
+gl_glsl_vid_attr 1
+
+#
+# PER-WINDOW VIDEO OPTIONS
+#
+screen auto
+aspect auto
+resolution auto
+view auto
+screen0 auto
+aspect0 auto
+resolution0 auto
+view0 auto
+screen1 auto
+aspect1 auto
+resolution1 auto
+view1 auto
+screen2 auto
+aspect2 auto
+resolution2 auto
+view2 auto
+screen3 auto
+aspect3 auto
+resolution3 auto
+view3 auto
+
+#
+# FULL SCREEN OPTIONS
+#
+switchres 0
+useallheads 0
+
+#
+# SOUND OPTIONS
+#
+audio_latency 3
+
+#
+# SDL KEYBOARD MAPPING
+#
+keymap 0
+keymap_file $HOME/.sdlmess/keymap.dat
+uimodekey auto
+#keymap_file @GAMES_DATADIR@/sdlmess/keymaps/km-be.txt
+#keymap_file @GAMES_DATADIR@/sdlmess/keymaps/km-ch.txt
+#keymap_file @GAMES_DATADIR@/sdlmess/keymaps/km-de.txt
+#keymap_file @GAMES_DATADIR@/sdlmess/keymaps/km-fr.txt
+#keymap_file @GAMES_DATADIR@/sdlmess/keymaps/km_it.txt
+
+#
+# SDL JOYSTICK MAPPING
+#
+joy_idx1 auto
+joy_idx2 auto
+joy_idx3 auto
+joy_idx4 auto
+joy_idx5 auto
+joy_idx6 auto
+joy_idx7 auto
+joy_idx8 auto
+sixaxis 0
+
+#
+# SDL LOWLEVEL DRIVER OPTIONS
+#
+videodriver auto
+audiodriver auto
+gl_lib auto
diff --git a/games-emulation/sdlmess/files/sdlmess-0.148_p1-makefile.patch b/games-emulation/sdlmess/files/sdlmess-0.148_p1-makefile.patch
new file mode 100644
index 000000000000..7ba59692f2e3
--- /dev/null
+++ b/games-emulation/sdlmess/files/sdlmess-0.148_p1-makefile.patch
@@ -0,0 +1,177 @@
+--- makefile
++++ makefile
+@@ -314,13 +314,14 @@
+ endif
+
+ # compiler, linker and utilities
+-AR = @ar
+-CC = @gcc
+-LD = @g++
++AR ?= @ar
++CC ?= @gcc
++CXX ?= @g++
++LD = $(CXX)
+ MD = -mkdir$(EXE)
+ RM = @rm -f
+ OBJDUMP = @objdump
+-PYTHON = @python
++PYTHON ?= @python
+
+
+ #-------------------------------------------------
+@@ -455,7 +456,7 @@
+
+ # CFLAGS is defined based on C or C++ targets
+ # (remember, expansion only happens when used, so doing it here is ok)
+-CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
++CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS)
+
+ # we compile C-only to C89 standard with GNU extensions
+ # we compile C++ code to C++98 standard with GNU extensions
+@@ -463,9 +464,6 @@
+ CPPONLYFLAGS += -x c++ -std=gnu++98
+ COBJFLAGS += -x objective-c++
+
+-# this speeds it up a bit by piping between the preprocessor/compiler/assembler
+-CCOMFLAGS += -pipe
+-
+ # add -g if we need symbols, and ensure we have frame pointers
+ ifdef SYMBOLS
+ CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer
+@@ -479,19 +477,6 @@
+ # add profiling information for the compiler
+ ifdef PROFILE
+ CCOMFLAGS += -pg
+-endif
+-
+-# add the optimization flag
+-CCOMFLAGS += -O$(OPTIMIZE)
+-
+-# add the error warning flag
+-ifndef NOWERROR
+-CCOMFLAGS += -Werror
+-endif
+-
+-# if we are optimizing, include optimization options
+-ifneq ($(OPTIMIZE),0)
+-CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
+ endif
+
+ # add a basic set of warnings
+@@ -565,26 +550,11 @@
+
+ # LDFLAGS are used generally; LDFLAGSEMULATOR are additional
+ # flags only used when linking the core emulator
+-LDFLAGS =
+-ifneq ($(TARGETOS),macosx)
+-ifneq ($(TARGETOS),os2)
+-ifneq ($(TARGETOS),solaris)
+-LDFLAGS = -Wl,--warn-common
+-endif
+-endif
+-endif
+ LDFLAGSEMULATOR =
+
+ # add profiling information for the linker
+ ifdef PROFILE
+ LDFLAGS += -pg
+-endif
+-
+-# strip symbols and other metadata in non-symbols and non profiling builds
+-ifndef SYMBOLS
+-ifneq ($(TARGETOS),macosx)
+-LDFLAGS += -s
+-endif
+ endif
+
+ # output a map file (emulator only)
+--- src/osd/sdl/sdl.mak
++++ src/osd/sdl/sdl.mak
+@@ -24,6 +24,8 @@
+ # uncomment and edit next line to specify a distribution
+ # supported debian-stable, ubuntu-intrepid
+
++PKG_CONFIG ?= pkg-config
++
+ # DISTRO = debian-stable
+ # DISTRO = ubuntu-intrepid
+ # DISTRO = gcc44-generic
+@@ -91,9 +93,9 @@
+ endif
+
+ ifdef SDL_INSTALL_ROOT
+-SDL_CONFIG = $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
+ else
+-SDL_CONFIG = $(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_LIBVER)-config
+ endif
+
+ ifeq ($(SDL_LIBVER),sdl2)
+@@ -190,8 +192,8 @@
+ SDL_NETWORK = taptun
+
+ ifndef NO_USE_MIDI
+-INCPATH += `pkg-config --cflags alsa`
+-LIBS += `pkg-config --libs alsa`
++INCPATH += $(shell $(PKG_CONFIG) --cflags alsa)
++LIBS += $(shell $(PKG_CONFIG) --libs alsa)
+ endif
+
+ endif
+@@ -476,10 +478,10 @@
+ # Remove the "/SDL" component from the include path so that we can compile
+ # files (header files are #include "SDL/something.h", so the extra "/SDL"
+ # causes a significant problem)
+-INCPATH += `sdl-config --cflags | sed 's:/SDL::'`
++INCPATH += $(shell $(SDL_CONFIG) --cflags | sed 's:/SDL::')
+ CCOMFLAGS += -DNO_SDL_GLEXT
+ # Remove libSDLmain, as its symbols conflict with SDLMain_tmpl.m
+-LIBS += `sdl-config --libs | sed 's/-lSDLmain//'` -lpthread
++LIBS += $(shell $(SDL_CONFIG) --libs | sed 's/-lSDLmain//') -lpthread
+ DEFS += -DMACOSX_USE_LIBSDL
+ endif # MACOSX_USE_LIBSDL
+
+@@ -532,8 +534,8 @@
+ endif
+ endif
+
+-INCPATH += `pkg-config --cflags fontconfig`
+-LIBS += `pkg-config --libs fontconfig`
++INCPATH += $(shell $(PKG_CONFIG) --cflags fontconfig)
++LIBS += $(shell $(PKG_CONFIG) --libs fontconfig)
+
+ ifeq ($(SDL_LIBVER),sdl2)
+ LIBS += -lSDL2_ttf
+@@ -616,8 +618,8 @@
+
+ ifeq ($(BASE_TARGETOS),os2)
+
+-INCPATH += `sdl-config --cflags`
+-LIBS += `sdl-config --libs`
++INCPATH += $(shell $(SDL_CONFIG) --cflags)
++LIBS += $(shell $(SDL_CONFIG) --libs)
+
+ endif # OS2
+
+@@ -690,15 +692,15 @@
+
+ # the new debugger relies on GTK+ in addition to the base SDLMAME needs
+ # Non-X11 builds can not use the debugger
+-INCPATH += `pkg-config --cflags-only-I gtk+-2.0` `pkg-config --cflags-only-I gconf-2.0`
+-CCOMFLAGS += `pkg-config --cflags-only-other gtk+-2.0` `pkg-config --cflags-only-other gconf-2.0`
+-LIBS += `pkg-config --libs gtk+-2.0` `pkg-config --libs gconf-2.0`
++INCPATH += $(shell $(PKG_CONFIG) --cflags-only-I gtk+-2.0 gconf-2.0)
++CCOMFLAGS += $(shell $(PKG_CONFIG) --cflags-only-other gtk+-2.0 gconf-2.0)
++LIBS += $(shell $(PKG_CONFIG) --libs gtk+-2.0 gconf-2.0)
+ #CCOMFLAGS += -DGTK_DISABLE_DEPRECATED
+
+ # The newer debugger uses QT
+ ifdef USE_QTDEBUG
+-INCPATH += `pkg-config QtGui --cflags`
+-LIBS += `pkg-config QtGui --libs`
++INCPATH += $(shell $(PKG_CONFIG) QtGui --cflags)
++LIBS += $(shell $(PKG_CONFIG) QtGui --libs)
+ endif
+
+ # some systems still put important things in a different prefix
diff --git a/games-emulation/sdlmess/files/sdlmess-0.148_p1-no-opengl.patch b/games-emulation/sdlmess/files/sdlmess-0.148_p1-no-opengl.patch
new file mode 100644
index 000000000000..7b339ba71a59
--- /dev/null
+++ b/games-emulation/sdlmess/files/sdlmess-0.148_p1-no-opengl.patch
@@ -0,0 +1,12 @@
+diff -Naur a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h
+--- a/src/osd/sdl/osdsdl.h 2012-07-11 20:49:55.070264487 +0200
++++ b/src/osd/sdl/osdsdl.h 2012-07-11 20:51:45.976264395 +0200
+@@ -216,6 +216,8 @@
+ const char *audio_driver() const { return value(SDLOPTION_AUDIODRIVER); }
+ #if USE_OPENGL
+ const char *gl_lib() const { return value(SDLOPTION_GL_LIB); }
++#else
++ const char *gl_lib() const { return NULL; }
+ #endif
+
+ private:
diff --git a/games-emulation/sdlmess/files/sdlmess-0.149-QA.patch b/games-emulation/sdlmess/files/sdlmess-0.149-QA.patch
new file mode 100644
index 000000000000..97e4b8f41c10
--- /dev/null
+++ b/games-emulation/sdlmess/files/sdlmess-0.149-QA.patch
@@ -0,0 +1,191 @@
+commit 938cfdf1f01bcc9ac736249ee6458a774d560738
+Author: hasufell <hasufell@gentoo.org>
+Date: Tue Jun 25 23:48:02 2013 +0200
+
+ QA: respect several environment variables
+
+ such as CC,CFLAGS,PKG_CONFIG...
+
+diff --git a/makefile b/makefile
+index ad6ae2d..dd4598d 100644
+--- a/makefile
++++ b/makefile
+@@ -317,13 +317,15 @@ BUILD_EXE = $(EXE)
+ endif
+
+ # compiler, linker and utilities
+-AR = @ar
+-CC = @gcc
+-LD = @g++
++AR ?= @ar
++CC ?= @gcc
++CXX ?= @g++
++LD = $(CXX)
+ MD = -mkdir$(EXE)
+ RM = @rm -f
+ OBJDUMP = @objdump
+-PYTHON = @python
++PYTHON ?= @python
++PKG_CONFIG ?= pkg-config
+
+
+ #-------------------------------------------------
+@@ -458,7 +460,7 @@ CPPONLYFLAGS =
+
+ # CFLAGS is defined based on C or C++ targets
+ # (remember, expansion only happens when used, so doing it here is ok)
+-CFLAGS = $(CCOMFLAGS) $(CPPONLYFLAGS)
++CFLAGS += $(CCOMFLAGS) $(CPPONLYFLAGS)
+
+ # we compile C-only to C89 standard with GNU extensions
+ # we compile C++ code to C++98 standard with GNU extensions
+@@ -466,9 +468,6 @@ CONLYFLAGS += -std=gnu89
+ CPPONLYFLAGS += -x c++ -std=gnu++98
+ COBJFLAGS += -x objective-c++
+
+-# this speeds it up a bit by piping between the preprocessor/compiler/assembler
+-CCOMFLAGS += -pipe
+-
+ # add -g if we need symbols, and ensure we have frame pointers
+ ifdef SYMBOLS
+ CCOMFLAGS += -g$(SYMLEVEL) -fno-omit-frame-pointer
+@@ -484,19 +483,6 @@ ifdef PROFILE
+ CCOMFLAGS += -pg
+ endif
+
+-# add the optimization flag
+-CCOMFLAGS += -O$(OPTIMIZE)
+-
+-# add the error warning flag
+-ifndef NOWERROR
+-CCOMFLAGS += -Werror
+-endif
+-
+-# if we are optimizing, include optimization options
+-ifneq ($(OPTIMIZE),0)
+-CCOMFLAGS += -fno-strict-aliasing $(ARCHOPTS)
+-endif
+-
+ # add a basic set of warnings
+ CCOMFLAGS += \
+ -Wall \
+@@ -576,14 +562,6 @@ endif
+
+ # LDFLAGS are used generally; LDFLAGSEMULATOR are additional
+ # flags only used when linking the core emulator
+-LDFLAGS =
+-ifneq ($(TARGETOS),macosx)
+-ifneq ($(TARGETOS),os2)
+-ifneq ($(TARGETOS),solaris)
+-LDFLAGS = -Wl,--warn-common
+-endif
+-endif
+-endif
+ LDFLAGSEMULATOR =
+
+ # add profiling information for the linker
+@@ -591,13 +569,6 @@ ifdef PROFILE
+ LDFLAGS += -pg
+ endif
+
+-# strip symbols and other metadata in non-symbols and non profiling builds
+-ifndef SYMBOLS
+-ifneq ($(TARGETOS),macosx)
+-LDFLAGS += -s
+-endif
+-endif
+-
+ # output a map file (emulator only)
+ ifdef MAP
+ LDFLAGSEMULATOR += -Wl,-Map,$(FULLNAME).map
+diff --git a/src/osd/sdl/sdl.mak b/src/osd/sdl/sdl.mak
+index 84332ef..36655d3 100644
+--- a/src/osd/sdl/sdl.mak
++++ b/src/osd/sdl/sdl.mak
+@@ -24,6 +24,8 @@
+ # uncomment and edit next line to specify a distribution
+ # supported debian-stable, ubuntu-intrepid
+
++PKG_CONFIG ?= pkg-config
++
+ # DISTRO = debian-stable
+ # DISTRO = ubuntu-intrepid
+ # DISTRO = gcc44-generic
+@@ -88,9 +90,9 @@ SDL_LIBVER = sdl
+ endif
+
+ ifdef SDL_INSTALL_ROOT
+-SDL_CONFIG = $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_INSTALL_ROOT)/bin/$(SDL_LIBVER)-config
+ else
+-SDL_CONFIG = $(SDL_LIBVER)-config
++SDL_CONFIG ?= $(SDL_LIBVER)-config
+ endif
+
+ ifeq ($(SDL_LIBVER),sdl2)
+@@ -187,8 +189,8 @@ SYNC_IMPLEMENTATION = tc
+ SDL_NETWORK = taptun
+
+ ifndef NO_USE_MIDI
+-INCPATH += `pkg-config --cflags alsa`
+-LIBS += `pkg-config --libs alsa`
++INCPATH += $(shell $(PKG_CONFIG) --cflags alsa)
++LIBS += $(shell $(PKG_CONFIG) --libs alsa)
+ endif
+
+ endif
+@@ -478,10 +480,10 @@ else
+ # Remove the "/SDL" component from the include path so that we can compile
+ # files (header files are #include "SDL/something.h", so the extra "/SDL"
+ # causes a significant problem)
+-INCPATH += `sdl-config --cflags | sed 's:/SDL::'`
++INCPATH += $(shell $(SDL_CONFIG) --cflags | sed 's:/SDL::')
+ CCOMFLAGS += -DNO_SDL_GLEXT
+ # Remove libSDLmain, as its symbols conflict with SDLMain_tmpl.m
+-LIBS += `sdl-config --libs | sed 's/-lSDLmain//'` -lpthread
++LIBS += $(shell $(SDL_CONFIG) --libs | sed 's/-lSDLmain//') -lpthread
+ DEFS += -DMACOSX_USE_LIBSDL
+ endif # MACOSX_USE_LIBSDL
+
+@@ -534,8 +536,8 @@ INCPATH += -I$(SDL_INSTALL_ROOT)/include/directfb
+ endif
+ endif
+
+-INCPATH += `pkg-config --cflags fontconfig`
+-LIBS += `pkg-config --libs fontconfig`
++INCPATH += $(shell $(PKG_CONFIG) --cflags fontconfig)
++LIBS += $(shell $(PKG_CONFIG) --libs fontconfig)
+
+ ifeq ($(SDL_LIBVER),sdl2)
+ LIBS += -lSDL2_ttf
+@@ -620,8 +622,8 @@ endif # Win32
+
+ ifeq ($(BASE_TARGETOS),os2)
+
+-INCPATH += `sdl-config --cflags`
+-LIBS += `sdl-config --libs`
++INCPATH += $(shell $(SDL_CONFIG) --cflags)
++LIBS += $(shell $(SDL_CONFIG) --libs)
+
+ endif # OS2
+
+@@ -696,14 +698,14 @@ LIBS += -lX11 -lXinerama
+
+ # The newer debugger uses QT
+ ifndef NO_USE_QTDEBUG
+-INCPATH += `pkg-config QtGui --cflags`
+-LIBS += `pkg-config QtGui --libs`
++INCPATH += $(shell $(PKG_CONFIG) QtGui --cflags)
++LIBS += $(shell $(PKG_CONFIG) QtGui --libs)
+ else
+ # the old-new debugger relies on GTK+ in addition to the base SDLMAME needs
+ # Non-X11 builds can not use the debugger
+-INCPATH += `pkg-config --cflags-only-I gtk+-2.0` `pkg-config --cflags-only-I gconf-2.0`
+-CCOMFLAGS += `pkg-config --cflags-only-other gtk+-2.0` `pkg-config --cflags-only-other gconf-2.0`
+-LIBS += `pkg-config --libs gtk+-2.0` `pkg-config --libs gconf-2.0`
++INCPATH += $(shell $(PKG_CONFIG) --cflags-only-I gtk+-2.0 gconf-2.0)
++CCOMFLAGS += $(shell $(PKG_CONFIG) --cflags-only-other gtk+-2.0 gconf-2.0)
++LIBS += $(shell $(PKG_CONFIG) --libs gtk+-2.0 gconf-2.0)
+ endif
+
+ # some systems still put important things in a different prefix
diff --git a/games-emulation/sdlmess/files/sdlmess-0.149-debugger-linking.patch b/games-emulation/sdlmess/files/sdlmess-0.149-debugger-linking.patch
new file mode 100644
index 000000000000..6c7cd5d64199
--- /dev/null
+++ b/games-emulation/sdlmess/files/sdlmess-0.149-debugger-linking.patch
@@ -0,0 +1,28 @@
+commit ec92ac2b0180b101c30748e62eb8b76cdf0cb439
+Author: hasufell <hasufell@gentoo.org>
+Date: Wed Jun 26 14:33:01 2013 +0200
+
+ remove unneeded linking
+
+ if we don't build the debugger, we don't want gtk+ linking
+
+diff --git a/src/osd/sdl/sdl.mak b/src/osd/sdl/sdl.mak
+index 36655d3..2089707 100644
+--- a/src/osd/sdl/sdl.mak
++++ b/src/osd/sdl/sdl.mak
+@@ -696,6 +696,7 @@ else
+ DEFS += -DSDLMAME_X11
+ LIBS += -lX11 -lXinerama
+
++ifneq ($(NO_DEBUGGER),1)
+ # The newer debugger uses QT
+ ifndef NO_USE_QTDEBUG
+ INCPATH += $(shell $(PKG_CONFIG) QtGui --cflags)
+@@ -707,6 +708,7 @@ INCPATH += $(shell $(PKG_CONFIG) --cflags-only-I gtk+-2.0 gconf-2.0)
+ CCOMFLAGS += $(shell $(PKG_CONFIG) --cflags-only-other gtk+-2.0 gconf-2.0)
+ LIBS += $(shell $(PKG_CONFIG) --libs gtk+-2.0 gconf-2.0)
+ endif
++endif # NO_DEBUGGER
+
+ # some systems still put important things in a different prefix
+ LIBS += -L/usr/X11/lib -L/usr/X11R6/lib -L/usr/openwin/lib
diff --git a/games-emulation/sdlmess/files/sdlmess-0.149-no-opengl.patch b/games-emulation/sdlmess/files/sdlmess-0.149-no-opengl.patch
new file mode 100644
index 000000000000..cd32cd35d075
--- /dev/null
+++ b/games-emulation/sdlmess/files/sdlmess-0.149-no-opengl.patch
@@ -0,0 +1,19 @@
+commit 6ee372b3693857372a7b4855039ad1a94d3aebca
+Author: hasufell <hasufell@gentoo.org>
+Date: Tue Jun 25 23:51:12 2013 +0200
+
+ fix for disabled opengl
+
+diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h
+index ed0b66b..03d68f9 100644
+--- a/src/osd/sdl/osdsdl.h
++++ b/src/osd/sdl/osdsdl.h
+@@ -219,6 +219,8 @@ public:
+ const char *audio_driver() const { return value(SDLOPTION_AUDIODRIVER); }
+ #if USE_OPENGL
+ const char *gl_lib() const { return value(SDLOPTION_GL_LIB); }
++#else
++ const char *gl_lib() const { return NULL; }
+ #endif
+
+ private:
diff --git a/games-emulation/sdlmess/files/sdlmess-0.149-system-lua.patch b/games-emulation/sdlmess/files/sdlmess-0.149-system-lua.patch
new file mode 100644
index 000000000000..8460497f1d68
--- /dev/null
+++ b/games-emulation/sdlmess/files/sdlmess-0.149-system-lua.patch
@@ -0,0 +1,33 @@
+commit ea514c9ded266aa365976649d88fa5593ef7ebf5
+Author: hasufell <hasufell@gentoo.org>
+Date: Tue Jun 25 23:48:26 2013 +0200
+
+ add switch to use system lua
+
+diff --git a/makefile b/makefile
+index dd4598d..bdf22d2 100644
+--- a/makefile
++++ b/makefile
+@@ -228,6 +228,9 @@ BUILD_JPEGLIB = 1
+ # uncomment next line to build PortMidi as part of MAME/MESS build
+ BUILD_MIDILIB = 1
+
++# uncomment next line to build Lua-5.2 as part of MAME/MESS build
++BUILD_LUA = 1
++
+ # uncomment next line to include the symbols
+ # SYMBOLS = 1
+
+@@ -664,7 +667,12 @@ SOFTFLOAT = $(OBJ)/libsoftfloat.a
+ FORMATS_LIB = $(OBJ)/libformats.a
+
+ # add LUA library
++ifeq ($(BUILD_LUA),1)
+ LUA_LIB = $(OBJ)/liblua.a
++else
++LIBS += $(shell $(PKG_CONFIG) --libs lua)
++INCPATH += $(shell $(PKG_CONFIG) --cflags lua)
++endif
+
+ # add PortMidi MIDI library
+ ifeq ($(BUILD_MIDILIB),1)
diff --git a/games-emulation/sdlmess/files/vector.ini b/games-emulation/sdlmess/files/vector.ini
new file mode 100644
index 000000000000..d4906e34ccd7
--- /dev/null
+++ b/games-emulation/sdlmess/files/vector.ini
@@ -0,0 +1,9 @@
+#
+# Specific options file for vector games
+#
+
+#
+# VIDEO OPTIONS
+#
+video soft
+yuvmode yv12
diff --git a/games-emulation/sdlmess/metadata.xml b/games-emulation/sdlmess/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/sdlmess/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/sdlmess/sdlmess-0.148_p1.ebuild b/games-emulation/sdlmess/sdlmess-0.148_p1.ebuild
new file mode 100644
index 000000000000..f196d584e654
--- /dev/null
+++ b/games-emulation/sdlmess/sdlmess-0.148_p1.ebuild
@@ -0,0 +1,181 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+inherit eutils flag-o-matic python-any-r1 games
+
+MY_PV=${PV/.}
+MY_CONF_PN=${PN/sdl}
+MY_P=sdlmame${MY_PV}
+MY_P=${MY_P%%_p*}
+MY_CONF_VER="0.148"
+
+# patches
+SRC_URI="$(for PATCH_VER in $(seq 1 ${PV##*_p}) ; do echo "http://dev.gentoo.org/~hasufell/distfiles/${MY_P}u${PATCH_VER}_diff.zip"; done)"
+
+DESCRIPTION="Multi Emulator Super System (SDL)"
+HOMEPAGE="http://mamedev.org/"
+# Upstream doesn't allow fetching with unknown User-Agent such as wget
+SRC_URI="$SRC_URI http://dev.gentoo.org/~hasufell/distfiles/${MY_P/sdl}s.zip"
+if [[ ${PN} == "sdlmame" ]] ; then
+ SRC_URI="$SRC_URI http://www.netswarm.net/misc/sdlmame-ui.bdf.gz"
+fi
+
+LICENSE="XMAME"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="X debug opengl"
+REQUIRED_USE="debug? ( X )"
+
+RDEPEND="dev-libs/expat
+ media-libs/fontconfig
+ media-libs/flac
+ >=media-libs/libsdl-1.2.10[sound,joystick,opengl?,video]
+ media-libs/sdl-ttf
+ sys-libs/zlib
+ virtual/jpeg:0
+ media-libs/portmidi
+ X? (
+ gnome-base/gconf
+ x11-libs/gtk+:2
+ x11-libs/libX11
+ x11-libs/libXinerama
+ )"
+DEPEND="${RDEPEND}
+ ${PYTHON_DEPS}
+ app-arch/unzip
+ virtual/pkgconfig
+ X? ( x11-proto/xineramaproto )"
+
+S=${WORKDIR}
+
+# Function to disable a makefile option
+disable_feature() {
+ sed -i \
+ -e "/$1.*=/s:^:# :" \
+ "${S}"/makefile \
+ || die "sed failed"
+}
+
+# Function to enable a makefile option
+enable_feature() {
+ sed -i \
+ -e "/^#.*$1.*=/s:^#::" \
+ "${S}"/${2:-makefile} \
+ || die "sed failed"
+}
+
+pkg_setup() {
+ games_pkg_setup
+ python-any-r1_pkg_setup
+}
+
+src_unpack() {
+ default
+ unpack ./mame.zip
+ rm -f mame.zip
+}
+
+src_prepare() {
+ if [[ $PV == *_p* ]] ; then
+ edos2unix $(find $(grep +++ *diff | awk '{ print $2 }' | sort -u) 2>/dev/null) *diff
+ einfo "Patching release with source updates"
+ epatch ${MY_PV%%_p*}*.diff
+ fi
+ edos2unix src/osd/sdl/osdsdl.h
+
+ epatch \
+ "${FILESDIR}"/${P}-makefile.patch \
+ "${FILESDIR}"/${P}-no-opengl.patch
+
+ # Don't compile zlib and expat
+ einfo "Disabling embedded libraries: expat, flac, jpeg, portmidi, zlib"
+ disable_feature BUILD_EXPAT
+ disable_feature BUILD_FLAC
+ disable_feature BUILD_JPEG
+ disable_feature BUILD_MIDILIB
+ disable_feature BUILD_ZLIB
+
+ if use amd64; then
+ einfo "Enabling 64-bit support"
+ enable_feature PTR64
+ fi
+
+ if use ppc; then
+ einfo "Enabling PPC support"
+ enable_feature BIGENDIAN
+ fi
+
+ if use debug; then
+ einfo "Enabling debug support"
+ enable_feature DEBUG
+ fi
+
+ if ! use opengl ; then
+ einfo "Disabling opengl support"
+ enable_feature NO_OPENGL src/osd/sdl/sdl.mak
+ fi
+
+ if ! use X ; then
+ einfo "Disabling X support"
+ enable_feature NO_X11 src/osd/sdl/sdl.mak
+ fi
+}
+
+src_compile() {
+ emake \
+ TARGET="${PN#sdl}" \
+ NAME="${PN}" \
+ OPT_FLAGS='-DINI_PATH=\"\$$HOME/.'${PN}'\;'"${GAMES_SYSCONFDIR}/${PN}"'\"' \
+ NO_DEBUGGER=$(usex debug "0" "1") default
+}
+
+src_install() {
+ newgamesbin ${PN}$(use amd64 && echo 64)$(use debug && echo d) ${PN}
+
+ newman src/osd/sdl/man/${PN#sdl}.6 ${PN}.6
+
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins -r src/osd/sdl/keymaps
+ [[ ${PN} == "sdlmame" ]] && newins sdlmame-ui.bdf ui.bdf
+
+ insinto "${GAMES_SYSCONFDIR}/${PN}"
+ doins "${FILESDIR}"/vector.ini
+
+ sed \
+ -e "s:@GAMES_SYSCONFDIR@:${GAMES_SYSCONFDIR}:" \
+ -e "s:@GAMES_DATADIR@:${GAMES_DATADIR}:" \
+ "${FILESDIR}/${MY_CONF_PN}-${MY_CONF_VER}".ini.in > "${D}/${GAMES_SYSCONFDIR}/${PN}/${MY_CONF_PN}".ini \
+ || die "sed failed"
+
+ dodoc docs/{config,mame,newvideo}.txt
+ if [[ ${PN} == "sdlmame" ]] ; then
+ dodoc whatsnew*.txt
+ else
+ dodoc messnew*.txt
+ fi
+
+ keepdir \
+ "${GAMES_DATADIR}/${PN}"/{ctrlr,cheats,roms,samples,artwork,crosshair} \
+ "${GAMES_SYSCONFDIR}/${PN}"/{ctrlr,cheats}
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+
+ elog "optional dependencies:"
+ elog " games-emulation/sdlmametools (development tools)"
+ echo
+ elog "It's strongly recommended that you change either the system-wide"
+ elog "${MY_CONF_PN}.ini at \"${GAMES_SYSCONFDIR}/${PN}\" or use a per-user setup at \$HOME/.${PN}"
+
+ if use opengl; then
+ echo
+ elog "You built ${PN} with opengl support and should set"
+ elog "\"video\" to \"opengl\" in ${MY_CONF_PN}.ini to take advantage of that"
+ fi
+}
diff --git a/games-emulation/sdlmess/sdlmess-0.149.ebuild b/games-emulation/sdlmess/sdlmess-0.149.ebuild
new file mode 100644
index 000000000000..e7da0923bc80
--- /dev/null
+++ b/games-emulation/sdlmess/sdlmess-0.149.ebuild
@@ -0,0 +1,190 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+inherit eutils flag-o-matic python-any-r1 games
+
+MY_PV=${PV/.}
+MY_CONF_PN=${PN/sdl}
+MY_P=sdlmame${MY_PV}
+MY_P=${MY_P%%_p*}
+MY_CONF_VER="0.148"
+
+# patches
+SRC_URI="$(for PATCH_VER in $(seq 1 ${PV##*_p}) ; do echo "http://dev.gentoo.org/~hasufell/distfiles/${MY_P}u${PATCH_VER}_diff.zip"; done)"
+
+DESCRIPTION="Multi Emulator Super System (SDL)"
+HOMEPAGE="http://mamedev.org/"
+# Upstream doesn't allow fetching with unknown User-Agent such as wget
+SRC_URI="$SRC_URI http://dev.gentoo.org/~hasufell/distfiles/${MY_P/sdl}s.zip"
+if [[ ${PN} == "sdlmame" ]] ; then
+ SRC_URI="$SRC_URI http://www.netswarm.net/misc/sdlmame-ui.bdf.gz"
+fi
+
+LICENSE="XMAME"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="X debug opengl"
+REQUIRED_USE="debug? ( X )"
+
+RDEPEND=">=dev-lang/lua-5.2
+ dev-libs/expat
+ media-libs/fontconfig
+ media-libs/flac
+ >=media-libs/libsdl-1.2.10[sound,joystick,opengl?,video]
+ media-libs/sdl-ttf
+ sys-libs/zlib
+ virtual/jpeg:0
+ media-libs/portmidi
+ debug? (
+ x11-libs/gtk+:2
+ gnome-base/gconf
+ )
+ X? (
+ x11-libs/libX11
+ x11-libs/libXinerama
+ )"
+DEPEND="${RDEPEND}
+ ${PYTHON_DEPS}
+ app-arch/unzip
+ virtual/pkgconfig
+ X? ( x11-proto/xineramaproto )"
+
+S=${WORKDIR}
+
+# Function to disable a makefile option
+disable_feature() {
+ sed -i \
+ -e "/$1.*=/s:^:# :" \
+ "${S}"/${2:-makefile} \
+ || die "sed failed"
+}
+
+# Function to enable a makefile option
+enable_feature() {
+ sed -i \
+ -e "/^#.*$1.*=/s:^#::" \
+ "${S}"/${2:-makefile} \
+ || die "sed failed"
+}
+
+pkg_setup() {
+ games_pkg_setup
+ python-any-r1_pkg_setup
+}
+
+src_unpack() {
+ default
+ unpack ./mame.zip
+ rm -f mame.zip
+}
+
+src_prepare() {
+ if [[ $PV == *_p* ]] ; then
+ edos2unix $(find $(grep +++ *diff | awk '{ print $2 }' | sort -u) 2>/dev/null) *diff
+ einfo "Patching release with source updates"
+ epatch ${MY_PV%%_p*}*.diff
+ fi
+ edos2unix makefile src/osd/sdl/{osdsdl.h,sdl.mak}
+
+ epatch \
+ "${FILESDIR}"/${P}-QA.patch \
+ "${FILESDIR}"/${P}-system-lua.patch \
+ "${FILESDIR}"/${P}-no-opengl.patch \
+ "${FILESDIR}"/${P}-debugger-linking.patch
+
+ # Don't compile zlib and expat
+ einfo "Disabling embedded libraries: expat, flac, jpeg, lua, portmidi, zlib"
+ disable_feature BUILD_EXPAT
+ disable_feature BUILD_FLAC
+ disable_feature BUILD_JPEG
+ disable_feature BUILD_LUA
+ disable_feature BUILD_MIDILIB
+ disable_feature BUILD_ZLIB
+
+ if use amd64; then
+ einfo "Enabling 64-bit support"
+ enable_feature PTR64
+ fi
+
+ if use ppc; then
+ einfo "Enabling PPC support"
+ enable_feature BIGENDIAN
+ fi
+
+ if use debug; then
+ einfo "Enabling debug support"
+ enable_feature DEBUG
+ enable_feature DEBUG src/osd/sdl/sdl.mak
+ fi
+
+ enable_feature NO_USE_QTDEBUG src/osd/sdl/sdl.mak
+
+ if ! use opengl ; then
+ einfo "Disabling opengl support"
+ enable_feature NO_OPENGL src/osd/sdl/sdl.mak
+ fi
+
+ if ! use X ; then
+ einfo "Disabling X support"
+ enable_feature NO_X11 src/osd/sdl/sdl.mak
+ fi
+}
+
+src_compile() {
+ emake \
+ TARGET="${PN#sdl}" \
+ NAME="${PN}" \
+ OPT_FLAGS='-DINI_PATH=\"\$$HOME/.'${PN}'\;'"${GAMES_SYSCONFDIR}/${PN}"'\"' \
+ NO_DEBUGGER=$(usex debug "0" "1") default
+}
+
+src_install() {
+ newgamesbin ${PN}$(use amd64 && echo 64)$(use debug && echo d) ${PN}
+
+ newman src/osd/sdl/man/${PN#sdl}.6 ${PN}.6
+
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins -r src/osd/sdl/keymaps
+ [[ ${PN} == "sdlmame" ]] && newins sdlmame-ui.bdf ui.bdf
+
+ insinto "${GAMES_SYSCONFDIR}/${PN}"
+ doins "${FILESDIR}"/vector.ini
+
+ sed \
+ -e "s:@GAMES_SYSCONFDIR@:${GAMES_SYSCONFDIR}:" \
+ -e "s:@GAMES_DATADIR@:${GAMES_DATADIR}:" \
+ "${FILESDIR}/${MY_CONF_PN}-${MY_CONF_VER}".ini.in > "${D}/${GAMES_SYSCONFDIR}/${PN}/${MY_CONF_PN}".ini \
+ || die "sed failed"
+
+ dodoc docs/{config,mame,newvideo}.txt
+ if [[ ${PN} == "sdlmame" ]] ; then
+ dodoc whatsnew*.txt
+ else
+ dodoc messnew*.txt
+ fi
+
+ keepdir \
+ "${GAMES_DATADIR}/${PN}"/{ctrlr,cheats,roms,samples,artwork,crosshair} \
+ "${GAMES_SYSCONFDIR}/${PN}"/{ctrlr,cheats}
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+
+ elog "optional dependencies:"
+ elog " games-emulation/sdlmametools (development tools)"
+ echo
+ elog "It's strongly recommended that you change either the system-wide"
+ elog "${MY_CONF_PN}.ini at \"${GAMES_SYSCONFDIR}/${PN}\" or use a per-user setup at \$HOME/.${PN}"
+
+ if use opengl; then
+ echo
+ elog "You built ${PN} with opengl support and should set"
+ elog "\"video\" to \"opengl\" in ${MY_CONF_PN}.ini to take advantage of that"
+ fi
+}
diff --git a/games-emulation/snes9x/Manifest b/games-emulation/snes9x/Manifest
new file mode 100644
index 000000000000..69194e2f5785
--- /dev/null
+++ b/games-emulation/snes9x/Manifest
@@ -0,0 +1 @@
+DIST snes9x-1.53-src.tar.bz2 1838746 SHA256 9f7c5d2d0fa3fe753611cf94e8879b73b8bb3c0eab97cdbcb6ab7376efa78dc3 SHA512 3ded506d1b3b6cff4e8e3de77ad557d97981eb97ea23ffc68ce5abbbd4677aca819776f1d11b9aa47f5b1a785b19455acf6ad4dbc536d3581d62c192ebdfbd8c WHIRLPOOL 482f0b2c476753b5ffb6ff30b1e5ccb9f50bd0dbe05c7147d5e1c073cd15ce7edd99dc4ea9c14bb50d0bd3cec7edda26e1c54b1b7e0c77b0eb26f9aa09e25f52
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/metadata.xml b/games-emulation/snes9x/metadata.xml
new file mode 100644
index 000000000000..24e4956aa0b4
--- /dev/null
+++ b/games-emulation/snes9x/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <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>
+ </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..85d79a4a53dd
--- /dev/null
+++ b/games-emulation/snes9x/snes9x-1.53.ebuild
@@ -0,0 +1,120 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit autotools eutils flag-o-matic multilib gnome2-utils games
+
+DESCRIPTION="Super Nintendo Entertainment System (SNES) emulator"
+HOMEPAGE="http://code.google.com/p/snes9x-gtk/"
+SRC_URI="http://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 ppc 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/stella/Manifest b/games-emulation/stella/Manifest
new file mode 100644
index 000000000000..bb3500f2f21a
--- /dev/null
+++ b/games-emulation/stella/Manifest
@@ -0,0 +1 @@
+DIST stella-4.0-src.tar.gz 2283736 SHA256 bc3445109a090360070644f249b7b6c8f73b6044606d77d65303538785d426c9 SHA512 42df4429dfbfc268e7b7d1c538641b443703ba2af4ad4e66b9df05f2b7d62a860a1895f738d95a3a0b879052865137d31a22b8611f3b93ff9746649553c099fa WHIRLPOOL f0e1433a509724f0a5725aefbd1bb277729e985a173551051c2bf39eeb279f19053f14d6fa384f1a0104de9d0f9cd6f49ffe84347fcd59edb42189e681772a95
diff --git a/games-emulation/stella/metadata.xml b/games-emulation/stella/metadata.xml
new file mode 100644
index 000000000000..a3b7e2075da3
--- /dev/null
+++ b/games-emulation/stella/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">stella</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/stella/stella-4.0.ebuild b/games-emulation/stella/stella-4.0.ebuild
new file mode 100644
index 000000000000..819e829098d0
--- /dev/null
+++ b/games-emulation/stella/stella-4.0.ebuild
@@ -0,0 +1,69 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils gnome2-utils games
+
+DESCRIPTION="Stella Atari 2600 VCS Emulator"
+HOMEPAGE="http://stella.sourceforge.net/"
+SRC_URI="mirror://sourceforge/stella/${P}-src.tar.gz"
+
+LICENSE="GPL-2 BSD"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="joystick"
+
+DEPEND="media-libs/libsdl2[joystick?,opengl,video]
+ media-libs/libpng:0
+ sys-libs/zlib"
+RDEPEND=${DEPEND}
+
+src_prepare() {
+ sed -i \
+ -e '/INSTALL/s/-s //' \
+ -e '/STRIP/d' \
+ -e "/icons/d" \
+ -e '/INSTALL.*DOCDIR/d' \
+ -e '/INSTALL.*\/applications/d' \
+ -e '/CXXFLAGS+=/s/-fomit-frame-pointer//' \
+ Makefile || die
+}
+
+src_configure() {
+ # not an autoconf script
+ ./configure \
+ --prefix="/usr" \
+ --bindir="${GAMES_BINDIR}" \
+ --docdir="/usr/share/doc/${PF}" \
+ --datadir="${GAMES_DATADIR}" \
+ $(use_enable joystick) \
+ || die
+}
+
+src_install() {
+ local i
+ for i in 16 22 24 32 48 64 128 ; do
+ newicon -s ${i} src/common/stella-${i}x${i}.png stella.png
+ done
+
+ emake DESTDIR="${D}" install
+ domenu src/unix/stella.desktop
+ dohtml -r docs/*
+ dodoc Announce.txt Changes.txt Copyright.txt README-SDL.txt Readme.txt Todo.txt
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ games_pkg_preinst
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+}
diff --git a/games-emulation/vbam/Manifest b/games-emulation/vbam/Manifest
new file mode 100644
index 000000000000..d5dd2322a301
--- /dev/null
+++ b/games-emulation/vbam/Manifest
@@ -0,0 +1 @@
+DIST vbam-1.8.0.1228.tar.xz 866904 SHA256 ff771240b5ec89e452e6c00f45afd2c8f869570b634044cce997f4af797299e6 SHA512 22c7e14e5634c45c5a37be4387be579fceebd200f528514c0ab9059846d60f215e9bb40d73ae9a781a3018e4891d81d56dd50258d21f82b1262735aabab97155 WHIRLPOOL 19bf64ab118f80035f8c97b45c75ebd8cb956854bfc482016e22e0f7a700178115b02f7272ca5ea20cc515f1eac5e2dd22773796a03ff0f9a608ebb0d49c986a
diff --git a/games-emulation/vbam/files/vbam-1.8.0.1228-ffmpeg2.patch b/games-emulation/vbam/files/vbam-1.8.0.1228-ffmpeg2.patch
new file mode 100644
index 000000000000..f2f9085f4a7f
--- /dev/null
+++ b/games-emulation/vbam/files/vbam-1.8.0.1228-ffmpeg2.patch
@@ -0,0 +1,34 @@
+--- vbam-1.8.0.1228/src/common/ffmpeg.cpp
++++ vbam-1.8.0.1228/src/common/ffmpeg.cpp
+@@ -178,17 +178,31 @@ MediaRet MediaRecorder::setup_video_stre
+ // make sure RGB is supported (mostly not)
+ if(codec->pix_fmts) {
+ const enum PixelFormat *p;
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ int64_t mask = 0;
++#endif
+ for(p = codec->pix_fmts; *p != -1; p++) {
+ // may get complaints about 1LL; thus the cast
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ mask |= ((int64_t)1) << *p;
++#endif
+ if(*p == pixfmt)
+ break;
+ }
+ if(*p == -1) {
+ // if not supported, use a converter to the next best format
+ // this is swscale, the converter used by the output demo
++#if LIBAVCODEC_VERSION_MAJOR < 55
+ enum PixelFormat dp = (PixelFormat)avcodec_find_best_pix_fmt(mask, pixfmt, 0, NULL);
++#else
++#if LIBAVCODEC_VERSION_MICRO >= 100
++// FFmpeg
++ enum AVPixelFormat dp = avcodec_find_best_pix_fmt_of_list(codec->pix_fmts, pixfmt, 0, NULL);
++#else
++// Libav
++ enum AVPixelFormat dp = avcodec_find_best_pix_fmt2(codec->pix_fmts, pixfmt, 0, NULL);
++#endif
++#endif
+ if(dp == -1)
+ dp = codec->pix_fmts[0];
+ if(!(convpic = avcodec_alloc_frame()) ||
diff --git a/games-emulation/vbam/files/vbam-1.8.0.1228-header.patch b/games-emulation/vbam/files/vbam-1.8.0.1228-header.patch
new file mode 100644
index 000000000000..81c73892dee0
--- /dev/null
+++ b/games-emulation/vbam/files/vbam-1.8.0.1228-header.patch
@@ -0,0 +1,10 @@
+--- vbam-1.8.0.1228/src/Util.h
++++ vbam-1.8.0.1228/src/Util.h
+@@ -23,6 +23,7 @@
+ bool utilIsZipFile(const char *);
+ void utilStripDoubleExtension(const char *, char *);
+ IMAGE_TYPE utilFindType(const char *);
++IMAGE_TYPE utilFindType(const char *, char (&)[2048]);
+ uint8_t *utilLoad(const char *, bool (*)(const char*), uint8_t *, int &);
+
+ void utilPutDword(uint8_t *, uint32_t);
diff --git a/games-emulation/vbam/metadata.xml b/games-emulation/vbam/metadata.xml
new file mode 100644
index 000000000000..7fd8710261e5
--- /dev/null
+++ b/games-emulation/vbam/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version = '1.0' encoding = 'UTF-8'?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <use>
+ <flag name="link">Enable GBA linking functionality</flag>
+ </use>
+</pkgmetadata>
diff --git a/games-emulation/vbam/vbam-1.8.0.1228.ebuild b/games-emulation/vbam/vbam-1.8.0.1228.ebuild
new file mode 100644
index 000000000000..d75fc13e8259
--- /dev/null
+++ b/games-emulation/vbam/vbam-1.8.0.1228.ebuild
@@ -0,0 +1,114 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+WX_GTK_VER="3.0"
+
+inherit eutils cmake-utils wxwidgets gnome2-utils fdo-mime games
+
+ESVN_REPO_URI="https://vbam.svn.sourceforge.net/svnroot/vbam/trunk"
+
+DESCRIPTION="Game Boy, GBC, and GBA emulator forked from VisualBoyAdvance"
+HOMEPAGE="http://sourceforge.net/projects/vbam/"
+SRC_URI="http://dev.gentoo.org/~radhermit/distfiles/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="cairo ffmpeg gtk link lirc nls openal +sdl wxwidgets"
+REQUIRED_USE="|| ( sdl gtk wxwidgets )"
+
+RDEPEND=">=media-libs/libpng-1.4:0=
+ media-libs/libsdl[joystick]
+ link? ( <media-libs/libsfml-2.0 )
+ sys-libs/zlib
+ virtual/glu
+ virtual/opengl
+ ffmpeg? ( virtual/ffmpeg[-libav] )
+ gtk? ( >=dev-cpp/glibmm-2.4.0:2
+ >=dev-cpp/gtkmm-2.4.0:2.4
+ >=dev-cpp/gtkglextmm-1.2.0 )
+ lirc? ( app-misc/lirc )
+ nls? ( virtual/libintl )
+ wxwidgets? (
+ cairo? ( x11-libs/cairo )
+ openal? ( media-libs/openal )
+ x11-libs/wxGTK:${WX_GTK_VER}[X,opengl]
+ )"
+DEPEND="${RDEPEND}
+ wxwidgets? ( || ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] ) )
+ x86? ( || ( dev-lang/nasm dev-lang/yasm ) )
+ nls? ( sys-devel/gettext )
+ app-arch/xz-utils
+ virtual/pkgconfig"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-ffmpeg2.patch
+ epatch "${FILESDIR}"/${P}-header.patch
+
+ # fix issue with zlib-1.2.5.1 macros (bug #383179)
+ sed -i '1i#define OF(x) x' src/common/memgzio.c || die
+
+ sed -i "s:\(DESTINATION\) bin:\1 ${GAMES_BINDIR}:" \
+ CMakeLists.txt src/wx/CMakeLists.txt || die
+
+ # fix desktop file QA warnings
+ edos2unix src/gtk/gvbam.desktop src/wx/wxvbam.desktop || die
+}
+
+src_configure() {
+ local mycmakeargs=(
+ $(cmake-utils_use_enable cairo CAIRO)
+ $(cmake-utils_use_enable ffmpeg FFMPEG)
+ $(cmake-utils_use_enable gtk GTK)
+ $(cmake-utils_use_enable link LINK)
+ $(cmake-utils_use_enable lirc LIRC)
+ $(cmake-utils_use_enable nls NLS)
+ $(cmake-utils_use_enable openal OPENAL)
+ $(cmake-utils_use_enable sdl SDL)
+ $(cmake-utils_use_enable wxwidgets WX)
+ $(cmake-utils_use_enable x86 ASM_CORE)
+ $(cmake-utils_use_enable x86 ASM_SCALERS)
+ -DCMAKE_SKIP_RPATH=ON
+ -DDATA_INSTALL_DIR=share/games/${PN}
+ )
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ if use sdl ; then
+ dodoc doc/ReadMe.SDL.txt || die
+ doman debian/vbam.1 || die
+ fi
+
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ games_pkg_preinst
+ if use gtk || use wxwidgets ; then
+ gnome2_icon_savelist
+ fi
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ if use gtk || use wxwidgets ; then
+ gnome2_icon_cache_update
+ fi
+ use gtk && fdo-mime_desktop_database_update
+}
+
+pkg_postrm() {
+ if use gtk || use wxwidgets ; then
+ gnome2_icon_cache_update
+ fi
+ use gtk && fdo-mime_desktop_database_update
+}
diff --git a/games-emulation/vbam/vbam-9999.ebuild b/games-emulation/vbam/vbam-9999.ebuild
new file mode 100644
index 000000000000..2ac6f5d6aaf7
--- /dev/null
+++ b/games-emulation/vbam/vbam-9999.ebuild
@@ -0,0 +1,116 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+WX_GTK_VER="3.0"
+inherit cmake-utils wxwidgets subversion gnome2-utils fdo-mime games
+
+ESVN_REPO_URI="https://vbam.svn.sourceforge.net/svnroot/vbam/trunk"
+
+DESCRIPTION="Game Boy, GBC, and GBA emulator forked from VisualBoyAdvance"
+HOMEPAGE="http://sourceforge.net/projects/vbam/"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS=""
+IUSE="cairo ffmpeg gtk link lirc nls openal +sdl wxwidgets"
+REQUIRED_USE="|| ( sdl gtk wxwidgets )"
+
+RDEPEND=">=media-libs/libpng-1.4:0=
+ media-libs/libsdl[joystick]
+ link? ( <media-libs/libsfml-2.0 )
+ sys-libs/zlib
+ virtual/glu
+ virtual/opengl
+ ffmpeg? ( virtual/ffmpeg[-libav] )
+ gtk? ( >=dev-cpp/glibmm-2.4.0:2
+ >=dev-cpp/gtkmm-2.4.0:2.4
+ >=dev-cpp/gtkglextmm-1.2.0 )
+ lirc? ( app-misc/lirc )
+ nls? ( virtual/libintl )
+ wxwidgets? (
+ cairo? ( x11-libs/cairo )
+ openal? ( media-libs/openal )
+ x11-libs/wxGTK:${WX_GTK_VER}[X,opengl]
+ )"
+DEPEND="${RDEPEND}
+ wxwidgets? ( || ( media-gfx/imagemagick media-gfx/graphicsmagick[imagemagick] ) )
+ x86? ( || ( dev-lang/nasm dev-lang/yasm ) )
+ nls? ( sys-devel/gettext )
+ virtual/pkgconfig"
+
+src_unpack() {
+ subversion_src_unpack
+}
+
+src_prepare() {
+ subversion_src_prepare
+ # fix issue with zlib-1.2.5.1 macros (bug #383179)
+ sed -i '1i#define OF(x) x' src/common/memgzio.c || die
+
+ sed -i "s:\(DESTINATION\) bin:\1 ${GAMES_BINDIR}:" \
+ CMakeLists.txt src/wx/CMakeLists.txt || die
+
+ # fix desktop file QA warnings
+ edos2unix src/gtk/gvbam.desktop src/wx/wxvbam.desktop
+}
+
+src_configure() {
+ local mycmakeargs=(
+ $(cmake-utils_use_enable cairo CAIRO)
+ $(cmake-utils_use_enable ffmpeg FFMPEG)
+ $(cmake-utils_use_enable gtk GTK)
+ $(cmake-utils_use_enable link LINK)
+ $(cmake-utils_use_enable lirc LIRC)
+ $(cmake-utils_use_enable nls NLS)
+ $(cmake-utils_use_enable openal OPENAL)
+ $(cmake-utils_use_enable sdl SDL)
+ $(cmake-utils_use_enable wxwidgets WX)
+ $(cmake-utils_use_enable x86 ASM_CORE)
+ $(cmake-utils_use_enable x86 ASM_SCALERS)
+ -DCMAKE_SKIP_RPATH=ON
+ -DDATA_INSTALL_DIR=share/games/${PN}
+ )
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+
+ if use sdl ; then
+ dodoc doc/ReadMe.SDL.txt
+ doman src/debian/vbam.1
+ fi
+ use wxwidgets && doman src/debian/wxvbam.1
+ use gtk && doman src/debian/gvbam.1
+
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ subversion_pkg_preinst
+ games_pkg_preinst
+ if use gtk || use wxwidgets ; then
+ gnome2_icon_savelist
+ fi
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ if use gtk || use wxwidgets ; then
+ gnome2_icon_cache_update
+ fi
+ use gtk && fdo-mime_desktop_database_update
+}
+
+pkg_postrm() {
+ if use gtk || use wxwidgets ; then
+ gnome2_icon_cache_update
+ fi
+ use gtk && fdo-mime_desktop_database_update
+}
diff --git a/games-emulation/vgba/Manifest b/games-emulation/vgba/Manifest
new file mode 100644
index 000000000000..8e460ce45653
--- /dev/null
+++ b/games-emulation/vgba/Manifest
@@ -0,0 +1 @@
+DIST VGBA48-Linux-Ubuntu-bin.tgz 219565 SHA256 874016db6582e80b871e4018b68cc2d6f2aad2fb9399bb19768fd719535b6a88 SHA512 02362bad94ef93c8aa34bd18d8e6588aadd7d4218ce1c6307468877ac1ddadec073bca001c3d392db2554d937bee51541a76a8b2b15ea35a3c6db5822d6191bc WHIRLPOOL 559ddd3ca685114e327d9fb2a64041136b1211f18641169bab7c4e1f4dc7875b3edebd64122e807d913f0f8b490ca3a5a2ffada68e16c7cb19896479a10abbc7
diff --git a/games-emulation/vgba/metadata.xml b/games-emulation/vgba/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/vgba/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/vgba/vgba-4.8.ebuild b/games-emulation/vgba/vgba-4.8.ebuild
new file mode 100644
index 000000000000..63c34cb33215
--- /dev/null
+++ b/games-emulation/vgba/vgba-4.8.ebuild
@@ -0,0 +1,30 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit games
+
+DESCRIPTION="Gameboy Advance (GBA) emulator for Linux"
+HOMEPAGE="http://www.komkon.org/fms/VGBA/"
+SRC_URI="http://fms.komkon.org/VGBA/VGBA${PV/.}-Linux-Ubuntu-bin.tgz"
+
+LICENSE="VGBA"
+SLOT="0"
+KEYWORDS="-* x86"
+RESTRICT="strip"
+IUSE=""
+
+RDEPEND="x11-libs/libXext
+ sys-libs/zlib"
+
+QA_PREBUILT="${GAMES_PREFIX_OPT:1}/bin/vgba"
+
+S=${WORKDIR}
+
+src_install() {
+ into "${GAMES_PREFIX_OPT}"
+ dobin vgba
+ dohtml VGBA.html
+ prepgamesdirs
+}
diff --git a/games-emulation/virtualjaguar/Manifest b/games-emulation/virtualjaguar/Manifest
new file mode 100644
index 000000000000..8ca069a1a16b
--- /dev/null
+++ b/games-emulation/virtualjaguar/Manifest
@@ -0,0 +1 @@
+DIST virtualjaguar-2.1.2.tar.bz2 2917041 SHA256 04dac519857ef9eba24e26c1ab7c73d8b94599c613a922590826228966175368 SHA512 96b842762773631b5df25721d4913f771580c8e23c017a3572539c15a028a4e7743870f2ce3f30380f553781d3beed26693d7e04191efc1475c0cc6fef9f91fb WHIRLPOOL fe1f0991ed06a36f861a2fd1d35d0a3e1f189e07a79ce4950df3881848956217d58bc134a30b3f2241073e3e2342bc3779b47800f186179585ee948e3df59470
diff --git a/games-emulation/virtualjaguar/files/virtualjaguar b/games-emulation/virtualjaguar/files/virtualjaguar
new file mode 100644
index 000000000000..733bf087056d
--- /dev/null
+++ b/games-emulation/virtualjaguar/files/virtualjaguar
@@ -0,0 +1,36 @@
+#!/bin/bash
+#
+# Script for launching virtualjaguar
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+source /lib/gentoo/functions.sh || exit 1
+
+shopt -s nullglob
+
+if [[ ! -d ~/.vj/bios ]] ; then
+ mkdir -p ~/.vj/bios
+fi
+
+if [[ ! -d ~/.vj/eeproms ]] ; then
+ mkdir -p ~/.vj/eeproms
+fi
+
+if [[ ! -d ~/.vj/ROMs ]] ; then
+ mkdir -p ~/.vj/ROMs
+fi
+
+cd ~/.vj
+
+# check for bios
+if [[ -z "`cd ./bios && ls`" ]] ; then
+ # if the bios directory is empty, then ... well ...
+ echo
+ eerror " Put your BIOS file into ~/.vj/bios/"
+ eerror " or virtualjaguar will not work!"
+ exit 1
+fi
+
+# execute program (with args)
+exec GENTOODIR/vj "$@"
diff --git a/games-emulation/virtualjaguar/metadata.xml b/games-emulation/virtualjaguar/metadata.xml
new file mode 100644
index 000000000000..f4da0e5349c7
--- /dev/null
+++ b/games-emulation/virtualjaguar/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+<longdescription>
+The Virtual Atari Jaguar GCC/SDL portable Jaguar emulator which is based on
+the source code released by Cal2 of Potato Emulation.
+</longdescription>
+</pkgmetadata>
diff --git a/games-emulation/virtualjaguar/virtualjaguar-2.1.2-r1.ebuild b/games-emulation/virtualjaguar/virtualjaguar-2.1.2-r1.ebuild
new file mode 100644
index 000000000000..827178e471c7
--- /dev/null
+++ b/games-emulation/virtualjaguar/virtualjaguar-2.1.2-r1.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils versionator qt4-r2 gnome2-utils toolchain-funcs games
+
+DESCRIPTION="an Atari Jaguar emulator"
+HOMEPAGE="http://www.icculus.org/virtualjaguar/"
+SRC_URI="http://www.icculus.org/virtualjaguar/tarballs/${P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="amd64 ~ppc x86"
+IUSE=""
+
+RDEPEND="media-libs/libsdl[joystick,opengl,sound,video]
+ sys-libs/zlib
+ virtual/opengl
+ dev-qt/qtcore:4
+ dev-qt/qtgui:4
+ dev-qt/qtopengl:4[-egl]
+ dev-libs/libcdio"
+DEPEND="${RDEPEND}
+ >=sys-devel/gcc-4.4"
+
+S=${WORKDIR}/${PN}
+
+pkg_pretend() {
+ local ver=4.4
+
+ if ! version_is_at_least ${ver} $(gcc-version); then
+ die "${PN} needs at least gcc ${ver} selected to compile."
+ fi
+}
+
+src_prepare() {
+ sed -i \
+ -e '/^Categories/s/$/;/' \
+ virtualjaguar.desktop || die
+}
+
+src_configure() {
+ eqmake4 virtualjaguar.pro -o makefile-qt
+}
+
+src_compile() {
+ emake -j1 libs
+ emake
+}
+
+src_install() {
+ dogamesbin ${PN}
+ dodoc README docs/{TODO,WHATSNEW}
+ doman docs/virtualjaguar.1
+ domenu virtualjaguar.desktop
+ newicon -s 128 res/vj-icon.png ${PN}.png
+ prepgamesdirs
+}
+
+pkg_preinst() {
+ games_pkg_preinst
+ gnome2_icon_savelist
+}
+
+pkg_postinst() {
+ games_pkg_postinst
+ elog "The ${PN} ROM path is no-longer hardcoded, "
+ elog "set it from within, the ${PN} GUI."
+ elog
+ elog "The ROM extension supported by ${PN} is .j64, "
+ elog ".jag files will be interpreted as Jaguar Server executables."
+ gnome2_icon_cache_update
+}
+
+pkg_postrm() {
+ gnome2_icon_cache_update
+}
diff --git a/games-emulation/visualboyadvance/Manifest b/games-emulation/visualboyadvance/Manifest
new file mode 100644
index 000000000000..4eb10228933a
--- /dev/null
+++ b/games-emulation/visualboyadvance/Manifest
@@ -0,0 +1,2 @@
+DIST VisualBoyAdvance-src-1.7.2.tar.gz 1410762 SHA256 f4114f921a4fd4bf2ccfc68a46b9c5aa9c71cd94519fbe9ec0be992462e129b7 SHA512 58066cb438683c342c292c620cc87d9f2dff2b96849c46ff4c720146de5c7fb743588e42cd8de73e57866d4a191ccdadeab16da5e51da5a138199cc93ec4c932 WHIRLPOOL 05e8409f1d24022fc50ef44da462b6cc7866fa82b7de66c9cc68270912105e457a6ceeae7cb43476ae62a55c533a8e80c58d404d58cfb3b5e23b137f999c854b
+DIST visualboyadvance-1.7.2-deprecatedsigc++.patch.bz2 2892 SHA256 cf61ddf1e806d3c3152a7102414929d96614319a84481333a9fca7dc640dd74b SHA512 420df630d5472c1f1f84eb27741e059ca340300f82747f1c03cf8e6931f2cd6658df2e1e32ad5f3ac2bac4a9769e7aa48399463d4d080fc91b929e956b198ad0 WHIRLPOOL 7db1965baf94626fa0f2bb7627d9afefa6531782a4a43d9812edecb25b5f8b719ca740a6425ce574ff6d917ea8bc8f4e3d6ce35450d93b123f95c2588401d29a
diff --git a/games-emulation/visualboyadvance/files/1.7.2-gcc34.patch b/games-emulation/visualboyadvance/files/1.7.2-gcc34.patch
new file mode 100644
index 000000000000..5ce4802206af
--- /dev/null
+++ b/games-emulation/visualboyadvance/files/1.7.2-gcc34.patch
@@ -0,0 +1,41 @@
+diff -ur VisualBoyAdvance-1.7.2.orig/src/gtk/joypadconfig.h VisualBoyAdvance-1.7.2/src/gtk/joypadconfig.h
+--- VisualBoyAdvance-1.7.2.orig/src/gtk/joypadconfig.h 2004-05-10 16:43:21.000000000 +0200
++++ VisualBoyAdvance-1.7.2/src/gtk/joypadconfig.h 2004-08-12 22:30:20.838039064 +0200
+@@ -22,8 +22,8 @@
+
+ #include <vector>
+
+-#include <libglademm.h>
+ #include <gtkmm.h>
++#include <libglademm.h>
+
+ #ifndef GTKMM20
+ # include "sigccompat.h"
+diff -ur VisualBoyAdvance-1.7.2.orig/src/gtk/main.cpp VisualBoyAdvance-1.7.2/src/gtk/main.cpp
+--- VisualBoyAdvance-1.7.2.orig/src/gtk/main.cpp 2004-05-21 18:02:35.000000000 +0200
++++ VisualBoyAdvance-1.7.2/src/gtk/main.cpp 2004-08-12 22:39:08.633801912 +0200
+@@ -22,10 +22,10 @@
+
+ #include <list>
+
+-#include <libglademm.h>
+ #include <gtkmm/main.h>
+ #include <gtkmm/window.h>
+ #include <gtkmm/messagedialog.h>
++#include <libglademm.h>
+
+ #include "images/vba-wm-pixbufs.h"
+
+diff -ur VisualBoyAdvance-1.7.2.orig/src/gtk/window.h VisualBoyAdvance-1.7.2/src/gtk/window.h
+--- VisualBoyAdvance-1.7.2.orig/src/gtk/window.h 2004-05-21 15:25:41.000000000 +0200
++++ VisualBoyAdvance-1.7.2/src/gtk/window.h 2004-08-12 22:30:58.650290728 +0200
+@@ -23,8 +23,8 @@
+ #include <sys/types.h>
+ #include <stdarg.h>
+
+-#include <libglademm.h>
+ #include <gtkmm.h>
++#include <libglademm.h>
+
+ #ifndef GTKMM20
+ # include "sigccompat.h"
diff --git a/games-emulation/visualboyadvance/files/1.7.2-gcc41.patch b/games-emulation/visualboyadvance/files/1.7.2-gcc41.patch
new file mode 100644
index 000000000000..7f6cc077b24a
--- /dev/null
+++ b/games-emulation/visualboyadvance/files/1.7.2-gcc41.patch
@@ -0,0 +1,27 @@
+diff -ru /root/VisualBoyAdvance-1.7.2/src/prof/prof.cpp VisualBoyAdvance-1.7.2/src/prof/prof.cpp
+--- a/VisualBoyAdvance-1.7.2/src/prof/prof.cpp 2004-05-14 00:31:58.000000000 +1000
++++ b/VisualBoyAdvance-1.7.2/src/prof/prof.cpp 2006-06-03 13:49:41.000000000 +1000
+@@ -266,7 +266,7 @@
+ for (toindex=froms[fromindex]; toindex!=0; toindex=tos[toindex].link) {
+ if(profWrite8(fd, GMON_TAG_CG_ARC) ||
+ profWrite32(fd, (u32)frompc) ||
+- profWrite32(fd, (u32)tos[toindex].selfpc) ||
++ profWrite32(fd, (u32)(intptr_t)tos[toindex].selfpc) ||
+ profWrite32(fd, tos[toindex].count)) {
+ systemMessage(0, "mcount: arc");
+ fclose(fd);
+diff -ru /root/VisualBoyAdvance-1.7.2/src/sdl/debugger.cpp VisualBoyAdvance-1.7.2/src/sdl/debugger.cpp
+--- a/VisualBoyAdvance-1.7.2/src/sdl/debugger.cpp 2004-05-14 00:13:14.000000000 +1000
++++ b/VisualBoyAdvance-1.7.2/src/sdl/debugger.cpp 2006-06-03 13:49:57.000000000 +1000
+@@ -950,9 +950,9 @@
+ {
+ u32 address = 0;
+ if(mem >= (u32*)&workRAM[0] && mem <= (u32*)&workRAM[0x3ffff])
+- address = 0x2000000 + ((u32)mem - (u32)&workRAM[0]);
++ address = 0x2000000 + ((u32)(intptr_t)mem - (u32)(intptr_t)&workRAM[0]);
+ else
+- address = 0x3000000 + ((u32)mem - (u32)&internalRAM[0]);
++ address = 0x3000000 + ((u32)(intptr_t)mem - (u32)(intptr_t)&internalRAM[0]);
+
+ if(size == 2)
+ printf("Breakpoint (on write) address %08x old:%08x new:%08x\n",
diff --git a/games-emulation/visualboyadvance/files/1.7.2-homedir.patch b/games-emulation/visualboyadvance/files/1.7.2-homedir.patch
new file mode 100644
index 000000000000..e93d32cf54a5
--- /dev/null
+++ b/games-emulation/visualboyadvance/files/1.7.2-homedir.patch
@@ -0,0 +1,11 @@
+--- src/sdl/SDL.cpp.orig 2004-08-15 02:43:28.232750688 -0400
++++ src/sdl/SDL.cpp 2004-08-15 02:44:01.557684528 -0400
+@@ -887,7 +887,7 @@
+
+ if(home != NULL) {
+ fprintf(stderr, "Searching home directory: %s\n", home);
+- sprintf(path, "%s%c%s", home, FILE_SEP, name);
++ sprintf(path, "%s%c.%s%c%s", home, FILE_SEP, EXE_NAME, FILE_SEP, name);
+ f = fopen(path, "r");
+ if(f != NULL)
+ return f;
diff --git a/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-gcc47.patch b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-gcc47.patch
new file mode 100644
index 000000000000..816122f7f263
--- /dev/null
+++ b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-gcc47.patch
@@ -0,0 +1,32 @@
+--- src/sdl/debugger.cpp.old 2012-07-24 09:01:55.062533139 +0200
++++ src/sdl/debugger.cpp 2012-07-24 09:03:31.927731884 +0200
+@@ -1280,7 +1280,8 @@
+ if(n == 2) {
+ u32 addr = 0;
+ sscanf(args[1], "%x", &addr);
+- for(int i = 0; i < 16; i++) {
++ int i;
++ for(i = 0; i < 16; i++) {
+ int a = debuggerReadByte(addr);
+ int b = debuggerReadByte(addr+1);
+ int c = debuggerReadByte(addr+2);
+@@ -1316,7 +1317,8 @@
+ u32 addr = 0;
+ sscanf(args[1], "%x", &addr);
+ addr = addr & 0xfffffffe;
+- for(int i = 0; i < 16; i++) {
++ int i;
++ for(i = 0; i < 16; i++) {
+ int a = debuggerReadByte(addr);
+ int b = debuggerReadByte(addr+1);
+ int c = debuggerReadByte(addr+2);
+@@ -1352,7 +1354,8 @@
+ u32 addr = 0;
+ sscanf(args[1], "%x", &addr);
+ addr = addr & 0xfffffffc;
+- for(int i = 0; i < 16; i++) {
++ int i;
++ for(i = 0; i < 16; i++) {
+ int a = debuggerReadByte(addr);
+ int b = debuggerReadByte(addr+1);
+ int c = debuggerReadByte(addr+2);
diff --git a/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-glibc2.10.patch b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-glibc2.10.patch
new file mode 100644
index 000000000000..5211b362350e
--- /dev/null
+++ b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-glibc2.10.patch
@@ -0,0 +1,76 @@
+--- src/GBA.cpp
++++ src/GBA.cpp
+@@ -1130,7 +1130,7 @@
+ bool CPUIsZipFile(const char * file)
+ {
+ if(strlen(file) > 4) {
+- char * p = strrchr(file,'.');
++ const char * p = strrchr(file,'.');
+
+ if(p != NULL) {
+ if(_stricmp(p, ".zip") == 0)
+@@ -1145,7 +1145,7 @@
+ {
+ cpuIsMultiBoot = false;
+ if(strlen(file) > 4) {
+- char * p = strrchr(file,'.');
++ const char * p = strrchr(file,'.');
+
+ if(p != NULL) {
+ if(_stricmp(p, ".gba") == 0)
+@@ -1169,7 +1169,7 @@
+ bool CPUIsGBABios(const char * file)
+ {
+ if(strlen(file) > 4) {
+- char * p = strrchr(file,'.');
++ const char * p = strrchr(file,'.');
+
+ if(p != NULL) {
+ if(_stricmp(p, ".gba") == 0)
+@@ -1189,7 +1189,7 @@
+ bool CPUIsELF(const char *file)
+ {
+ if(strlen(file) > 4) {
+- char * p = strrchr(file,'.');
++ const char * p = strrchr(file,'.');
+
+ if(p != NULL) {
+ if(_stricmp(p, ".elf") == 0)
+--- src/Util.cpp
++++ src/Util.cpp
+@@ -478,7 +478,7 @@
+ {
+ cpuIsMultiBoot = false;
+ if(strlen(file) > 4) {
+- char * p = strrchr(file,'.');
++ const char * p = strrchr(file,'.');
+
+ if(p != NULL) {
+ if(_stricmp(p, ".gba") == 0)
+@@ -502,7 +502,7 @@
+ bool utilIsGBImage(const char * file)
+ {
+ if(strlen(file) > 4) {
+- char * p = strrchr(file,'.');
++ const char * p = strrchr(file,'.');
+
+ if(p != NULL) {
+ if(_stricmp(p, ".gb") == 0)
+@@ -522,7 +522,7 @@
+ bool utilIsZipFile(const char *file)
+ {
+ if(strlen(file) > 4) {
+- char * p = strrchr(file,'.');
++ const char * p = strrchr(file,'.');
+
+ if(p != NULL) {
+ if(_stricmp(p, ".zip") == 0)
+@@ -552,7 +552,7 @@
+ bool utilIsGzipFile(const char *file)
+ {
+ if(strlen(file) > 3) {
+- char * p = strrchr(file,'.');
++ const char * p = strrchr(file,'.');
+
+ if(p != NULL) {
+ if(_stricmp(p, ".gz") == 0)
diff --git a/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-libpng15.patch b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-libpng15.patch
new file mode 100644
index 000000000000..bee96dc7e5df
--- /dev/null
+++ b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-libpng15.patch
@@ -0,0 +1,11 @@
+--- src/Util.cpp
++++ src/Util.cpp
+@@ -79,7 +79,7 @@
+ return false;
+ }
+
+- if(setjmp(png_ptr->jmpbuf)) {
++ if(setjmp(png_jmpbuf(png_ptr))) {
+ png_destroy_write_struct(&png_ptr,NULL);
+ fclose(fp);
+ return false;
diff --git a/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-ovflfix.patch b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-ovflfix.patch
new file mode 100644
index 000000000000..e3a7d7bb5db5
--- /dev/null
+++ b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-ovflfix.patch
@@ -0,0 +1,11 @@
+--- src/sdl/debugger.cpp.old 2010-11-02 15:37:53.000000000 +0100
++++ src/sdl/debugger.cpp 2010-11-02 15:38:13.000000000 +0100
+@@ -1389,7 +1389,7 @@
+ {
+ char buffer[10];
+ printf("Are you sure you want to quit (y/n)? ");
+- fgets(buffer, 1024, stdin);
++ fgets(buffer, sizeof(buffer), stdin);
+
+ if(buffer[0] == 'y' || buffer[0] == 'Y') {
+ debugger = false;
diff --git a/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-sys-types.patch b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-sys-types.patch
new file mode 100644
index 000000000000..8f78d6e4fd78
--- /dev/null
+++ b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-sys-types.patch
@@ -0,0 +1,12 @@
+diff --git a/src/expr.cpp b/src/expr.cpp
+index 25c68f6..47237cb 100644
+--- a/src/expr.cpp
++++ b/src/expr.cpp
+@@ -19,6 +19,7 @@ namespace std {
+ #include <memory.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <sys/types.h>
+ }
+
+ using namespace std;
diff --git a/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-uninit.patch b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-uninit.patch
new file mode 100644
index 000000000000..5fabdf125874
--- /dev/null
+++ b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-uninit.patch
@@ -0,0 +1,13 @@
+diff -ru /root/VisualBoyAdvance-1.7.2/src/gtk/window.cpp VisualBoyAdvance-1.7.2/src/gtk/window.cpp
+--- a/VisualBoyAdvance-1.7.2/src/gtk/window.cpp 2004-05-14 00:31:58.000000000 +1000
++++ b/VisualBoyAdvance-1.7.2/src/gtk/window.cpp 2007-03-17 14:57:22.000000000 -0500
+@@ -91,7 +91,8 @@
+ m_iFilterIBMin (FirstFilterIB),
+ m_iFilterIBMax (LastFilterIB),
+ m_iJoypadMin (1),
+- m_iJoypadMax (4)
++ m_iJoypadMax (4),
++ m_poKeymap (NULL)
+ {
+ m_poXml = _poXml;
+ m_poFileOpenDialog = NULL;
diff --git a/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-zlib-1.2.6.patch b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-zlib-1.2.6.patch
new file mode 100644
index 000000000000..a24ddcba9a56
--- /dev/null
+++ b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-zlib-1.2.6.patch
@@ -0,0 +1,12 @@
+diff -ur VisualBoyAdvance-1.7.2.orig/src/Util.cpp VisualBoyAdvance-1.7.2/src/Util.cpp
+--- VisualBoyAdvance-1.7.2.orig/src/Util.cpp 2004-05-20 10:42:37.000000000 -0700
++++ VisualBoyAdvance-1.7.2/src/Util.cpp 2012-02-18 00:21:40.655194387 -0800
+@@ -984,7 +984,7 @@
+
+ gzFile utilGzOpen(const char *file, const char *mode)
+ {
+- utilGzWriteFunc = (int (*)(void *,void * const, unsigned int))gzwrite;
++ utilGzWriteFunc = (int (*)(gzFile, void * const, unsigned int))gzwrite;
+ utilGzReadFunc = gzread;
+ utilGzCloseFunc = gzclose;
+
diff --git a/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-zlib.patch b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-zlib.patch
new file mode 100644
index 000000000000..d397676c0779
--- /dev/null
+++ b/games-emulation/visualboyadvance/files/visualboyadvance-1.7.2-zlib.patch
@@ -0,0 +1,145 @@
+--- src/gb/GB.cpp.old 2011-12-12 11:28:33.412463305 +0100
++++ src/gb/GB.cpp 2011-12-12 11:29:09.592463481 +0100
+@@ -29,7 +29,6 @@
+ #include "gbMemory.h"
+ #include "gbSGB.h"
+ #include "gbSound.h"
+-#include "../unzip.h"
+ #include "../Util.h"
+
+ #ifdef __GNUC__
+--- src/sdl/TestEmu.cpp.old 2011-12-12 11:49:42.802469335 +0100
++++ src/sdl/TestEmu.cpp 2011-12-12 11:49:57.682469414 +0100
+@@ -28,7 +28,7 @@
+ #include "GBA.h"
+ #include "debugger.h"
+ #include "Sound.h"
+-#include "unzip.h"
++#include <minizip/unzip.h>
+ #include "Util.h"
+ #include "gb/GB.h"
+ #include "gb/gbGlobals.h"
+--- ./src/sdl/SDL.cpp.old 2011-12-12 11:29:45.072463639 +0100
++++ ./src/sdl/SDL.cpp 2011-12-12 11:29:56.372463698 +0100
+@@ -34,7 +34,7 @@
+ #include "RTC.h"
+ #include "Sound.h"
+ #include "Text.h"
+-#include "unzip.h"
++#include <minizip/unzip.h>
+ #include "Util.h"
+ #include "gb/GB.h"
+ #include "gb/gbGlobals.h"
+--- ./src/System.h.old 2011-12-12 11:27:56.382463126 +0100
++++ ./src/System.h 2011-12-12 11:28:13.202463209 +0100
+@@ -20,7 +20,7 @@
+ #ifndef VBA_SYSTEM_H
+ #define VBA_SYSTEM_H
+
+-#include "unzip.h"
++#include <minizip/unzip.h>
+
+ #ifndef NULL
+ #define NULL 0
+--- src/memgzio.c.old 2011-12-12 11:37:12.912465774 +0100
++++ src/memgzio.c 2011-12-12 11:42:25.682467264 +0100
+@@ -66,13 +66,13 @@
+ } mem_stream;
+
+
+-local gzFile gz_open OF((char *memory, const int available, const char *mode));
+-local int do_flush OF((gzFile file, int flush));
+-local int get_byte OF((mem_stream *s));
+-local void check_header OF((mem_stream *s));
+-local int destroy OF((mem_stream *s));
+-local void putLong OF((MEMFILE *file, uLong x));
+-local uLong getLong OF((mem_stream *s));
++local gzFile gz_open _Z_OF((char *memory, const int available, const char *mode));
++local int do_flush _Z_OF((gzFile file, int flush));
++local int get_byte _Z_OF((mem_stream *s));
++local void check_header _Z_OF((mem_stream *s));
++local int destroy _Z_OF((mem_stream *s));
++local void putLong _Z_OF((MEMFILE *file, uLong x));
++local uLong getLong _Z_OF((mem_stream *s));
+
+ local MEMFILE *memOpen(char *memory, int available, char mode)
+ {
+--- src/GBA.cpp.old 2011-12-12 11:30:35.262463885 +0100
++++ src/GBA.cpp 2011-12-12 11:30:47.402463941 +0100
+@@ -31,7 +31,7 @@
+ #include "Sound.h"
+ #include "Sram.h"
+ #include "bios.h"
+-#include "unzip.h"
++#include <minizip/unzip.h>
+ #include "Cheats.h"
+ #include "NLS.h"
+ #include "elf.h"
+--- win32/include/zlib/zutil.h.old 2011-12-12 11:35:21.282465241 +0100
++++ win32/include/zlib/zutil.h 2011-12-12 12:00:51.712472515 +0100
+@@ -207,10 +207,10 @@
+ #endif
+
+
+-typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf,
++typedef uLong (ZEXPORT *check_func) _Z_OF((uLong check, const Bytef *buf,
+ uInt len));
+-voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
+-void zcfree OF((voidpf opaque, voidpf ptr));
++voidpf zcalloc _Z_OF((voidpf opaque, unsigned items, unsigned size));
++void zcfree _Z_OF((voidpf opaque, voidpf ptr));
+
+ #define ZALLOC(strm, items, size) \
+ (*((strm)->zalloc))((strm)->opaque, (items), (size))
+--- src/sdl/Makefile.am.old 2011-12-12 12:09:53.442475093 +0100
++++ src/sdl/Makefile.am 2011-12-12 12:10:31.582475274 +0100
+@@ -71,11 +71,9 @@
+ ../remote.cpp \
+ ../scanline.cpp \
+ ../simple2x.cpp \
+- ../thumb.h \
+- ../unzip.cpp \
+- ../unzip.h
++ ../thumb.h
+
+-VisualBoyAdvance_LDADD = @VBA_LIBS@ @SDL_LIBS@
++VisualBoyAdvance_LDADD = @VBA_LIBS@ @SDL_LIBS@ -lminizip
+
+ VisualBoyAdvance_DEPENDENCIES = @VBA_LIBS@
+
+@@ -143,11 +141,9 @@
+ ../remote.cpp \
+ ../scanline.cpp \
+ ../simple2x.cpp \
+- ../thumb.h \
+- ../unzip.cpp \
+- ../unzip.h
++ ../thumb.h
+
+-TestEmu_LDADD = @VBA_LIBS@ @SDL_LIBS@
++TestEmu_LDADD = @VBA_LIBS@ @SDL_LIBS@ -lminizip
+
+ TestEmu_DEPENDENCIES = @VBA_LIBS@
+
+--- src/gtk/Makefile.am.old 2011-12-12 12:13:42.552476181 +0100
++++ src/gtk/Makefile.am 2011-12-12 12:14:20.272476359 +0100
+@@ -26,7 +26,7 @@
+ window.cpp \
+ window.h
+
+-gvba_LDADD = libgba.a @VBA_LIBS@ @GTKMM_LIBS@ @LIBINTL@ @SDL_LIBS@
++gvba_LDADD = libgba.a @VBA_LIBS@ @GTKMM_LIBS@ @LIBINTL@ @SDL_LIBS@ -lminizip
+
+ gvba_DEPENDENCIES = libgba.a @VBA_LIBS@
+
+@@ -99,9 +99,7 @@
+ ../remote.cpp \
+ ../scanline.cpp \
+ ../simple2x.cpp \
+- ../thumb.h \
+- ../unzip.cpp \
+- ../unzip.h
++ ../thumb.h
+
+ libgba_a_CPPFLAGS = -DSDL
+
diff --git a/games-emulation/visualboyadvance/metadata.xml b/games-emulation/visualboyadvance/metadata.xml
new file mode 100644
index 000000000000..19b8e6d515c1
--- /dev/null
+++ b/games-emulation/visualboyadvance/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <upstream>
+ <remote-id type="sourceforge">vba</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/visualboyadvance/visualboyadvance-1.7.2-r3.ebuild b/games-emulation/visualboyadvance/visualboyadvance-1.7.2-r3.ebuild
new file mode 100644
index 000000000000..736a1e74c6b5
--- /dev/null
+++ b/games-emulation/visualboyadvance/visualboyadvance-1.7.2-r3.ebuild
@@ -0,0 +1,82 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils flag-o-matic autotools games
+
+DESCRIPTION="gameboy, gameboy color, and gameboy advance emulator"
+HOMEPAGE="http://vba.ngemu.com/"
+SRC_URI="mirror://sourceforge/vba/VisualBoyAdvance-src-${PV}.tar.gz
+ mirror://gentoo/${P}-deprecatedsigc++.patch.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86 ~x86-fbsd"
+IUSE="gtk cpu_flags_x86_mmx nls"
+
+RDEPEND="media-libs/libpng:0
+ media-libs/libsdl[sound,video]
+ sys-libs/zlib[minizip]
+ gtk? (
+ >=x11-libs/gtk+-2.4:2
+ >=dev-cpp/gtkmm-2.4:2.4
+ >=dev-cpp/libglademm-2.4:2.4
+ )
+ nls? ( virtual/libintl )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ cpu_flags_x86_mmx? ( dev-lang/nasm )
+ nls? ( sys-devel/gettext )"
+
+S=${WORKDIR}/VisualBoyAdvance-${PV}
+
+src_prepare() {
+ cat >> src/i386/2xSaImmx.asm <<-EOF
+ %ifidn __OUTPUT_FORMAT__,elf
+ section .note.GNU-stack noalloc noexec nowrite progbits
+ %endif
+ EOF
+
+ epatch \
+ "${FILESDIR}"/${PV}-homedir.patch \
+ "${FILESDIR}"/${PV}-gcc34.patch \
+ "${FILESDIR}"/${PV}-gcc41.patch \
+ "${FILESDIR}"/${P}-gcc47.patch \
+ "${WORKDIR}"/${P}-deprecatedsigc++.patch \
+ "${FILESDIR}"/${P}-uninit.patch \
+ "${FILESDIR}"/${P}-glibc2.10.patch \
+ "${FILESDIR}"/${P}-ovflfix.patch \
+ "${FILESDIR}"/${P}-libpng15.patch \
+ "${FILESDIR}"/${P}-zlib.patch \
+ "${FILESDIR}"/${P}-zlib-1.2.6.patch \
+ "${FILESDIR}"/${P}-sys-types.patch
+
+ mv configure.in configure.ac || die
+ eautoreconf
+
+ sed -i \
+ -e 's:$(localedir):/usr/share/locale:' \
+ -e 's:$(datadir)/locale:/usr/share/locale:' \
+ $(find . -name 'Makefile.in*') || die
+}
+
+src_configure() {
+ # -O3 causes GCC to behave badly and hog memory, bug #64670.
+ replace-flags -O3 -O2
+
+ # Removed --enable-c-core as it *should* determine this based on arch
+ egamesconf \
+ $(use_with cpu_flags_x86_mmx mmx) \
+ $(use_enable gtk gtk 2.4) \
+ $(use_enable nls)
+}
+
+src_install() {
+ default
+ if use gtk ; then
+ newicon src/gtk/images/vba-64.png ${PN}.png
+ make_desktop_entry gvba VisualBoyAdvance
+ fi
+ prepgamesdirs
+}
diff --git a/games-emulation/xe/Manifest b/games-emulation/xe/Manifest
new file mode 100644
index 000000000000..c9dab135cb24
--- /dev/null
+++ b/games-emulation/xe/Manifest
@@ -0,0 +1,2 @@
+DIST xe-x86-32-bin.2.16.2.tar.bz2 1610395 SHA256 fff82a9e56d8f03d14395eeebb9306de7b3a03df6af12b0acc11b0206d1212f0 SHA512 b73f79854f860f7e7060c8b09e0a038b787762d3bd440b5b2825b5a702e4f32c788b883012728813e0a9dcee779f8b98b807c8af3f655fea21bd0ed1383e361c WHIRLPOOL 0c6c18c53105859ec44767cbc21fdf82e14ea4532fe26ecf9dec2acc6917af2baa80df7d8050ce9206ad189a2d8ac5cad1b17c7daa86d69ebcc04b4e83d1cabf
+DIST xe-x86-64-bin.2.16.2.tar.bz2 2141614 SHA256 73a035c20b56fe197529aeb034ce3b81c680e184d0acca7d48df7fedbbafb103 SHA512 cf8a4be4f169660138018631b4a2b6c1a42850c7fc08bd9bd184ab054bffc6fe00197baaf9628cce87608628bb33db0dabac97debd7c53466b086cf0805cc5d8 WHIRLPOOL 49a8f159e34bb3a2c4e44130f6b2c68e3dc681f8795f776c9323c0e2d21180fa490dc810abab327f5573c0cfd71307c1c4d16abaf0775795949c5af244b8831c
diff --git a/games-emulation/xe/files/xe-2.16.2 b/games-emulation/xe/files/xe-2.16.2
new file mode 100644
index 000000000000..211d508d883e
--- /dev/null
+++ b/games-emulation/xe/files/xe-2.16.2
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+if [[ ! -d ~/.xe/modules ]] ; then
+ mkdir -p ~/.xe/modules
+fi
+for f in GENTOODIR/modules/*
+do
+ ln -s $f ~/.xe/modules/ 2> /dev/null
+done
+exec xe.bin "${@}"
diff --git a/games-emulation/xe/files/xe-2.16.2-gentoo.patch b/games-emulation/xe/files/xe-2.16.2-gentoo.patch
new file mode 100644
index 000000000000..caea9c8c6c2e
--- /dev/null
+++ b/games-emulation/xe/files/xe-2.16.2-gentoo.patch
@@ -0,0 +1,16 @@
+--- Makefile.old 2012-12-20 21:20:49.560756950 +0100
++++ Makefile 2012-12-20 21:22:16.644707544 +0100
+@@ -1,11 +1,9 @@
+ BIN = xe
+-CC = gcc
+-CFLAGS = -Wl,-export-dynamic -L. -L/usr/X11R6/lib -lxe -lasound -ldl -lz \
++LDLIBS = -L. -L/usr/X11R6/lib -lxe -lasound -ldl -lz \
+ -lX11 -lXext -lXv -lXinerama -lXxf86vm `pkg-config gtk+-2.0 --libs`
+
+ $(BIN): libxe.a
+- @ $(CC) -o $(BIN) $(CFLAGS)
+- @ strip $(BIN)
++ $(CC) -o $(BIN) $(LDFLAGS) -Wl,-export-dynamic $(LDLIBS)
+
+ install:
+ @ sh install.sh
diff --git a/games-emulation/xe/metadata.xml b/games-emulation/xe/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/xe/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/xe/xe-2.16.2.ebuild b/games-emulation/xe/xe-2.16.2.ebuild
new file mode 100644
index 000000000000..92fd2a0e154b
--- /dev/null
+++ b/games-emulation/xe/xe-2.16.2.ebuild
@@ -0,0 +1,54 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=4
+inherit games
+
+DESCRIPTION="a multi system emulator for many console and handheld video game systems"
+HOMEPAGE="http://www.xe-emulator.com/"
+SRC_URI="amd64? ( http://www.xe-emulator.com/files/${PN}-x86-64-bin.${PV}.tar.bz2 )
+ x86? ( http://www.xe-emulator.com/files/${PN}-x86-32-bin.${PV}.tar.bz2 )"
+
+LICENSE="all-rights-reserved"
+SLOT="0"
+KEYWORDS="-* amd64 x86"
+IUSE=""
+RESTRICT="mirror bindist strip"
+
+RDEPEND="x11-libs/libXv
+ x11-libs/libXinerama
+ x11-libs/libXxf86vm
+ sys-libs/zlib
+ media-libs/alsa-lib
+ x11-libs/gtk+:2"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+dir=${games_get_libdir}/${PN}
+
+QA_PREBUILT="${dir:1}/modules/*
+ ${GAMES_BINDIR:1}/xe.bin"
+
+src_unpack() {
+ unpack ${A}
+ mv -v * ${P} || die
+}
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-gentoo.patch
+}
+
+src_install() {
+ newgamesbin xe xe.bin
+ newgamesbin "${FILESDIR}"/xe-${PV} xe
+ sed -i \
+ -e "s:GENTOODIR:$(games_get_libdir)/${PN}:" "${D}/${GAMES_BINDIR}/xe" \
+ || die "sed failed"
+ insinto "$(games_get_libdir)"/${PN}
+ doins -r modules/ rc/
+ keepdir "$(games_get_libdir)"/${PN}/bios
+ dodoc README.txt
+ dohtml manual.html
+ prepgamesdirs
+}
diff --git a/games-emulation/yabause/Manifest b/games-emulation/yabause/Manifest
new file mode 100644
index 000000000000..a2f3257ecdc8
--- /dev/null
+++ b/games-emulation/yabause/Manifest
@@ -0,0 +1 @@
+DIST yabause-0.9.14.tar.gz 1662762 SHA256 75e6320873ef6f8ec956568bff5a8f3b67500bdf52a7e0aa88e0a554b2dd775a SHA512 8b14d9146cf12d104fcf43369cd949f1f47e7891a54241914f6141facf871bcc158f4e80a8c5b61fdeefe6f1b8d425ff301ba653df134a030c323c9e3ccf3a58 WHIRLPOOL 637b5be9e889bb59e0ff3e78163b19256b8b6a7cd3b7c03e5922989c0fbdf7721293eb1673d3ead0334c7132ae095ebd067e95373b33a036b7c65c8108823260
diff --git a/games-emulation/yabause/files/yabause-0.9.14-RWX.patch b/games-emulation/yabause/files/yabause-0.9.14-RWX.patch
new file mode 100644
index 000000000000..8022be90f852
--- /dev/null
+++ b/games-emulation/yabause/files/yabause-0.9.14-RWX.patch
@@ -0,0 +1,24 @@
+--- yabause-0.9.13.orig/src/sh2_dynarec/linkage_x64.s
++++ yabause-0.9.13/src/sh2_dynarec/linkage_x64.s
+@@ -747,3 +747,11 @@
+ ret
+ /* Set breakpoint here for debugging */
+ .size breakpoint, .-breakpoint
++
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
++
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
+--- yabause-0.9.13.orig/src/sh2_dynarec/linkage_x86.s
++++ yabause-0.9.13/src/sh2_dynarec/linkage_x86.s
+@@ -743,3 +743,7 @@
+ ret
+ /* Set breakpoint here for debugging */
+ .size breakpoint, .-breakpoint
++
++#if defined(__linux__) && defined(__ELF__)
++.section .note.GNU-stack,"",%progbits
++#endif
diff --git a/games-emulation/yabause/files/yabause-0.9.14-cmake.patch b/games-emulation/yabause/files/yabause-0.9.14-cmake.patch
new file mode 100644
index 000000000000..a126c010bb7a
--- /dev/null
+++ b/games-emulation/yabause/files/yabause-0.9.14-cmake.patch
@@ -0,0 +1,51 @@
+--- yabause-0.9.13.orig/l10n/CMakeLists.txt
++++ yabause-0.9.13/l10n/CMakeLists.txt
+@@ -2,9 +2,12 @@
+
+ set(LANGS de es fr it lt nl pt pt_BR sv)
+
++# paths
++set(TRANSDIR "share/yabause/yts" CACHE STRING "dir to translation files")
++
+ if (UNIX AND NOT APPLE)
+ foreach(LANG ${LANGS})
+- install(FILES "yabause_${LANG}.yts" DESTINATION "share/yabause/yts" RENAME "${LANG}.yts")
++ install(FILES "yabause_${LANG}.yts" DESTINATION ${TRANSDIR} RENAME "${LANG}.yts")
+ endforeach()
+ elseif (WIN32)
+ foreach(LANG ${LANGS})
+--- yabause-0.9.13.orig/src/gtk/CMakeLists.txt
++++ yabause-0.9.13/src/gtk/CMakeLists.txt
+@@ -59,7 +59,10 @@
+ yab_port_success(yabause-gtk)
+ configure_file(yabause.desktop.in ${YAB_PORT_NAME}.desktop)
+
+-install(TARGETS yabause-gtk DESTINATION "bin")
++# paths
++set(BINDIR "bin" CACHE STRING "dir to binary")
++
++install(TARGETS yabause-gtk DESTINATION ${BINDIR})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${YAB_PORT_NAME}.desktop DESTINATION "share/applications")
+ install(FILES "doc/yabause.1" DESTINATION "${YAB_MAN_DIR}/man1" RENAME "${YAB_PORT_NAME}.1")
+ install(FILES "yabause.png" DESTINATION "share/pixmaps")
+--- yabause-0.9.13.orig/src/qt/CMakeLists.txt
++++ yabause-0.9.13/src/qt/CMakeLists.txt
+@@ -237,6 +237,9 @@
+ yab_port_success(yabause-qt)
+ configure_file(yabause.desktop.in ${YAB_PORT_NAME}.desktop)
+
++# paths
++set(BINDIR "bin" CACHE STRING "dir to binary")
++
+ if (WIN32)
+ install(TARGETS yabause-qt DESTINATION ".")
+ if (GLUT_FOUND)
+@@ -277,7 +280,7 @@
+ endif()
+ endif ()
+ else ()
+- install(TARGETS yabause-qt DESTINATION "bin")
++ install(TARGETS yabause-qt DESTINATION ${BINDIR})
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${YAB_PORT_NAME}.desktop DESTINATION "share/applications")
+ install(FILES "doc/yabause.1" DESTINATION "${YAB_MAN_DIR}/man1" RENAME "${YAB_PORT_NAME}.1")
+ install(FILES "resources/icons/yabause.png" DESTINATION "share/pixmaps")
diff --git a/games-emulation/yabause/metadata.xml b/games-emulation/yabause/metadata.xml
new file mode 100644
index 000000000000..5a88bd848e32
--- /dev/null
+++ b/games-emulation/yabause/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <use>
+ <flag name="pic">disable optimized assembly code that is not PIC friendly</flag>
+ </use>
+ <upstream>
+ <remote-id type="sourceforge">yabause</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/games-emulation/yabause/yabause-0.9.14.ebuild b/games-emulation/yabause/yabause-0.9.14.ebuild
new file mode 100644
index 000000000000..93e58c9afd34
--- /dev/null
+++ b/games-emulation/yabause/yabause-0.9.14.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit eutils cmake-utils games
+
+DESCRIPTION="A Sega Saturn emulator"
+HOMEPAGE="http://yabause.org/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="openal opengl pic qt5 sdl"
+
+# x11-libs/libXrandr is an automagic dep
+# qt5 over qt4 and libsdl2 over libsdl is
+# also done automatically. Send patches
+# upstream to make the choices explicit.
+RDEPEND="
+ x11-libs/libXrandr
+ openal? ( media-libs/openal )
+ opengl? (
+ media-libs/freeglut
+ virtual/glu
+ virtual/opengl
+ )
+ qt5? (
+ dev-qt/qtcore:5
+ dev-qt/qtwidgets:5[opengl?]
+ opengl? ( dev-qt/qtopengl:5 )
+ )
+ !qt5? (
+ dev-libs/glib:2
+ x11-libs/gtk+:2
+ x11-libs/gtkglext
+ )
+ sdl? ( media-libs/libsdl2[opengl?,video] )"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${P}-RWX.patch \
+ "${FILESDIR}"/${P}-cmake.patch
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DBINDIR="${GAMES_BINDIR}"
+ -DTRANSDIR="${GAMES_DATADIR}"/${PN}/yts
+ -DYAB_OPTIMIZATION=""
+ $(cmake-utils_use sdl YAB_WANT_SDL)
+ $(cmake-utils_use openal YAB_WANT_OPENAL)
+ $(cmake-utils_use opengl YAB_WANT_OPENGL)
+ $(cmake-utils_use !pic SH2_DYNAREC)
+ -DYAB_PORTS=$(usex qt5 "qt" "gtk")
+ )
+ cmake-utils_src_configure
+}
+
+src_compile() {
+ cmake-utils_src_compile
+}
+
+src_install() {
+ cmake-utils_src_install
+ dodoc AUTHORS ChangeLog GOALS README README.LIN
+ prepgamesdirs
+}
diff --git a/games-emulation/zinc/Manifest b/games-emulation/zinc/Manifest
new file mode 100644
index 000000000000..88acfc59be05
--- /dev/null
+++ b/games-emulation/zinc/Manifest
@@ -0,0 +1 @@
+DIST zinc11-lnx.tar.bz2 305824 SHA256 70a4b15130fe84cdcd166cd0964d11741513bef9236fde782bbe8edeff7e4776 SHA512 8511ebb867347adfc00448a74548b4a22a2d854a14c663a626d33738e89d2cabd3248837a26d5ed099ef4dc40a0f451df639663774926e797ddc846a7270af4b WHIRLPOOL 596f594365ea96a481be4db121f5dcce99107ee2cbffc3f338c7ed84e916c9a1b4fe665aad7972c17b3fc075f6419a4255ea66db61a54c5dc3bdb2fa82e74d6c
diff --git a/games-emulation/zinc/metadata.xml b/games-emulation/zinc/metadata.xml
new file mode 100644
index 000000000000..d3c2cc926f0b
--- /dev/null
+++ b/games-emulation/zinc/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>games</herd>
+</pkgmetadata>
diff --git a/games-emulation/zinc/zinc-1.1.ebuild b/games-emulation/zinc/zinc-1.1.ebuild
new file mode 100644
index 000000000000..725fe6751a32
--- /dev/null
+++ b/games-emulation/zinc/zinc-1.1.ebuild
@@ -0,0 +1,31 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+inherit games
+
+DESCRIPTION="An x86 binary-only emulator for the Sony ZN-1, ZN-2, and Namco System 11 arcade systems"
+HOMEPAGE="http://caesar.logiqx.com/php/emulator.php?id=zinc_linux"
+SRC_URI="http://caesar.logiqx.com/zips/emus/linux/zinc_linux/${P//[-.]/}-lnx.tar.bz2"
+
+LICENSE="freedist"
+SLOT="0"
+KEYWORDS="-* amd64 x86"
+IUSE=""
+RESTRICT="strip"
+QA_PREBUILT="${GAMES_PREFIX_OPT:1}/bin/zinc /usr/lib*/*.so"
+
+RDEPEND="
+ x11-libs/libXext[abi_x86_32(-)]
+ virtual/opengl[abi_x86_32(-)]"
+
+S=${WORKDIR}/zinc
+
+src_install() {
+ exeinto "${GAMES_PREFIX_OPT}"/bin
+ doexe zinc
+ dolib.so libcontrolznc.so librendererznc.so libsoundznc.so libs11player.so
+ dodoc readme.txt
+ prepgamesdirs
+}
diff --git a/games-emulation/zsnes/Manifest b/games-emulation/zsnes/Manifest
new file mode 100644
index 000000000000..f6a4da4e7fda
--- /dev/null
+++ b/games-emulation/zsnes/Manifest
@@ -0,0 +1 @@
+DIST zsnes151src.tar.bz2 1071712 SHA256 eb013f824f5a9814a714cf0daaea3ea68a1c74fd741e5b0979fcb7964236a866 SHA512 2cec9ad7762fc7a257c6b1d3e190b0ed53565dbafe42e1dee9eb182644392b7dd2c57faa846f63cd30ac079e5c05354d26ce0612d20481a1f54d760d62d95353 WHIRLPOOL a023003bcad23dc1da20338dc6adaf6a4061f70f9968a436c5ffeb3263ead85786909b1c2225c0762cd8f0f0a0757c52773326ad2c800f38fcc714f40e4b2162
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-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..e509e0107763
--- /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 2014-03-01 04:01:30.351323580 -0500
++++ zsnes_1_51/src/linux/sdllink.c 2014-03-01 04:02:12.249702898 -0500
+@@ -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..9be2846979f1
--- /dev/null
+++ b/games-emulation/zsnes/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>games</herd>
+ <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..0fedbe9ca3ab
--- /dev/null
+++ b/games-emulation/zsnes/zsnes-1.51-r4.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+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 ~x86-freebsd ~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[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
+
+ # 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)
+ 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 \
+ --enable-release \
+ force_arch=no
+}
+
+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
+}