1 |
|
# Copyright 1999-2022 Gentoo Authors
|
|
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
WX_GTK_VER="3.0-gtk3"
|
7 |
|
inherit cmake fcaps flag-o-matic multilib toolchain-funcs wxwidgets
|
|
6 |
inherit cmake desktop fcaps flag-o-matic
|
8 |
7 |
|
9 |
|
MY_PV="${PV/_/-}"
|
|
8 |
if [[ ${PV} == 9999 ]]; then
|
|
9 |
inherit git-r3
|
|
10 |
EGIT_REPO_URI="https://github.com/PCSX2/pcsx2.git"
|
|
11 |
else
|
|
12 |
HASH_FASTFLOAT=32d21dcecb404514f94fb58660b8029a4673c2c1
|
|
13 |
HASH_FMT=b6f4ceaed0a0a24ccf575fab6c56dd50ccf6f1a9
|
|
14 |
HASH_RCHEEVOS=3af1e2fc5188d6e932ee379942f4049ea877e648
|
|
15 |
HASH_GLSLANG=c9706bdda0ac22b9856f1aa8261e5b9e15cd20c5
|
|
16 |
HASH_VULKAN=9f4c61a31435a7a90a314fc68aeb386c92a09c0f
|
|
17 |
SRC_URI="
|
|
18 |
https://github.com/PCSX2/pcsx2/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
|
|
19 |
https://github.com/fastfloat/fast_float/archive/${HASH_FASTFLOAT}.tar.gz
|
|
20 |
-> ${PN}-fast_float-${HASH_FASTFLOAT::10}.tar.gz
|
|
21 |
https://github.com/fmtlib/fmt/archive/${HASH_FMT}.tar.gz
|
|
22 |
-> ${PN}-fmt-${HASH_FMT::10}.tar.gz
|
|
23 |
https://github.com/RetroAchievements/rcheevos/archive/${HASH_RCHEEVOS}.tar.gz
|
|
24 |
-> ${PN}-rcheevos-${HASH_RCHEEVOS::10}.tar.gz
|
|
25 |
vulkan? (
|
|
26 |
https://github.com/KhronosGroup/glslang/archive/${HASH_GLSLANG}.tar.gz
|
|
27 |
-> ${PN}-glslang-${HASH_GLSLANG::10}.tar.gz
|
|
28 |
https://github.com/KhronosGroup/Vulkan-Headers/archive/${HASH_VULKAN}.tar.gz
|
|
29 |
-> ${PN}-vulkan-headers-${HASH_VULKAN::10}.tar.gz
|
|
30 |
)
|
|
31 |
"
|
|
32 |
KEYWORDS="-* ~amd64"
|
|
33 |
fi
|
10 |
34 |
|
11 |
|
DESCRIPTION="A PlayStation 2 emulator"
|
|
35 |
DESCRIPTION="PlayStation 2 emulator"
|
12 |
36 |
HOMEPAGE="https://pcsx2.net/"
|
13 |
|
SRC_URI="https://github.com/PCSX2/${PN}/archive/v${MY_PV}.tar.gz -> ${P}.tar.gz"
|
14 |
37 |
|
15 |
|
LICENSE="GPL-3"
|
|
38 |
LICENSE="
|
|
39 |
GPL-3+ Apache-2.0 BSD BSD-2 BSD-4 Boost-1.0 CC0-1.0 GPL-2+
|
|
40 |
ISC LGPL-2.1+ LGPL-3+ MIT OFL-1.1 ZLIB public-domain
|
|
41 |
"
|
16 |
42 |
SLOT="0"
|
17 |
|
KEYWORDS="-* amd64 x86"
|
18 |
|
|
|
43 |
IUSE="alsa cpu_flags_x86_sse4_1 dbus jack pulseaudio sndio test vulkan wayland"
|
|
44 |
REQUIRED_USE="cpu_flags_x86_sse4_1" # dies at runtime if no support
|
|
45 |
RESTRICT="!test? ( test )"
|
|
46 |
|
|
47 |
# dlopen: qtsvg, vulkan-loader, wayland
|
|
48 |
COMMON_DEPEND="
|
|
49 |
app-arch/xz-utils
|
|
50 |
app-arch/zstd:=
|
|
51 |
dev-cpp/rapidyaml:=
|
|
52 |
dev-libs/libaio
|
|
53 |
dev-libs/libchdr
|
|
54 |
dev-libs/libzip:=[zstd]
|
|
55 |
dev-qt/qtbase:6[gui,network,widgets]
|
|
56 |
dev-qt/qtsvg:6
|
|
57 |
media-libs/libglvnd
|
|
58 |
media-libs/libpng:=
|
|
59 |
>=media-libs/libsdl2-2.0.22[haptic,joystick]
|
|
60 |
media-video/ffmpeg:=
|
|
61 |
net-libs/libpcap
|
|
62 |
net-misc/curl
|
|
63 |
sys-libs/zlib:=
|
|
64 |
virtual/libudev:=
|
|
65 |
x11-libs/libXrandr
|
|
66 |
alsa? ( media-libs/alsa-lib )
|
|
67 |
dbus? ( sys-apps/dbus )
|
|
68 |
jack? ( virtual/jack )
|
|
69 |
pulseaudio? ( media-libs/libpulse )
|
|
70 |
sndio? ( media-sound/sndio:= )
|
|
71 |
vulkan? ( media-libs/vulkan-loader )
|
|
72 |
wayland? ( dev-libs/wayland )
|
|
73 |
"
|
|
74 |
# patches is a optfeature but always pull given PCSX2 complaints if it
|
|
75 |
# is missing and it is fairly small (installs a ~1.5MB patches.zip)
|
19 |
76 |
RDEPEND="
|
20 |
|
app-arch/bzip2[abi_x86_32(-)]
|
21 |
|
app-arch/xz-utils[abi_x86_32(-)]
|
22 |
|
dev-libs/libaio[abi_x86_32(-)]
|
23 |
|
dev-libs/libxml2:2[abi_x86_32(-)]
|
24 |
|
media-libs/alsa-lib[abi_x86_32(-)]
|
25 |
|
media-libs/libpng:=[abi_x86_32(-)]
|
26 |
|
media-libs/libsdl2[abi_x86_32(-),haptic,joystick,sound]
|
27 |
|
media-libs/libsoundtouch[abi_x86_32(-)]
|
28 |
|
media-libs/portaudio[abi_x86_32(-)]
|
29 |
|
net-libs/libpcap[abi_x86_32(-)]
|
30 |
|
sys-libs/zlib[abi_x86_32(-)]
|
31 |
|
virtual/libudev[abi_x86_32(-)]
|
32 |
|
virtual/opengl[abi_x86_32(-)]
|
33 |
|
x11-libs/gtk+:3[abi_x86_32(-)]
|
34 |
|
x11-libs/libICE[abi_x86_32(-)]
|
35 |
|
x11-libs/libX11[abi_x86_32(-)]
|
36 |
|
x11-libs/libXext[abi_x86_32(-)]
|
37 |
|
x11-libs/wxGTK:${WX_GTK_VER}[abi_x86_32(-),X]
|
|
77 |
${COMMON_DEPEND}
|
|
78 |
<games-emulation/pcsx2_patches-0_p20230917
|
|
79 |
"
|
|
80 |
DEPEND="
|
|
81 |
${COMMON_DEPEND}
|
|
82 |
x11-base/xorg-proto
|
|
83 |
test? ( dev-cpp/gtest )
|
|
84 |
"
|
|
85 |
BDEPEND="
|
|
86 |
dev-qt/qttools:6[linguist]
|
|
87 |
wayland? (
|
|
88 |
dev-util/wayland-scanner
|
|
89 |
kde-frameworks/extra-cmake-modules
|
|
90 |
)
|
38 |
91 |
"
|
39 |
|
DEPEND="${RDEPEND}"
|
40 |
|
|
41 |
|
S="${WORKDIR}/${PN}-${MY_PV}"
|
42 |
92 |
|
43 |
93 |
FILECAPS=(
|
44 |
|
-m 755 "CAP_NET_RAW+eip CAP_NET_ADMIN+eip" usr/bin/PCSX2
|
|
94 |
-m 0755 "CAP_NET_RAW+eip CAP_NET_ADMIN+eip" usr/bin/pcsx2
|
45 |
95 |
)
|
46 |
96 |
|
47 |
97 |
PATCHES=(
|
48 |
|
"${FILESDIR}/${P}-disable-setcap.patch"
|
49 |
|
"${FILESDIR}/${P}-wx-config.patch"
|
|
98 |
"${FILESDIR}"/${PN}-1.7.3468-cubeb-automagic.patch
|
|
99 |
"${FILESDIR}"/${PN}-1.7.3773-lto.patch
|
|
100 |
"${FILESDIR}"/${PN}-1.7.4667-flags.patch
|
|
101 |
"${FILESDIR}"/${PN}-1.7.4667-system-chdr.patch
|
|
102 |
"${FILESDIR}"/${PN}-1.7.4667-system-gtest.patch
|
|
103 |
"${FILESDIR}"/${PN}-1.7.4667-system-zstd.patch
|
|
104 |
"${FILESDIR}"/${PN}-1.7.4795-rapidyaml-0.5.patch
|
50 |
105 |
)
|
51 |
106 |
|
52 |
|
pkg_setup() {
|
53 |
|
if [[ ${MERGE_TYPE} != binary && $(tc-getCC) == *gcc* ]]; then
|
54 |
|
# -mxsave flag is needed when GCC >= 8.2 is used
|
55 |
|
# https://bugs.gentoo.org/685156
|
56 |
|
append-flags -mxsave
|
|
107 |
src_unpack() {
|
|
108 |
if [[ ${PV} == 9999 ]]; then
|
|
109 |
local EGIT_SUBMODULES=(
|
|
110 |
# libfmt is volatile and upstream is unlikely to make fixes for
|
|
111 |
# latest system copy punctually (may revisit this eventually)
|
|
112 |
3rdparty/fmt/fmt
|
|
113 |
|
|
114 |
# has no build system and is not really setup for unbundling
|
|
115 |
3rdparty/rcheevos/rcheevos
|
|
116 |
|
|
117 |
# system rapidyaml is still used, but this uses another part
|
|
118 |
# of the source directly (fast_float) and so allow the submodule
|
|
119 |
# https://github.com/PCSX2/pcsx2/commit/af646e449
|
|
120 |
3rdparty/rapidyaml/rapidyaml
|
|
121 |
3rdparty/rapidyaml/rapidyaml/extern/c4core
|
|
122 |
3rdparty/rapidyaml/rapidyaml/ext/c4core/src/c4/ext/fast_float
|
|
123 |
|
|
124 |
# glslang can be troublesome to unbundle (bug #831217),
|
|
125 |
# also keep vulkan-headers to stay in sync
|
|
126 |
$(usev vulkan '
|
|
127 |
3rdparty/glslang/glslang
|
|
128 |
3rdparty/vulkan-headers
|
|
129 |
')
|
|
130 |
)
|
|
131 |
|
|
132 |
git-r3_src_unpack
|
|
133 |
else
|
|
134 |
default
|
|
135 |
|
|
136 |
mkdir -p "${S}"/3rdparty/rapidyaml/rapidyaml/ext/c4core/src/c4/ext || die
|
|
137 |
mv fast_float-${HASH_FASTFLOAT} \
|
|
138 |
"${S}"/3rdparty/rapidyaml/rapidyaml/ext/c4core/src/c4/ext/fast_float || die
|
|
139 |
|
|
140 |
rmdir "${S}"/3rdparty/fmt/fmt || die
|
|
141 |
mv fmt-${HASH_FMT} "${S}"/3rdparty/fmt/fmt || die
|
|
142 |
|
|
143 |
rmdir "${S}"/3rdparty/rcheevos/rcheevos || die
|
|
144 |
mv rcheevos-${HASH_RCHEEVOS} "${S}"/3rdparty/rcheevos/rcheevos || die
|
|
145 |
|
|
146 |
if use vulkan; then
|
|
147 |
rmdir "${S}"/3rdparty/{glslang/glslang,vulkan-headers} || die
|
|
148 |
mv glslang-${HASH_GLSLANG} "${S}"/3rdparty/glslang/glslang || die
|
|
149 |
mv Vulkan-Headers-${HASH_VULKAN} "${S}"/3rdparty/vulkan-headers || die
|
|
150 |
fi
|
|
151 |
fi
|
|
152 |
}
|
|
153 |
|
|
154 |
src_prepare() {
|
|
155 |
cmake_src_prepare
|
|
156 |
|
|
157 |
sed -e "/AppRoot =/s|=.*|= \"${EPREFIX}/usr/share/${PN}\";|" \
|
|
158 |
-i pcsx2/Pcsx2Config.cpp || die
|
|
159 |
|
|
160 |
if [[ ${PV} != 9999 ]]; then
|
|
161 |
sed -e '/set(PCSX2_GIT_TAG "")/s/""/"v'${PV}-gentoo'"/' \
|
|
162 |
-i cmake/Pcsx2Utils.cmake || die
|
|
163 |
|
|
164 |
# delete all 3rdparty/* except known-used ones in non-live
|
|
165 |
local keep=(
|
|
166 |
# TODO?: rapidjson and xbyak are packaged and could be unbundlable
|
|
167 |
# w/ patch, and discord-rpc be optional w/ dependency on rapidjson
|
|
168 |
cpuinfo cubeb demangler discord-rpc fmt glad imgui include jpgd
|
|
169 |
lzma rapidjson rapidyaml rcheevos simpleini soundtouch xbyak zydis
|
|
170 |
$(usev vulkan 'glslang vulkan-headers')
|
|
171 |
)
|
|
172 |
find 3rdparty -mindepth 1 -maxdepth 1 -type d \
|
|
173 |
-not \( -false ${keep[*]/#/-o -name } \) -exec rm -r {} + || die
|
57 |
174 |
fi
|
58 |
175 |
}
|
59 |
176 |
|
60 |
177 |
src_configure() {
|
61 |
|
multilib_toolchain_setup x86
|
62 |
|
# Build with ld.gold fails
|
63 |
|
# https://github.com/PCSX2/pcsx2/issues/1671
|
64 |
|
tc-ld-disable-gold
|
65 |
|
|
66 |
|
# pcsx2 build scripts will force CMAKE_BUILD_TYPE=Devel
|
67 |
|
# if it something other than "Devel|Debug|Release"
|
68 |
|
local CMAKE_BUILD_TYPE="Release"
|
|
178 |
if use vulkan; then
|
|
179 |
# for bundled glslang (bug #858374)
|
|
180 |
append-flags -fno-strict-aliasing
|
|
181 |
|
|
182 |
# odr violations in pcsx2's vulkan code, disabling as a safety for now
|
|
183 |
# (vulkan support tend to receive major changes, is more on WIP side)
|
|
184 |
filter-lto
|
|
185 |
fi
|
69 |
186 |
|
70 |
187 |
local mycmakeargs=(
|
71 |
|
-DARCH_FLAG=
|
72 |
|
-DDISABLE_BUILD_DATE=TRUE
|
73 |
|
-DDISABLE_PCSX2_WRAPPER=TRUE
|
74 |
|
-DDISABLE_SETCAP=TRUE
|
75 |
|
-DEXTRA_PLUGINS=FALSE
|
76 |
|
-DOPTIMIZATION_FLAG=
|
77 |
|
-DPACKAGE_MODE=TRUE
|
78 |
|
-DXDG_STD=TRUE
|
79 |
|
|
80 |
|
-DCMAKE_LIBRARY_PATH="/usr/$(get_libdir)/${PN}"
|
81 |
|
-DDOC_DIR=/usr/share/doc/"${PF}"
|
82 |
|
-DEGL_API=FALSE
|
83 |
|
-DGTK3_API=TRUE
|
84 |
|
-DOPENCL_API=FALSE
|
85 |
|
-DPLUGIN_DIR="/usr/$(get_libdir)/${PN}"
|
86 |
|
# wxGTK must be built against same sdl version
|
87 |
|
-DSDL2_API=TRUE
|
88 |
|
-DUSE_VTUNE=FALSE
|
89 |
|
|
90 |
|
# mimic old toolchain file behavior (bug #833100 comment #20)
|
91 |
|
-DCMAKE_SYSTEM_IGNORE_PATH="${ESYSROOT}"/usr/lib64
|
|
188 |
-DBUILD_SHARED_LIBS=no
|
|
189 |
-DDBUS_API=$(usex dbus)
|
|
190 |
-DDISABLE_BUILD_DATE=yes
|
|
191 |
-DENABLE_TESTS=$(usex test)
|
|
192 |
-DUSE_LINKED_FFMPEG=yes
|
|
193 |
-DUSE_VTUNE=no
|
|
194 |
-DUSE_VULKAN=$(usex vulkan)
|
|
195 |
-DWAYLAND_API=$(usex wayland)
|
|
196 |
-DX11_API=yes # fails if X libs are missing even if disabled
|
|
197 |
|
|
198 |
# note that the current upstream is somewhat hostile to using system
|
|
199 |
# libs, system installs, or any modifications and may disregard any
|
|
200 |
# bugs that is not reproducible with the appimage using bundled libs
|
|
201 |
-DUSE_SYSTEM_LIBS=yes
|
|
202 |
-DUSE_SYSTEM_FMT=no # volatile, keep bundled at least "for now"
|
|
203 |
|
|
204 |
# sse4.1 is the bare minimum required, -m is required at build time
|
|
205 |
# (see PCSX2Base.h) and it dies if no support at runtime (AppInit.cpp)
|
|
206 |
# https://github.com/PCSX2/pcsx2/pull/4329
|
|
207 |
-DARCH_FLAG=-msse4.1
|
|
208 |
|
|
209 |
# not packaged due to bug #885471, but still disable for no automagic
|
|
210 |
-DCMAKE_DISABLE_FIND_PACKAGE_Libbacktrace=yes
|
|
211 |
|
|
212 |
# bundled cubeb flags, see media-libs/cubeb and cubeb-automagic.patch
|
|
213 |
-DCHECK_ALSA=$(usex alsa)
|
|
214 |
-DCHECK_JACK=$(usex jack)
|
|
215 |
-DCHECK_PULSE=$(usex pulseaudio)
|
|
216 |
-DCHECK_SNDIO=$(usex sndio)
|
|
217 |
-DLAZY_LOAD_LIBS=no
|
92 |
218 |
)
|
93 |
219 |
|
94 |
|
setup-wxwidgets
|
95 |
220 |
cmake_src_configure
|
96 |
221 |
}
|
97 |
222 |
|
|
223 |
src_test() {
|
|
224 |
cmake_build unittests
|
|
225 |
}
|
|
226 |
|
98 |
227 |
src_install() {
|
99 |
|
# Upstream issues:
|
100 |
|
# https://github.com/PCSX2/pcsx2/issues/417
|
101 |
|
# https://github.com/PCSX2/pcsx2/issues/3077
|
102 |
|
QA_EXECSTACK="usr/bin/PCSX2"
|
103 |
|
QA_TEXTRELS="usr/$(get_libdir)/pcsx2/* usr/bin/PCSX2"
|
104 |
|
cmake_src_install
|
|
228 |
newbin "${BUILD_DIR}"/bin/pcsx2-qt ${PN}
|
|
229 |
|
|
230 |
insinto /usr/share/${PN}
|
|
231 |
doins -r "${BUILD_DIR}"/bin/resources
|
|
232 |
|
|
233 |
dodoc README.md bin/docs/{Debugger.pdf,GameIndex.pdf,debugger.txt}
|
|
234 |
|
|
235 |
newicon bin/resources/icons/AppIconLarge.png ${PN}.png
|
|
236 |
make_desktop_entry ${PN} ${PN^^}
|
|
237 |
}
|
|
238 |
|
|
239 |
pkg_postinst() {
|
|
240 |
fcaps_pkg_postinst
|
|
241 |
|
|
242 |
local replacing=
|
|
243 |
if [[ ${REPLACING_VERSIONS##* } ]]; then
|
|
244 |
if ver_test ${REPLACING_VERSIONS##* } -lt 1.6.1; then
|
|
245 |
replacing=old
|
|
246 |
elif ver_test ${REPLACING_VERSIONS##* } -lt 1.7.3773; then
|
|
247 |
replacing=wx
|
|
248 |
else
|
|
249 |
replacing=any
|
|
250 |
fi
|
|
251 |
fi
|
|
252 |
|
|
253 |
if [[ ${replacing} == old ]]; then
|
|
254 |
elog
|
|
255 |
elog ">=${PN}-1.7 has received several changes since <=${PN}-1.6.0, notably"
|
|
256 |
elog "it is now a 64bit build using Qt6. Just-in-case it is recommended to"
|
|
257 |
elog "backup your configs, save states, and memory cards before use."
|
|
258 |
elog "The executable was also renamed from 'PCSX2' to 'pcsx2'."
|
|
259 |
fi
|
|
260 |
|
|
261 |
if [[ ${replacing} == @(|old) && ${PV} != 9999 ]]; then
|
|
262 |
elog
|
|
263 |
elog "${PN}-1.7.x is a development branch where .x increments every changes."
|
|
264 |
elog "Stable 1.6.0 is getting old and lacks many notable features (e.g. native"
|
|
265 |
elog "64bit builds). Given it may be a long time before there is a new stable,"
|
|
266 |
elog "Gentoo will carry and update 1.7.x roughly every months."
|
|
267 |
elog
|
|
268 |
elog "Please report an issue if feel a picked version needs to be updated ahead"
|
|
269 |
elog "of time or masked (notably for handling regressions)."
|
|
270 |
fi
|
|
271 |
|
|
272 |
if [[ ${replacing} == wx ]]; then
|
|
273 |
ewarn
|
|
274 |
ewarn "Note that wxGTK support been dropped upstream since >=${PN}-1.7.3773,"
|
|
275 |
ewarn "and so USE=qt6 is gone and Qt6 is now always used."
|
|
276 |
fi
|
105 |
277 |
}
|