--- /dev/null
+AUX pcsx2-add-nls.patch 708 RMD160 9f06fde79480153d82a6e49cbabf53848b857d27 SHA1 4d168cbd38cbe66887573f856cd95f30629e4bca SHA256 e4e43f9d627f3e23b3116b90885fbe6daf94ce0f3604ca63d1f10ec369df014b
+AUX pcsx2-custom-cflags.patch 841 RMD160 e223104d1a711fcdae50b77317c6adadcfd3fb34 SHA1 239ca4910d7aec4a11f3d17568b2d8dd42d9411b SHA256 a19b434a169cc5d6bf2fe9a903375ecad887d88d28dce2a3289abf13771b754a
+AUX pcsx2-gcc43.patch 274 RMD160 b0542a3d552b10c4f7bf7a3943d2e34ff724b4a3 SHA1 45783c849f7ae44424f103b80e822cef31a424e6 SHA256 938b4d8050a029f67ad12a3668f7a69a9be7b0dc45a50fd39845f18b29fffdde
+AUX pcsx2-plugin-inis.patch 630 RMD160 e4667453369e90664c556590e7f7b08b1e78442e SHA1 019a96248be7f40b7743706fbfa1f4ecd7986f27 SHA256 481bc24dc073174e9f8d2f84b18777d2aac93a90a5a4cdff4bd871cc4dff24c1
+DIST pcsx2-0.9.4.tar.gz 6098636 RMD160 3ae7801900833214613c4a8a346d295065bdaab7 SHA1 a471ce5614efdb5e215c0b09f75cc7550bb7a461 SHA256 208420ff1d83116d95029d0d1da8d01383d06a67aa1c16e10947cfd727d7740c
+EBUILD pcsx2-0.9.4.ebuild 3473 RMD160 1e0aa5464c66f48fc37613d9778c51ca3ae0c1cd SHA1 9fd2af9f2fb782f892199028708172d5c6341dfe SHA256 9f0337b2cc6c833ab9f7a62dd9db8980bb8ec60da3eed1515a2707bec00cc98c
--- /dev/null
+--- configure.ac.old 2008-02-23 22:42:48.751259786 +0000
++++ configure.ac 2008-02-23 22:44:38.140260060 +0000
+@@ -107,7 +107,12 @@
+ AC_CHECK_LIB(stdc++,main,[LIBS="$LIBS -lstdc++"])
+ AC_CHECK_LIB(z,main,[LIBS="$LIBS -lz"])
+
+-AC_CHECK_HEADER([libintl.h], [AC_DEFINE(ENABLE_NLS,1,[__x86_64__])])
++AC_ARG_ENABLE(nls, AC_HELP_STRING([--disable-nls], [Disable nls support]),
++ nls=$enableval,nls=yes)
++if test "x$nls" == xyes
++then
++ AC_CHECK_HEADER([libintl.h], [AC_DEFINE(ENABLE_NLS,1,[__x86_64__])])
++fi
+
+ AC_OUTPUT([
+ Makefile
+@@ -132,3 +137,4 @@
+ echo " Force sse3? $sse3"
+ echo " Recompilers enabled? $recbuild"
+ echo " Virtual memory build? $vmbuild"
++echo " nls support? $nls"
--- /dev/null
+--- configure.ac.old 2008-03-02 14:49:49.564590000 +0000
++++ configure.ac 2008-03-02 14:52:53.589590315 +0000
+@@ -11,10 +11,9 @@
+ dnl necessary for compiling assembly
+ AM_PROG_AS
+
+-CFLAGS=
+-CPPFLAGS=
+-CXXFLAGS=
+-CCASFLAGS=
++CFLAGS="-O1 -finline-functions ${CFLAGS}"
++CXXFLAGS="-O1 -finline-functions ${CXXFLAGS}"
++CCASFLAGS="-O1 -finline-functions ${CCASFLAGS}"
+
+ dnl Check for debug build
+ AC_MSG_CHECKING(debug build)
+@@ -23,16 +22,10 @@
+ if test "x$debug" == xyes
+ then
+ AC_DEFINE(_DEBUG,1,[_DEBUG])
+- CFLAGS+=" -g "
+- CPPFLAGS+=" -g "
+- CXXFLAGS+=" -g "
+- CCASFLAGS+=" -D_DEBUG -g "
++ CCASFLAGS+=" -D_DEBUG "
+ MYOBJDIR="Debug"
+ else
+ AC_DEFINE(NDEBUG,1,[NDEBUG])
+- CFLAGS+=" -O3 -fomit-frame-pointer "
+- CPPFLAGS+=" -O3 -fomit-frame-pointer "
+- CXXFLAGS+=" -O3 -fomit-frame-pointer "
+ MYOBJDIR="Release"
+ fi
+ AC_MSG_RESULT($debug)
--- /dev/null
+diff -Nur pcsx2.orig/GS.cpp pcsx2/GS.cpp
+--- pcsx2.orig/GS.cpp 2008-06-03 14:26:12.000000000 +0200
++++ pcsx2/GS.cpp 2008-06-03 14:29:17.000000000 +0200
+@@ -28,6 +28,8 @@
+
+ #include <vector>
+ #include <list>
++#include <cstring>
++#include <cstdlib>
+
+ using namespace std;
+
--- /dev/null
+--- Linux.old/GtkGui.c 2007-11-19 07:21:55.000000000 +0000
++++ Linux/GtkGui.c 2008-02-25 11:57:37.167773962 +0000
+@@ -723,12 +723,9 @@
+ strcpy(file, Config.PluginsDir); \\r
+ strcat(file, plugin); \\r
+ drv = SysLoadLibrary(file); \\r
+- getcwd(file, ARRAYSIZE(file)); /* store current dir */ \\r
+- chdir(Config.PluginsDir); /* change dirs so that plugins can find their config file*/ \\r
+ if (drv == NULL) return; \\r
+ conf = (src) SysLoadSym(drv, name); \\r
+ if (SysLibError() == NULL) conf(); \\r
+- chdir(file); /* change back*/ \\r
+ SysCloseLibrary(drv);\r
+ \r
+ #define TestPlugin(src, confs, plugin, name) \\r
--- /dev/null
+# Copyright 1999-2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+inherit games autotools eutils flag-o-matic
+
+DESCRIPTION="PlayStation2 emulator"
+HOMEPAGE="http://www.pcsx2.net/"
+SRC_URI="mirror://sourceforge/pcsx2/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="alsa debug devbuild nls oss vmbuild"
+
+CDEPEND="sys-libs/zlib
+ >=x11-libs/gtk+-2"
+
+DEPEND="${CDEPEND}
+ x11-proto/xproto"
+
+RDEPEND="${CDEPEND}
+ games-emulation/ps2emu-zerogs
+ games-emulation/ps2emu-zeropad
+ games-emulation/ps2emu-cdvdnull
+ games-emulation/ps2emu-dev9null
+ games-emulation/ps2emu-spu2null
+ games-emulation/ps2emu-fwnull
+ >=games-emulation/ps2emu-usbnull-0.4-r1
+ alsa? ( games-emulation/ps2emu-peopsspu2 )
+ oss? ( games-emulation/ps2emu-peopsspu2 )"
+
+LANGS="ar bg cz de du el es fr hb it ja pe pl po po_BR ro ru sh sw tc tr"
+
+for i in ${LANGS}; do
+ IUSE="${IUSE} linguas_${i}"
+done
+
+S="${WORKDIR}/${P}/${PN}"
+
+pkg_setup() {
+ local x
+
+ if ! use nls; then
+ for x in ${LANGS}; do
+ if [ -n "$(usev linguas_${x})" ]; then
+ eerror "Any language other than English is not supported with USE=\"-nls\""
+ die "Language ${x} not supported with USE=\"-nls\""
+ fi
+ done
+ fi
+
+ if use vmbuild; then
+ ewarn "Warning: Compilation is known to fail with the vmbuild use flag"
+ ewarn "enabled. The recommended use flags are USE=\"sse2 -vmbuild\"."
+ ewarn "Do not file a bug unless you are using the above USE flags."
+ ewarn "If you can get it to compile however, please file a bug or "
+ ewarn "contact me at eatnumber1@gmail.com. (i'll give you a cookie)"
+ ebeep 5
+ fi
+}
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+
+ # Preserve custom CFLAGS passed to configure.
+ epatch "${FILESDIR}"/${PN}-custom-cflags.patch
+
+ # Add nls support to the configure script.
+ epatch "${FILESDIR}"/${PN}-add-nls.patch
+
+ # Allow plugin inis to be stored in ~/.pcsx2/inis.
+ epatch "${FILESDIR}"/${PN}-plugin-inis.patch
+
+ epatch "${FILESDIR}"/${PN}-gcc43.patch
+
+ eautoreconf -v --install || die
+}
+
+src_compile() {
+ local myconf
+ filter-flags -O0
+
+ if ! use x86 && ! use amd64; then
+ einfo "Recompiler not supported on this architecture. Disabling."
+ myconf=" --disable-recbuild"
+ fi
+
+ egamesconf \
+ $(use_enable devbuild) \
+ $(use_enable debug) \
+ $(use_enable nls) \
+ $(use_enable vmbuild) \
+ ${myconf} \
+ || die
+
+ emake || die
+}
+
+src_install() {
+ local x
+
+ keepdir "`games_get_libdir`/ps2emu/plugins"
+ dodoc Docs/*.txt || die "dodoc failed"
+ newgamesbin Linux/${PN} ${PN}.bin || die
+
+ sed \
+ -e "s:%GAMES_BINDIR%:${GAMES_BINDIR}:" \
+ -e "s:%GAMES_DATADIR%:${GAMES_DATADIR}:" \
+ -e "s:%GAMES_LIBDIR%:`games_get_libdir`:" \
+ "${FILESDIR}/${PN}" > "${D}${GAMES_BINDIR}/${PN}" || die
+
+ cd ../bin
+ dohtml -r compat_list/* || die
+ insinto "${GAMES_DATADIR}/${PN}"
+ doins -r *.xml .pixmaps patches || die
+ insinto "${GAMES_DATADIR}/${PN}/Langs"
+
+ for x in ${LANGS}; do
+ if use linguas_${x}; then
+ [[ "${x/_/}" == "${x}" ]] && x=${x}_`echo ${x} | tr 'a-z' 'A-Z'`
+ doins -r Langs/${x} || die "doins for language ${x} failed"
+ fi
+ done
+
+ prepgamesdirs
+}
+
+pkg_postinst() {
+ if ! use devbuild; then
+ ewarn "If this package exhibits random crashes, recompile ${PN}"
+ ewarn "with the devbuild use flag enabled. If that fixes it, file a bug."
+ echo
+ fi
+
+ elog "Please note that this ebuild does not install all the available plugins."
+ elog "You will need to install other ps2emu plugins in order for the emulator"
+ elog "to be usable."
+}