summaryrefslogtreecommitdiff
blob: 8c946229a2ab33edce1ffdf63c088b40f5086e96 (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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-emulation/mupen64/mupen64-0.3.ebuild,v 1.7 2005/01/01 06:59:18 morfic Exp $

inherit games gcc eutils

DESCRIPTION="A Nintendo 64 (N64) emulator"
SRC_URI="http://mupen64.emulation64.com/files/src/mupen64_src-${PV}.tar.bz2
	http://mupen64.emulation64.com/files/src/mupen64_input.tar.bz2
	http://mupen64.emulation64.com/files/src/mupen64_sound.tar.bz2
	http://mupen64.emulation64.com/files/src/tr64_oglv078_src.tar.bz2
	http://mupen64.emulation64.com/files/src/mupen64_hle_rsp.tar.bz2
	http://mupen64.emulation64.com/files/src/riceplugin.tar.bz2"
HOMEPAGE="http://mupen64.emulation64.com/"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="-* x86"
IUSE=""

RDEPEND="=x11-libs/gtk+-1.2*
	media-libs/libsdl
	virtual/glu
	virtual/opengl"
DEPEND="${RDEPEND}
	>=sys-apps/sed-4"

S="${WORKDIR}"

src_unpack() {
	unpack ${A}

	# the riceplugin seems to want gcc 3.3 to compile
	if [ "`gcc-major-version`" -lt 3 -o "`gcc-version`" = "3.2" ] ; then
		rm -rf riceplugin
	else
		epatch ${FILESDIR}/${PV}-gcc3.patch
		sed -i \
			-e "/^CFLAGS/s:-O3.*$:${CFLAGS}:" \
			riceplugin/Makefile \
			|| die "sed riceplugin/Makefile failed"
	fi
	# the riceplugin requires sse support
	echo "#include <xmmintrin.h>" > ${T}/test.c
	$(gcc-getCC) ${CFLAGS} -o ${T}/test.s -S ${T}/test.c >&/dev/null || rm -rf riceplugin

	sed -i \
		-e "/^CC/s:-O3.*-Wall:${CFLAGS}:" \
		emu64/Makefile mupen64_input/Makefile \
		|| die "sed mupen64_input/Makefile failed"
	sed -i \
		-e "/^CFLAGS/s:-O3.*-march=athlon:${CFLAGS}:" \
		mupen64_sound/Makefile \
		|| die "sed mupen64_sound/Makefile failed"
	sed -i \
		-e "/^CFLAGS/s:-O3.*$:${CFLAGS}:" \
		rsp_hle/Makefile tr64_oglv078_src/Makefile \
		|| die "other sed Makefiles failed"
}

src_compile() {
	for d in * ; do
		cd ${S}/${d}
		emake || die "emake failed on $d"
	done
}

src_install() {
	local dir=${GAMES_LIBDIR}/${PN}
	dodir ${dir}

	exeinto ${dir}/plugins
	doexe */*.so
	insinto ${dir}/plugins
	doins */*.ini
	rm ${D}/${dir}/plugins/mupen64*.ini

	cd emu64
	cp -r mupen64* lang plugins save roms path.cfg ${D}/${dir}/
	rm ${D}/${dir}/mupen64_test.ini
	dogamesbin ${FILESDIR}/mupen64
	dosed "s:GENTOO_DIR:${dir}:" ${GAMES_BINDIR}/mupen64
	newgamesbin ${FILESDIR}/mupen64 mupen64_nogui
	dosed "s:GENTOO_DIR:${dir}:" ${GAMES_BINDIR}/mupen64_nogui
	dodoc *.txt doc/readme.pdf

	prepgamesdirs
}