Add games-emulation/pcsx2-0.9.4.
[overlay.git] / games-emulation / pcsx2 / pcsx2-0.9.4.ebuild
1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 inherit games autotools eutils flag-o-matic
6
7 DESCRIPTION="PlayStation2 emulator"
8 HOMEPAGE="http://www.pcsx2.net/"
9 SRC_URI="mirror://sourceforge/pcsx2/${P}.tar.gz"
10
11 LICENSE="GPL-2"
12 SLOT="0"
13 KEYWORDS="~amd64 ~x86"
14 IUSE="alsa debug devbuild nls oss vmbuild"
15
16 CDEPEND="sys-libs/zlib
17         >=x11-libs/gtk+-2"
18
19 DEPEND="${CDEPEND}
20         x11-proto/xproto"
21
22 RDEPEND="${CDEPEND}
23         games-emulation/ps2emu-zerogs
24         games-emulation/ps2emu-zeropad
25         games-emulation/ps2emu-cdvdnull
26         games-emulation/ps2emu-dev9null
27         games-emulation/ps2emu-spu2null
28         games-emulation/ps2emu-fwnull
29         >=games-emulation/ps2emu-usbnull-0.4-r1
30         alsa? ( games-emulation/ps2emu-peopsspu2 )
31         oss? ( games-emulation/ps2emu-peopsspu2 )"
32
33 LANGS="ar bg cz de du el es fr hb it ja pe pl po po_BR ro ru sh sw tc tr"
34
35 for i in ${LANGS}; do
36         IUSE="${IUSE} linguas_${i}"
37 done
38
39 S="${WORKDIR}/${P}/${PN}"
40
41 pkg_setup() {
42         local x
43
44         if ! use nls; then
45                 for x in ${LANGS}; do
46                         if [ -n "$(usev linguas_${x})" ]; then
47                                 eerror "Any language other than English is not supported with USE=\"-nls\""
48                                 die "Language ${x} not supported with USE=\"-nls\""
49                         fi
50                 done
51         fi
52
53         if use vmbuild; then
54                 ewarn "Warning: Compilation is known to fail with the vmbuild use flag"
55                 ewarn "enabled. The recommended use flags are USE=\"sse2 -vmbuild\"."
56                 ewarn "Do not file a bug unless you are using the above USE flags."
57                 ewarn "If you can get it to compile however, please file a bug or "
58                 ewarn "contact me at eatnumber1@gmail.com. (i'll give you a cookie)"
59                 ebeep 5
60         fi
61 }
62
63 src_unpack() {
64         unpack ${A}
65         cd "${S}"
66
67         # Preserve custom CFLAGS passed to configure.
68         epatch "${FILESDIR}"/${PN}-custom-cflags.patch
69
70         # Add nls support to the configure script.
71         epatch "${FILESDIR}"/${PN}-add-nls.patch
72
73         # Allow plugin inis to be stored in ~/.pcsx2/inis.
74         epatch "${FILESDIR}"/${PN}-plugin-inis.patch
75
76         epatch "${FILESDIR}"/${PN}-gcc43.patch
77
78         eautoreconf -v --install || die
79 }
80
81 src_compile() {
82         local myconf
83         filter-flags -O0
84         
85         if ! use x86 && ! use amd64; then
86                 einfo "Recompiler not supported on this architecture. Disabling."
87                 myconf=" --disable-recbuild"
88         fi
89         
90         egamesconf  \
91                 $(use_enable devbuild) \
92                 $(use_enable debug) \
93                 $(use_enable nls) \
94                 $(use_enable vmbuild) \
95                 ${myconf} \
96                 || die
97
98         emake || die
99 }
100
101 src_install() {
102         local x
103
104         keepdir "`games_get_libdir`/ps2emu/plugins"
105         dodoc Docs/*.txt || die "dodoc failed"
106         newgamesbin Linux/${PN} ${PN}.bin || die
107
108         sed \
109                 -e "s:%GAMES_BINDIR%:${GAMES_BINDIR}:" \
110                 -e "s:%GAMES_DATADIR%:${GAMES_DATADIR}:" \
111                 -e "s:%GAMES_LIBDIR%:`games_get_libdir`:" \
112                 "${FILESDIR}/${PN}" > "${D}${GAMES_BINDIR}/${PN}" || die
113
114         cd ../bin
115         dohtml -r compat_list/* || die
116         insinto "${GAMES_DATADIR}/${PN}"
117         doins -r *.xml .pixmaps patches || die
118         insinto "${GAMES_DATADIR}/${PN}/Langs"
119
120         for x in ${LANGS}; do
121                 if use linguas_${x}; then
122                         [[ "${x/_/}" == "${x}" ]] && x=${x}_`echo ${x} | tr 'a-z' 'A-Z'`
123                         doins -r Langs/${x} || die "doins for language ${x} failed"
124                 fi
125         done
126
127         prepgamesdirs
128 }
129
130 pkg_postinst() {
131         if ! use devbuild; then
132                 ewarn "If this package exhibits random crashes, recompile ${PN}"
133                 ewarn "with the devbuild use flag enabled. If that fixes it, file a bug."
134                 echo
135         fi
136
137         elog "Please note that this ebuild does not install all the available plugins."
138         elog "You will need to install other ps2emu plugins in order for the emulator"
139         elog "to be usable."
140 }