summaryrefslogtreecommitdiff
blob: a082d1cbcd404b99b2631f1e28697593ded852f8 (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
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/pearpc/pearpc-0.4.ebuild,v 1.13 2009/09/06 21:18:20 robbat2 Exp $

inherit eutils flag-o-matic linux-mod

DESCRIPTION="PowerPC Architecture Emulator"
HOMEPAGE="http://pearpc.sourceforge.net/"
SRC_URI="mirror://sourceforge/pearpc/${P}.tar.bz2
	http://pearpc.sf.net/createdisk.py"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="-amd64 ~ppc ~x86"
IUSE="debug jit X sdl"

RDEPEND="sys-apps/net-tools
	sdl? ( >=media-libs/libsdl-1.2.0 )
	X? ( x11-libs/libX11 )
	net-firewall/iptables
	net-misc/bridge-utils"
DEPEND="${RDEPEND}
	sys-devel/flex
	sys-devel/bison
	x86? ( dev-lang/nasm )
	jit? ( dev-lang/nasm )"

src_unpack() {
	unpack ${A}
	cd "${S}"

	epatch "${FILESDIR}/${P}-configure.patch"
}

pkg_setup() {
	linux-mod_pkg_setup
	if ! linux_chkconfig_present TUN; then
		die "You must have TUN/TAP enabled in your kernel."
	fi
}

src_compile() {
	local myconf

	use jit && myconf="${myconf} --enable-cpu=jitc_x86"
	if use sdl; then
		myconf="${myconf} --enable-ui=sdl"
	elif use X; then
		myconf="${myconf} --enable-ui=x11"
	else
		die "You must set at least one of this flags X, sdl"
	fi

	econf \
		$(use_enable debug) \
		${myconf} \
		|| die "econf failed"
	emake || die "emake failed"
	sed -i -e "s:video.x:/usr/share/${P}/video.x:g" ppccfg.example
}

src_install() {
	dobin src/ppc
	dodoc ChangeLog AUTHORS README TODO ppccfg.example

	insinto /usr/share/${P}
	doins scripts/ifppc_{down,up}{,.setuid} video.x "${FILESDIR}"/settings
	fperms u+s,a+x /usr/share/${P}/ifppc_{up,down}.setuid

	insinto /usr/share/${P}/scripts
	doins "${DISTDIR}"/createdisk.py
}

pkg_postinst() {
	elog "You will need to update your configuration files to point"
	elog "to the new location of video.x, which is now"
	elog "/usr/share/${P}/video.x"
	elog ""
	elog "To create disk images for PearPC, you can use the Python"
	elog "script located at: /usr/share/${P}/scripts/createdisk.py"
	elog "Usage: createdisk.py <image name> <image size>"
	elog ""
	elog "Also, be sure to check ppccfg.example in /usr/share/doc/${P}/"
	elog "for new configuration options."
}