summaryrefslogtreecommitdiff
blob: e8aeb3a8b2c0cffb8264c88951816a1d236c68a2 (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
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6
inherit desktop flag-o-matic toolchain-funcs gnome2-utils

DESCRIPTION="Portable, Open Source NES emulator which is written mostly in C"
HOMEPAGE="http://fakenes.sourceforge.net/"
SRC_URI="mirror://sourceforge/fakenes/${P}.tar.bz2"

LICENSE="ZLIB"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="openal opengl zlib"

RDEPEND="
	>=media-libs/allegro-4.4.1.1:0[opengl?]
	dev-games/hawknl
	openal? (
		media-libs/openal
		media-libs/freealut
	)
	zlib? ( sys-libs/zlib )
"
DEPEND="${RDEPEND}
	virtual/pkgconfig
"

src_prepare() {
	default
	sed -i \
		-e "s:openal-config:pkg-config openal:" \
		build/openal.cbd || die

	sed -i \
		-e "s:LIBAGL = agl:LIBAGL = alleggl:" \
		build/alleggl.cbd || die
	eapply "${FILESDIR}"/${P}-{underlink,zlib}.patch
}

src_compile() {
	local myconf

	append-ldflags -Wl,-z,noexecstack

	echo "$(tc-getBUILD_CC) cbuild.c -o cbuild"
	$(tc-getBUILD_CC) cbuild.c -o cbuild || die "cbuild build failed"

	use openal || myconf="$myconf -openal"
	use opengl || myconf="$myconf -alleggl"
	use zlib   || myconf="$myconf -zlib"

	LD="$(tc-getCC) ${CFLAGS}" ./cbuild ${myconf} --verbose || die "cbuild failed"
}

src_install() {
	dobin fakenes
	insinto "/usr/share/${PN}"
	doins support/*

	cd docs && HTML_DOCS="faq.html" einstalldocs && cd ..

	newicon -s 32 support/icon-32x32.png ${PN}.png
	make_desktop_entry ${PN} "FakeNES"
}

pkg_preinst() {
	gnome2_icon_savelist
}

pkg_postinst() {
	gnome2_icon_cache_update
}

pkg_postrm() {
	gnome2_icon_cache_update
}