summaryrefslogtreecommitdiff
blob: a6f2f98fe3999babd87300e74ffe5e683622c0c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/snes9x/snes9x-139-r1.ebuild,v 1.15 2003/03/03 15:45:03 darkspecter Exp $

DESCRIPTION="Super Nintendo Entertainment System (SNES) emulator"
HOMEPAGE="http://www.snes9x.com/"
SRC_URI="http://www.snes9x.com/zips/s9xs${PV}.zip"

LICENSE="as-is"
KEYWORDS="x86 ~ppc"
SLOT="0"
IUSE="X svga 3dfx opengl"

DEPEND="x86? ( dev-lang/nasm )
	X? ( virtual/x11 )
	svga? ( media-libs/svgalib )
	opengl? ( virtual/opengl )
	3dfx? ( media-libs/glide-v3 )"
RDEPEND="X? ( virtual/x11 )
	svga? ( media-libs/svgalib )
	opengl? ( virtual/opengl )
	3dfx? ( media-libs/glide-v3 )"

S="${WORKDIR}/release"

pkg_setup() {
	local mydisp
	mydisp="`use X``use svga``use opengl``use 3dfx`"
	if [ -z "${mydisp}" ] ; then
		eerror "Unable to find a display mode"
		echo
		eerror "You must have at least 1 of the following"
		eerror "in your USE variable:"
		eerror "X   svga   opengl   3dfx"
		die "unable to compile targets"
	fi
}

src_compile() {
	patch -p1 < ${FILESDIR}/snes9x-gcc3.diff
	if [ `use ppc` ]; then
		patch -p1 < ${FILESDIR}/snes9x-139-r1-Makefile-ppc.diff
		patch -p1 < ${FILESDIR}/snes9x-139-r1-BE-sound-fix.diff
	fi

	#install our custom CXXFLAGS
	mv Makefile.linux Makefile
	cp Makefile Makefile.old
	sed -e "s:OPTIMISE=:OPTIMISE=${CXXFLAGS}:" \
		Makefile.old > Makefile

	use X			&& emake snes9x
	[ -x ${S}/snes9x ]	|| die "unable to compile for X"

	use svga		&& emake ssnes9x
	[ -x ${S}/snes9x ]	|| die "unable to compile for svga"

	use opengl		&& emake osnes9x
	[ -x ${S}/snes9x ]	|| die "unable to compile for opengl"

	use 3dfx		&& emake gsnes9x
	[ -x ${S}/snes9x ]	|| die "unable to compile for glide"
}

src_install() {
	use X		&&	dobin snes9x
	use svga	&&	dobin ssnes9x
	use opengl	&&	dobin osnes9x
	use 3dfx	&&	dobin gsnes9x
	dodoc {COPYRIGHT,CHANGES,README,PROBLEMS,TODO,HARDWARE,HOW2PORT}.TXT
}