pcsx2: use cubeb from nixpkgs

Signed-off-by: Marcin Serwin <marcin@serwin.dev>
This commit is contained in:
Marcin Serwin
2025-05-25 10:16:55 +02:00
parent ec5887903e
commit 9d9fc4258d
2 changed files with 48 additions and 8 deletions
+19 -8
View File
@@ -25,6 +25,7 @@
wayland,
zip,
zstd,
fetchpatch,
}:
let
@@ -36,6 +37,16 @@ let
qtwayland
wrapQtAppsHook
;
cubeb' = cubeb.overrideAttrs (old: {
patches = (old.patches or [ ]) ++ [
(fetchpatch {
url = "https://github.com/PCSX2/pcsx2/commit/430e31abe4a9e09567cb542f1416b011bb9b6ef9.patch";
stripLen = 2;
hash = "sha256-bbH0c1X3lMeX6hfNKObhcq5xraFpicFV3mODQGYudvQ=";
})
];
});
in
llvmPackages.stdenv.mkDerivation (finalAttrs: {
inherit (sources.pcsx2) pname version src;
@@ -43,6 +54,8 @@ llvmPackages.stdenv.mkDerivation (finalAttrs: {
patches = [
# Remove PCSX2_GIT_REV
./0000-define-rev.patch
./remove-cubeb-vendor.patch
];
cmakeFlags = [
@@ -80,7 +93,8 @@ llvmPackages.stdenv.mkDerivation (finalAttrs: {
vulkan-headers
wayland
zstd
] ++ cubeb.passthru.backendLibs;
cubeb'
];
strictDeps = true;
@@ -94,13 +108,10 @@ llvmPackages.stdenv.mkDerivation (finalAttrs: {
qtWrapperArgs =
let
libs = lib.makeLibraryPath (
[
vulkan-loader
shaderc
]
++ cubeb.passthru.backendLibs
);
libs = lib.makeLibraryPath ([
vulkan-loader
shaderc
]);
in
[ "--prefix LD_LIBRARY_PATH : ${libs}" ];
@@ -0,0 +1,29 @@
diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake
index ff66f9c..e177c90 100644
--- a/cmake/SearchForStuff.cmake
+++ b/cmake/SearchForStuff.cmake
@@ -100,9 +100,8 @@ if(USE_VULKAN)
add_subdirectory(3rdparty/vulkan EXCLUDE_FROM_ALL)
endif()
-add_subdirectory(3rdparty/cubeb EXCLUDE_FROM_ALL)
-disable_compiler_warnings_for_target(cubeb)
-disable_compiler_warnings_for_target(speex)
+find_package(cubeb REQUIRED GLOBAL)
+add_library(cubeb ALIAS cubeb::cubeb)
# Find the Qt components that we need.
find_package(Qt6 6.7.2 COMPONENTS CoreTools Core GuiTools Gui WidgetsTools Widgets LinguistTools REQUIRED)
diff --git a/pcsx2/Host/CubebAudioStream.cpp b/pcsx2/Host/CubebAudioStream.cpp
index 4cd9993..604635d 100644
--- a/pcsx2/Host/CubebAudioStream.cpp
+++ b/pcsx2/Host/CubebAudioStream.cpp
@@ -288,7 +288,7 @@ std::vector<std::pair<std::string, std::string>> AudioStream::GetCubebDriverName
std::vector<std::pair<std::string, std::string>> names;
names.emplace_back(std::string(), TRANSLATE_STR("AudioStream", "Default"));
- const char** cubeb_names = cubeb_get_backend_names();
+ const char* const* cubeb_names = cubeb_get_backend_names();
for (u32 i = 0; cubeb_names[i] != nullptr; i++)
names.emplace_back(cubeb_names[i], cubeb_names[i]);