summaryrefslogtreecommitdiff
blob: ffb6cea886ad701d7f41d4a1d2650a33afaf886e (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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Copyright 1999-2005 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.2 2005/12/25 14:45:19 flameeyes Exp $

inherit flag-o-matic

IUSE="debug jit sdl"
#IUSE="debug qt gtk jit sdl"

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="~x86 ~ppc ~amd64"

DEPEND="x86? ( dev-lang/nasm )"

RDEPEND="virtual/x11
	media-libs/libmng
	media-libs/jpeg
	media-libs/libpng
	sys-libs/zlib
	media-libs/freetype
	sdl? ( media-libs/libsdl )"
#	gtk? ( >=x11-libs/gtk-2.0 )
#	qt? ( >=x11-libs/qt-3.1.1 )"

DEFAULT_TO_X11=0

pkg_setup() {

	append-ldflags $(bindnow-flags)

#	if (use qt && use sdl) || (use qt && use gtk) || (use gtk && sdl) || (use gtk && use qt && use sdl); then
#		ewarn
#		ewarn "More than one frontend USE flags enabled, defaulting to X11 support."
#		ewarn
#		DEFAULT_TO_X11=1
#	fi		
}

src_compile() {
	local myconf
	myconf="--enable-release"

	use jit && myconf="${myconf} --enable-cpu=jitc_x86"

	if use debug; then
		myconf="${myconf} --enable-debug"
	else
		myconf="${myconf} --disable-debug"
	fi

	if [ $DEFAULT_TO_X11 = 1 ]; then
		myconf="${myconf} --enable-ui=x11"
	else
		if use sdl; then
			myconf="${myconf} --enable-ui=sdl"
#		elif use qt; then
#			myconf="${myconf} --enable-ui=qt"
#		elif use gtk; then
#			myconf="${myconf} --enable-ui=gtk"
		else
			myconf="${myconf} --enable-ui=x11"
		fi
	fi

	econf ${myconf} || die "econf failed"
	emake || die "emake failed"
}

src_install() {
	dobin src/ppc
	dodoc ChangeLog AUTHORS COPYING README TODO

	dodir /usr/share/${P}
	insinto /usr/share/${P}
	doins scripts/ifppc_down scripts/ifppc_up scripts/ifppc_up.setuid scripts/ifppc_down.setuid
	doins video.x
	fperms u+s /usr/share/${P}/ifppc_up.setuid /usr/share/${P}/ifppc_down.setuid

	insinto /usr/share/doc/${P}
	sed -i -e "s:video.x:/usr/share/${P}/video.x:g" ppccfg.example
	doins ppccfg.example

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

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