summaryrefslogtreecommitdiff
blob: e484fdff7aa0a907d0266fca0e1d51f683b179ac (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit desktop toolchain-funcs

HIGAN_COMMIT="9bf1b3314b2bcc73cbc11d344b369c31562aff10"

DESCRIPTION="Multi-system emulator focused on accuracy, preservation, and configurability"
HOMEPAGE="https://github.com/higan-emu/higan"
SRC_URI="https://github.com/higan-emu/higan/archive/${HIGAN_COMMIT}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/${PN}-${HIGAN_COMMIT}"

LICENSE="GPL-3+ ISC"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="alsa ao +gtk openal +opengl oss +pulseaudio +sdl udev xv"

RDEPEND="
	x11-libs/libX11
	x11-libs/libXext
	x11-libs/libXrandr
	alsa? ( media-libs/alsa-lib )
	ao? ( media-libs/libao )
	openal? ( media-libs/openal )
	opengl? ( virtual/opengl )
	pulseaudio? ( media-sound/pulseaudio )
	sdl? ( media-libs/libsdl2[joystick] )
	udev? ( virtual/libudev:= )
	xv? ( x11-libs/libXv )
	gtk? (
		dev-libs/glib:2
		x11-libs/cairo
		x11-libs/gdk-pixbuf:2
		x11-libs/gtk+:3
		x11-libs/gtksourceview:3.0=
		x11-libs/pango
	)
	!gtk? (
		dev-qt/qtcore:5
		dev-qt/qtgui:5
		dev-qt/qtwidgets:5
	)"
DEPEND="
	${RDEPEND}
	x11-base/xorg-proto"
BDEPEND="virtual/pkgconfig"

PATCHES=(
	# insane build system, reinvents every built-in rule
	"${FILESDIR}"/${PN}-116_pre20210404-makefile.patch
	"${FILESDIR}"/${PN}-116_pre20210818-paths.patch
)

src_prepare() {
	default

	use !prefix || sed -i "s|/usr/share|${EPREFIX}&|" nall/path.hpp || die
}

src_compile() {
	local makeopts=(
		platform=linux
		compiler="$(tc-getCXX)"
		hiro=$(usex gtk gtk3 qt5)
	)

	local drivers=(
		video.xshm
		input.xlib
		$(usev alsa audio.alsa)
		$(usev ao audio.ao)
		$(usev openal audio.openal)
		$(usev opengl "video.glx video.glx2")
		$(usev oss audio.oss)
		$(usev pulseaudio "audio.pulseaudio audio.pulseaudiosimple")
		$(usev sdl input.sdl)
		$(usev udev input.udev)
		$(usev xv video.xvideo)
	)

	local coreopts=(
		cores="cv fc gb gba md ms msx ngp pce sfc sg ws"
		ruby="${drivers[*]}"
		build=performance
		local=false
	)

	emake "${makeopts[@]}" "${coreopts[@]}" -C higan-ui

	emake "${makeopts[@]}" -C icarus
}

src_install() {
	dobin higan-ui/out/higan
	domenu higan-ui/resource/higan.desktop
	doicon higan-ui/resource/higan.png

	dobin icarus/out/icarus
	domenu icarus/resource/icarus.desktop
	doicon icarus/resource/icarus.svg

	insinto /usr/share/higan
	doins -r icarus/{Database,Firmware}
	use opengl && doins -r extras/Shaders

	insinto /usr/share/higan/Templates
	doins -r higan/System/.
}

pkg_postinst() {
	if [[ ${REPLACING_VERSIONS} ]] &&
		ver_test ${REPLACING_VERSIONS} -lt 116_pre20210818; then
		elog "On new installs, higan now uses ~/.local/share/higan/Systems/ rather than"
		elog "~/higan/, and reads Templates from ${EROOT}/usr/share/higan/ on Gentoo."
		elog "Will need to edit/delete ~/.config/higan/paths.bml for this to take effect."
		elog
		elog "Additionally, system's shaders will be used if ~/.config/higan/Shaders"
		elog "does not exist, and icarus now uses the system's Database+Firmware files."
	fi
}