gentoo-ebuilds/games-emulation/pcsx2/files/pcsx2-1.7.5913-musl-cache.patch
Ionen Wolkens 1109347a0b
games-emulation/pcsx2: fix build with musl
Originally thought would only need _GNU_SOURCE, but there is a bit
more to the fix 7zip upstream did in bug #928730. Could still patch
but can go for the easy solution which will use neither cpu_set_t
nor (more importantly) pthread_attr_setaffinity_np that musl lacks.

Also fix a different musl issue only affecting >=pcsx2-1.7.5913,
workaround imported from Chimera Linux.

Closes: https://bugs.gentoo.org/935298
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
2024-07-02 01:17:04 -04:00

20 lines
646 B
Diff

Patch adapted from [1]:
musl doesn't expose these sysconf values, so just use the loop
below that reads them out of sysfs coherency_line_size only
[1] https://github.com/chimera-linux/cports/blob/114b576aee3ebc25b48ac120da1a1093dcc4365f/user/pcsx2/patches/cache.patch
--- a/common/Linux/LnxHostSys.cpp
+++ b/common/Linux/LnxHostSys.cpp
@@ -143,7 +143,11 @@
size_t HostSys::GetRuntimeCacheLineSize()
{
+ #if defined(__GLIBC__)
int l1i = sysconf(_SC_LEVEL1_DCACHE_LINESIZE);
int l1d = sysconf(_SC_LEVEL1_ICACHE_LINESIZE);
int res = (l1i > l1d) ? l1i : l1d;
+ #else
+ int res = 0;
+ #endif
for (int index = 0; index < 16; index++)
{