summaryrefslogtreecommitdiff
blob: 6ca37bec719836cfeed6f1f74286a4239c7ccce2 (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# Copyright 2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

CARGO_OPTIONAL=1

CRATES="
	cc@1.0.83
	cfg-if@1.0.0
	libc@0.2.152
	libloading@0.7.4
	libusb1-sys@0.6.4
	once_cell@1.19.0
	pkg-config@0.3.29
	proc-macro2@1.0.78
	quote@1.0.35
	rusb@0.9.3
	serde@1.0.195
	serde_derive@1.0.195
	syn@2.0.48
	toml@0.5.11
	unicode-ident@1.0.12
	vcpkg@0.2.15
	winapi-i686-pc-windows-gnu@0.4.0
	winapi-x86_64-pc-windows-gnu@0.4.0
	winapi@0.3.9
"

inherit cargo cmake flag-o-matic xdg

MY_PN="${PN^^}"
MY_P="${MY_PN}-${PV}"
DESCRIPTION="Rosalie's Mupen GUI"
HOMEPAGE="https://github.com/Rosalie241/RMG"
if [[ "${PV}" == *9999 ]] ; then
	inherit git-r3
	EGIT_REPO_URI="https://github.com/Rosalie241/${MY_PN}.git"
else
	SRC_URI="
		https://github.com//Rosalie241/${MY_PN}/archive/v${PV}/${MY_P}.tar.gz \
			-> ${P}.tar.gz
		rust-plugin? ( ${CARGO_CRATE_URIS} )
	"
	S="${WORKDIR}/${MY_P}"
	KEYWORDS="~amd64"
fi

LICENSE="
	BSD-2 CC0-1.0 GPL-2 GPL-3 MIT ZLIB public-domain
	angrylion-plugin? ( XMAME )
	rust-plugin? ( ISC Unicode-DFS-2016 )
"
SLOT="0"
IUSE="angrylion-plugin discord dynarec rust-plugin"

DEPEND="
	dev-libs/hidapi
	dev-qt/qtbase:6[gui,opengl,vulkan,widgets]
	dev-qt/qtsvg:6
	media-libs/freetype
	media-libs/libpng:=
	media-libs/libsamplerate
	media-libs/libsdl2[haptic,joystick,opengl,sound,vulkan]
	media-libs/speexdsp
	sys-libs/zlib[minizip(+)]
	virtual/opengl
	rust-plugin? ( dev-libs/libusb:1 )
"
RDEPEND="${DEPEND}"
BDEPEND="
	virtual/pkgconfig
	dynarec? ( dev-lang/nasm )
	rust-plugin? ( virtual/rust )
"

PATCHES=(
	"${FILESDIR}"/${PN}-0.5.6-parallel-rdp-standalone-musl.patch
)

pkg_setup() {
	QA_FLAGS_IGNORED="/usr/$(get_libdir)/RMG/Plugin/Input/libmupen64plus_input_gca.so"
}

src_unpack() {
	if [[ "${PV}" == *9999 ]] ; then
		git-r3_src_unpack
		if use rust-plugin; then
			S="${S}"/Source/3rdParty/mupen64plus-input-gca \
			cargo_live_src_unpack
		fi
	else
		if use rust-plugin; then
			cargo_src_unpack
		else
			default
		fi
	fi
}

src_prepare() {
	cmake_src_prepare

	# Don't install unused 3rdParty code
	rm -r "${S}"/Source/3rdParty/fmt || die

	# Don't install XMAME licensed code
	if ! use angrylion-plugin; then
		rm -r "${S}"/Source/3rdParty/mupen64plus-video-angrylion-plus || die
	fi

	# Don't install pre-compiled binaries
	rm -r "${S}"/Source/3rdParty/vosk-api || die

	# Enable verbose make(1) output
	sed -e 's/CC=/V=1 CC=/' -i "${S}"/Source/3rdParty/CMakeLists.txt || die
}

src_configure() {
	# -Werror=strict-aliasing
	# https://github.com/gonetz/GLideN64/issues/2877
	#
	# Disable strict-aliasing until its handled upstream.
	append-flags -fno-strict-aliasing
	filter-lto

	export PKG_CONFIG_ALLOW_CROSS=1

	local mycmakeargs=(
		-DAPPIMAGE_UPDATER=OFF
		-DDISCORD_RPC=$(usex discord)
		-DNO_ASM=$(usex dynarec OFF ON)
		-DNO_RUST=$(usex rust-plugin OFF ON)
		-DPORTABLE_INSTALL=OFF
		-DUPDATER=OFF
		-DUSE_ANGRYLION=$(usex angrylion-plugin)
		-DUSE_CCACHE=OFF
		-DUSE_LIBFMT=OFF # Use std::format
		-DUSE_LTO=OFF
		-DVRU=OFF # Precompiled binaries
	)

	cmake_src_configure
}