summaryrefslogtreecommitdiff
blob: e24562152052c7e840f7b9281f0c49eed9aea9bc (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
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/games-emulation/generator/generator-0.35-r2.ebuild,v 1.1 2006/09/03 01:31:19 tupone Exp $

inherit eutils toolchain-funcs games

DESCRIPTION="Sega Genesis / Mega Drive console emulator"
HOMEPAGE="http://www.ghostwhitecrab.com/generator/"
SRC_URI="http://www.ghostwhitecrab.com/generator/${P}-cbiere.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="svga gtk"

S=${WORKDIR}/${P}-cbiere

RDEPEND="media-libs/jpeg
	gtk? (
		=x11-libs/gtk+-1*
		media-libs/libsdl
	)
	svga? ( media-libs/svgalib )"
DEPEND="${RDEPEND}
	>=sys-apps/sed-4
	x86? ( dev-lang/nasm )"

src_unpack() {
	unpack ${A}
	cd "${S}"
	mkdir my-bins

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

	sed -i \
		-e '/CFLAGS.*-O3/d' \
		-e 's/-minline-all-stringops//g' \
		configure || die "sed configure failed"

	if [[ $(gcc-major-version) -eq 3 ]] ; then
		sed -i \
			-e "s/-malign-functions/-falign-functions/" \
			-e "s/-malign-loops/-falign-loops/" \
			-e "s/-malign-jumps/-falign-jumps/" \
			configure || die "sed configure failed"
	fi
}

src_compile() {
	local myconf="--with-gcc=$(gcc-major-version)"
	local mygui myguis

	use x86 \
		&& myconf="${myconf} --with-raze" \
		|| myconf="${myconf} --with-cmz80"

	use gtk && myguis="gtk"
	use svga && myguis="svgalib"

	for mygui in ${myguis:-gtk} ; do
		[[ -f Makefile ]] && make -s clean
		egamesconf \
			${myconf} \
			--with-${mygui} || die
		emake -j1 || die "building ${mygui}"
		mv main/generator-${mygui} my-bins/
	done
}

src_install() {
	dogamesbin my-bins/* || die "dogamesbin failed"
	dodoc AUTHORS ChangeLog NEWS README TODO
	prepgamesdirs
}