aboutsummaryrefslogtreecommitdiff
blob: bc5f65995518507835c2e1b395b78c74fae2aa38 (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
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="3"

inherit subversion eutils flag-o-matic games

ESVN_REPO_URI="svn://messdev.no-ip.org/mess/"

DESCRIPTION="Multi Emulator Super System"
HOMEPAGE="http://www.mess.org"
SRC_URI=""

LICENSE="MAME"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="debug +opengl"

RDEPEND=">=media-libs/libsdl-1.2.10[opengl?]
	sys-libs/zlib
	dev-libs/expat
	x11-libs/libXinerama
	debug? (
		>gnome-base/gconf-2
		>=x11-libs/gtk+-2 )"
DEPEND="${RDEPEND}
	app-arch/unzip
	x11-proto/xineramaproto"

src_unpack() {
	subversion_src_unpack
}

src_prepare() {
	sed -i \
		-e '/^CCOMFLAGS += -O$(OPTIMIZE)=/s:^:# :' \
		-e '/\CCOMFLAGS += -pipe$/s:^:# :' \
		-e '/\LDFLAGS += -s/s:^:# :' \
		-e '/^BUILD_EXPAT/s:^:# :' \
		-e '/^BUILD_ZLIB/s:^:# :' \
		-e '/^SUFFIX/s:^:# :' \
		-e '/^SUFFIX64/s:^:# :' \
		-e '/^CCOMFLAGS =$/s:$:'"${CFLAGS}:" \
		makefile \
		|| die "sed failed"
}

src_compile() {
	local make_opts opts_flags
	use opengl || make_opts+=" NO_OPENGL=1"


	if use debug ; then
		ewarn "Building with DEBUG support is not recommended for normal use"
		make_opts+="DEBUG=1"
		make_opts+="PROFILE=1"
		make_opts+="SYMBOL=1"
		make_opts+="DEBUGGER=1"
	fi


	emake OSD=sdl TARGET=mess NAME="${PN}" \
		OPT_FLAGS='-DINI_PATH=\"'"${GAMES_SYSCONFDIR}/${PN}"'\"' \
		${make_opts} \
		all \
		|| die "emake failed"
}

src_install() { # Thanks to Sabayon ebuild
	dogamesbin "${PN}" || die "dogamesbin ${PN} failed"

	# Follows xmame ebuild, avoiding collision on /usr/games/bin/jedutil
	exeinto "$(games_get_libdir)/${PN}"
	local f
	for f in chdman ldverify imgtool jedutil romcmp testkeys; do
		doexe "${f}" || die "doexe ${f} failed"
	done

	insinto "${GAMES_DATADIR}/${PN}"
	doins -r artwork || die "doins -r keymaps failed"
	doins -r hash || die "doins -r keymaps failed"
	doins -r keymaps || die "doins -r keymaps failed"

	insinto "${GAMES_SYSCONFDIR}/${PN}"
	sed \
		-e "s:@VIDEO@:$(use opengl && echo -n opengl || echo -n soft):" \
		"${FILESDIR}"/vector.ini.in > "${ED}/${GAMES_SYSCONFDIR}/${PN}/"vector.ini \
		|| die "sed vector.ini.in failed"

	sed \
		-e "s:@GAMES_SYSCONFDIR@:${GAMES_SYSCONFDIR}:" \
		-e "s:@GAMES_DATADIR@:${GAMES_DATADIR}:" \
		-e "s:@VIDEO@:$(use opengl && echo -n opengl || echo -n soft):" \
		"${FILESDIR}"/mess.ini.in > "${ED}/${GAMES_SYSCONFDIR}/${PN}/"mess.ini \
		|| die "sed mess.ini.in failed"

	dodoc docs/{config,mame,newvideo}.txt *.txt

	keepdir "${GAMES_DATADIR}/${PN}"/{roms,sample,cheat,crosshair}
	keepdir "${GAMES_SYSCONFDIR}/${PN}"/ctrlr

	prepgamesdirs
}