games-emulation/shadPS4: cmake 4 compatibility, lto fix, build time

faliure fix

added patch to fix cmake 4 compatibility warnings

filtered lto flags as they cause strict aaliasing errors (which i do not
know enough cpp to fix myself)

patch to fix a build time faliure caused by SDL3 renaming functions

Closes: https://bugs.gentoo.org/975060
Signed-off-by: Ceres <ceres@ceressees.dev>
This commit is contained in:
Ceres
2026-05-18 16:52:14 +01:00
parent 30db1f6872
commit 0138768004
3 changed files with 133 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
Fix a build time bug caused by SDL3 renaming functions
From: https://github.com/Seme30/shadPS4/commit/e00f726be75218201243639b3bea5de77f315191
Upstream Bug: https://github.com/shadps4-emu/shadPS4/issues/4112
--- a/src/core/libraries/np/trophy_ui.cpp
+++ b/src/core/libraries/np/trophy_ui.cpp
@@ -98,7 +98,7 @@
return;
}
- MIX_SetMasterGain(mixer, static_cast<float>(Config::getVolumeSlider() / 100.f));
+ MIX_SetMixerGain(mixer, static_cast<float>(Config::getVolumeSlider() / 100.f));
auto musicPathMp3 = CustomTrophy_Dir / "trophy.mp3";
auto musicPathWav = CustomTrophy_Dir / "trophy.wav";
@@ -112,7 +112,7 @@
audio =
MIX_LoadAudio_IO(mixer, SDL_IOFromMem(soundData.data(), soundData.size()), false, true);
// due to low volume of default sound file
- MIX_SetMasterGain(mixer, MIX_GetMasterGain(mixer) * 1.3f);
+ MIX_SetMixerGain(mixer, MIX_GetMixerGain(mixer) * 1.3f);
}
if (!audio) {

View File

@@ -0,0 +1,102 @@
Fix CMake 4 Compatibility
--- a/externals/dear_imgui/examples/example_android_opengl3/CMakeLists.txt
+++ b/externals/dear_imgui/examples/example_android_opengl3/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.6)
+cmake_minimum_required(VERSION 3.10)
project(ImGuiExample)
--- a/externals/dear_imgui/examples/example_glfw_vulkan/CMakeLists.txt
+++ b/externals/dear_imgui/examples/example_glfw_vulkan/CMakeLists.txt
@@ -3,7 +3,7 @@
# cd build
# cmake -g "Visual Studio 14 2015" ..
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.10)
project(imgui_example_glfw_vulkan C CXX)
if(NOT CMAKE_BUILD_TYPE)
--- a/externals/discord-rpc/thirdparty/rapidjson/CMakeLists.txt
+++ b/externals/discord-rpc/thirdparty/rapidjson/CMakeLists.txt
@@ -1,4 +1,4 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules)
--- a/externals/discord-rpc/thirdparty/rapidjson/example/CMakeLists.txt
+++ b/externals/discord-rpc/thirdparty/rapidjson/example/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.8)
+cmake_minimum_required(VERSION 3.10)
if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
--- a/externals/discord-rpc/thirdparty/rapidjson/thirdparty/gtest/CMakeLists.txt
+++ b/externals/discord-rpc/thirdparty/rapidjson/thirdparty/gtest/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 2.6.4)
+cmake_minimum_required(VERSION 3.10)
if (POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
--- a/externals/discord-rpc/thirdparty/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt
+++ b/externals/discord-rpc/thirdparty/rapidjson/thirdparty/gtest/googlemock/CMakeLists.txt
@@ -43,7 +43,7 @@
cmake_policy(SET CMP0048 NEW)
project(gmock VERSION 1.9.0 LANGUAGES CXX C)
endif()
-cmake_minimum_required(VERSION 2.6.4)
+cmake_minimum_required(VERSION 3.10)
if (COMMAND set_up_hermetic_build)
set_up_hermetic_build()
--- a/externals/discord-rpc/thirdparty/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt
+++ b/externals/discord-rpc/thirdparty/rapidjson/thirdparty/gtest/googletest/CMakeLists.txt
@@ -50,7 +50,7 @@
cmake_policy(SET CMP0048 NEW)
project(gtest VERSION 1.9.0 LANGUAGES CXX C)
endif()
-cmake_minimum_required(VERSION 2.6.4)
+cmake_minimum_required(VERSION 3.10)
if (POLICY CMP0063) # Visibility
cmake_policy(SET CMP0063 NEW)
--- a/externals/sirit/externals/SPIRV-Headers/tests/find_package/CMakeLists.txt
+++ b/externals/sirit/externals/SPIRV-Headers/tests/find_package/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.10)
project(TEST_FIND_PACKAGE LANGUAGES CXX)
--- a/externals/sirit/externals/SPIRV-Headers/tools/buildHeaders/CMakeLists.txt
+++ b/externals/sirit/externals/SPIRV-Headers/tools/buildHeaders/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.10)
set(CMAKE_INSTALL_PREFIX "install" CACHE STRING "prefix" FORCE)
--- a/externals/zydis/CMakeLists.txt
+++ b/externals/zydis/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
# Enable runtime library selection via CMAKE_MSVC_RUNTIME_LIBRARY
--- a/externals/zydis/dependencies/zycore/CMakeLists.txt
+++ b/externals/zydis/dependencies/zycore/CMakeLists.txt
@@ -2,7 +2,7 @@
return()
endif ()
-cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
# Enable runtime library selection via CMAKE_MSVC_RUNTIME_LIBRARY

View File

@@ -3,7 +3,7 @@
EAPI=8
inherit cmake
inherit cmake flag-o-matic
DESCRIPTION="PlayStation 4 emulator written in C++"
HOMEPAGE="https://shadps4.net"
@@ -45,12 +45,17 @@ DEPEND="
RDEPEND="${DEPEND}"
src_prepare() {
eapply "${FILESDIR}/shadPS4-0.15.0-executable-stack.patch"
eapply "${FILESDIR}/${P}-SDL3-rename.patch"
eapply "${FILESDIR}/${P}-cmake-4.patch"
eapply "${FILESDIR}/${P}-executable-stack.patch"
mv src/core/libraries/fiber/fiber_context.s src/core/libraries/fiber/fiber_context.S || die
cmake_src_prepare
}
src_configure() {
filter-lto
append-flags -fno-strict-aliasing
local mycmakeargs=(
-DENABLE_DISCORD_RPC="$(usex discord ON OFF)"
-DENABLE_UPDATER=OFF