summaryrefslogtreecommitdiff
blob: ee9bdb6623d6afefceed6864bf54397f924cea7b (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
108
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/bochs/bochs-2.2.6.ebuild,v 1.5 2007/04/16 09:53:00 opfer Exp $

inherit eutils wxwidgets

DESCRIPTION="a LGPL-ed pc emulator"
HOMEPAGE="http://bochs.sourceforge.net/"
SRC_URI="mirror://sourceforge/bochs/${P}.tar.gz
	 http://bochs.sourceforge.net/guestos/dlxlinux4.tar.gz
	 mirror://gentoo/${P}-unicode.patch.gz"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~alpha amd64 ~ppc ~sparc x86"
IUSE="debugger readline sdl wxwindows X ncurses vnc"

RDEPEND="virtual/libc
	X? ( || ( virtual/x11
			( 	x11-libs/libICE
				x11-libs/libSM
				x11-libs/libX11
				x11-libs/libXpm ) ) )
	sdl? ( media-libs/libsdl )
	wxwindows? ( >=x11-libs/wxGTK-2.6 )
	readline? ( sys-libs/readline )
	ncurses? ( sys-libs/ncurses )"

DEPEND="${RDEPEND}
	X? ( || ( virtual/x11
			x11-proto/xproto ) )
	>=sys-apps/sed-4
	>=app-text/opensp-1.5"

src_unpack() {
	unpack ${P}.tar.gz
	cd ${S}
	sed -i \
		-e "s:\$(WGET) \$(DLXLINUX_TAR_URL):cp ${DISTDIR}/dlxlinux4.tar.gz .:" \
		-e "s:BOCHSDIR=:BOCHSDIR=/usr/$(get_libdir)/bochs#:" \
		-e 's: $(BOCHSDIR): $(DESTDIR)$(BOCHSDIR):g' Makefile.in || \
			die "sed Makefile.in failed"

# Make it use the correct path to gtk-2
	sed -i -e "s:/opt/gnome:/usr:" configure
# Fix some bad coding for gcc-4.1 compliance
	sed -i -e "s:\#ifndef PARANOID:\#if 0:" iodev/hdimage.h
# Make sure wxwindows 2.6 is used in case both 2.6 and 2.4 are installed
	sed -i -e "s:wx-config:wx-config-2.6:" configure
# wx unicode patches from fedora and bits the fedora missed
	epatch ${DISTDIR}/${P}-unicode.patch.gz
}

src_compile() {
	export WX_GTK_VER=2.6

	use wxwindows && \
		need-wxwidgets gtk2

	[[ "$ARCH" == "x86" ]] \
		&& myconf="--enable-idle-hack --enable-fast-function-calls"
	myconf="${myconf} `use_with sdl`"
	myconf="${myconf} `use_enable readline`"
	use wxwindows && \
		myconf="${myconf} --with-wx"
	use wxwindows || \
		myconf="${myconf} --without-wx"
	use debugger && \
		myconf="$myconf --enable-debugger --enable-disasm \
				--enable-x86-debugger --enable-iodebug"
	use debugger || \
		myconf="$myconf --enable-gdb-stub"
	use vnc && \
		myconf="$myconf --with-rfb"

	use X && \
		myconf="$myconf --with-x11"

	use ncurses && \
		myconf="$myconf --with-term"

	if ! use X && ! use ncurses && ! use vnc && ! use sdl
	then
		myconf="$myconf --with-nogui"
	fi

# needed to use gtk2 includes and libs	
	autoconf
	./configure \
		--enable-usb --enable-pci --enable-vbe \
		--enable-sse=2 --enable-3dnow --enable-plugins \
		--enable-cpu-level=6 --enable-all-optimizations \
		--enable-ne2000 --enable-sb16=linux --enable-clgd54xx \
		--enable-apic --enable-compressed-hd \
		--enable-pni --enable-sep --host=${CHOST} \
		--libdir=/usr/$(get_libdir) --prefix=/usr \
		${myconf} || die "configure failed"

	emake || die "emake failed"
}

src_install() {
	make DESTDIR=${D} install unpack_dlx || die "make install failed"
	#workaround
	make prefix=${D}/usr install_dlx

	dodoc CHANGES README TESTFORM.txt || die "dodoc failed"
}