aboutsummaryrefslogtreecommitdiff
blob: 7e5bbfc58c5af746c39ae9a51889576d9941394a (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
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit xdg cmake desktop git-r3

DESCRIPTION="Fast Sony PlayStation (PSX) emulator"
HOMEPAGE="https://github.com/stenzek/duckstation"
EGIT_REPO_URI="https://github.com/stenzek/duckstation.git"
EGIT_CHECKOUT_DIR="${WORKDIR}/${PN}"
EGIT_SUBMODULES=()

LICENSE="GPL-3"
SLOT="0"
IUSE="discord +egl +evdev fbdev +gamepad gbm +nogui qt5 retroachievements wayland X"

# Either or both frontends must be built
REQUIRED_USE="
	?? ( fbdev gbm )
	gbm? ( egl )
	wayland? ( egl )
"

BDEPEND="
	virtual/pkgconfig
	wayland? ( kde-frameworks/extra-cmake-modules )
"
DEPEND="
	evdev? ( dev-libs/libevdev )
	gamepad? ( media-libs/libsdl2 )
	gbm? ( x11-libs/libdrm )
	qt5? (
			dev-qt/qtcore
			dev-qt/qtgui
			dev-qt/qtnetwork
	)
	retroachievements? ( net-misc/curl[curl_ssl_gnutls] )
	X? (
			x11-libs/libX11
			x11-libs/libXrandr
	)
"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${PN}"

src_configure() {
	local mycmakeargs=(
		-DBUILD_NOGUI_FRONTEND=$(usex nogui)
		-DBUILD_QT_FRONTEND=$(usex qt5)
		-DENABLE_CHEEVOS=$(usex retroachievements)
		–DENABLE_DISCORD_PRESENCE=$(usex discord)
		-DUSE_DRMKMS=$(usex gbm)
		-DUSE_EGL=$(usex egl)
		-DUSE_EVDEV=$(usex evdev)
		-DUSE_FBDEV=$(usex fbdev)
		-DUSE_SDL2=$(usex gamepad)
		-DUSE_WAYLAND=$(usex wayland)
		-DUSE_X11=$(usex X)
		-DBUILD_SHARED_LIBS=OFF
	)
	cmake_src_configure
}

src_install() {
	dodoc README.md

	# Binary and resources files must be in same directory – installing in /opt
	insinto /opt/${PN}
	doins -r "${BUILD_DIR}"/bin/{database,inputprofiles,resources,shaders,translations}

	if use nogui; then
		for i in {16,32,48,64,128,256}; do
			newicon -s ${i} dist/icon-${i}px.png duckstation-nogui
		done
		domenu dist/duckstation-nogui.desktop

		doins "${BUILD_DIR}"/bin/duckstation-nogui
		dosym ../../opt/${PN}/duckstation-nogui usr/bin/duckstation-nogui
		fperms +x /opt/${PN}/duckstation-nogui
	fi

	if use qt5; then
		for i in {16,32,48,64,128,256}; do
			newicon -s ${i} dist/icon-${i}px.png duckstation-qt
		done
		domenu dist/duckstation-qt.desktop

		doins "${BUILD_DIR}"/bin/duckstation-qt
		dosym ../../opt/${PN}/duckstation-qt usr/bin/duckstation-qt
		fperms +x /opt/${PN}/duckstation-qt
	fi
}