mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
cubeb: 0-unstable-2025-04-02 -> 0-unstable-2025-05-29
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
This commit is contained in:
parent
01a88a33bb
commit
609a05a994
8 changed files with 25 additions and 293 deletions
|
@ -1,208 +0,0 @@
|
|||
From e0cbc1049b9a3a3322cd48d32af148f87d5007c2 Mon Sep 17 00:00:00 2001
|
||||
From: Marcin Serwin <marcin@serwin.dev>
|
||||
Date: Mon, 19 May 2025 22:36:53 +0200
|
||||
Subject: [PATCH] cmake: add pkg-config file generation
|
||||
|
||||
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
|
||||
---
|
||||
CMakeLists.txt | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
libcubeb.pc.in | 12 ++++++++++++
|
||||
2 files changed, 62 insertions(+)
|
||||
create mode 100644 libcubeb.pc.in
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 07618fa..6470837 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -23,6 +23,17 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
||||
endif()
|
||||
|
||||
+set(private_requires)
|
||||
+set(private_libs)
|
||||
+set(private_libs_flags)
|
||||
+if(UNIX AND NOT APPLE)
|
||||
+ if(BSD OR ANDROID)
|
||||
+ list(APPEND private_libs c++)
|
||||
+ else()
|
||||
+ list(APPEND private_libs stdc++)
|
||||
+ endif()
|
||||
+endif()
|
||||
+
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
@@ -141,6 +152,7 @@ if(NOT BUNDLE_SPEEX)
|
||||
pkg_check_modules(speexdsp IMPORTED_TARGET speexdsp)
|
||||
if(speexdsp_FOUND)
|
||||
add_library(speex ALIAS PkgConfig::speexdsp)
|
||||
+ list(APPEND private_requires speexdsp)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -155,6 +167,7 @@ if(NOT TARGET speex)
|
||||
EXPORT=
|
||||
RANDOM_PREFIX=speex
|
||||
)
|
||||
+ list(APPEND private_libs speex)
|
||||
endif()
|
||||
|
||||
# $<BUILD_INTERFACE:> required because of https://gitlab.kitware.com/cmake/cmake/-/issues/15415
|
||||
@@ -166,6 +179,7 @@ include(CheckIncludeFiles)
|
||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||
find_package(Threads)
|
||||
target_link_libraries(cubeb PRIVATE Threads::Threads)
|
||||
+list(APPEND private_libs ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
if(LAZY_LOAD_LIBS)
|
||||
check_include_files(pulse/pulseaudio.h USE_PULSE)
|
||||
@@ -176,6 +190,7 @@ if(LAZY_LOAD_LIBS)
|
||||
|
||||
if(USE_PULSE OR USE_ALSA OR USE_JACK OR USE_SNDIO OR USE_AAUDIO)
|
||||
target_link_libraries(cubeb PRIVATE ${CMAKE_DL_LIBS})
|
||||
+ list(APPEND private_libs ${CMAKE_DL_LIBS})
|
||||
|
||||
if(ANDROID)
|
||||
target_compile_definitions(cubeb PRIVATE __ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__)
|
||||
@@ -191,6 +206,7 @@ else()
|
||||
set(USE_PULSE ON)
|
||||
target_compile_definitions(cubeb PRIVATE DISABLE_LIBPULSE_DLOPEN)
|
||||
target_link_libraries(cubeb PRIVATE PkgConfig::libpulse)
|
||||
+ list(APPEND private_requires libpulse)
|
||||
endif()
|
||||
|
||||
pkg_check_modules(alsa IMPORTED_TARGET alsa)
|
||||
@@ -198,6 +214,7 @@ else()
|
||||
set(USE_ALSA ON)
|
||||
target_compile_definitions(cubeb PRIVATE DISABLE_LIBASOUND_DLOPEN)
|
||||
target_link_libraries(cubeb PRIVATE PkgConfig::alsa)
|
||||
+ list(APPEND private_requires alsa)
|
||||
endif()
|
||||
|
||||
pkg_check_modules(jack IMPORTED_TARGET jack)
|
||||
@@ -205,18 +222,21 @@ else()
|
||||
set(USE_JACK ON)
|
||||
target_compile_definitions(cubeb PRIVATE DISABLE_LIBJACK_DLOPEN)
|
||||
target_link_libraries(cubeb PRIVATE PkgConfig::jack)
|
||||
+ list(APPEND private_requires jack)
|
||||
endif()
|
||||
|
||||
check_include_files(sndio.h USE_SNDIO)
|
||||
if(USE_SNDIO)
|
||||
target_compile_definitions(cubeb PRIVATE DISABLE_LIBSNDIO_DLOPEN)
|
||||
target_link_libraries(cubeb PRIVATE sndio)
|
||||
+ list(APPEND private_libs sndio)
|
||||
endif()
|
||||
|
||||
check_include_files(aaudio/AAudio.h USE_AAUDIO)
|
||||
if(USE_AAUDIO)
|
||||
target_compile_definitions(cubeb PRIVATE DISABLE_LIBAAUDIO_DLOPEN)
|
||||
target_link_libraries(cubeb PRIVATE aaudio)
|
||||
+ list(APPEND private_libs aaudio)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -263,6 +283,7 @@ if(USE_AUDIOUNIT)
|
||||
src/cubeb_osx_run_loop.cpp)
|
||||
target_compile_definitions(cubeb PRIVATE USE_AUDIOUNIT)
|
||||
target_link_libraries(cubeb PRIVATE "-framework AudioUnit" "-framework CoreAudio" "-framework CoreServices")
|
||||
+ list(APPEND private_libs_flags "-framework AudioUnit" "-framework CoreAudio" "-framework CoreServices")
|
||||
endif()
|
||||
|
||||
check_include_files(audioclient.h USE_WASAPI)
|
||||
@@ -271,6 +292,7 @@ if(USE_WASAPI)
|
||||
src/cubeb_wasapi.cpp)
|
||||
target_compile_definitions(cubeb PRIVATE USE_WASAPI)
|
||||
target_link_libraries(cubeb PRIVATE avrt ole32 ksuser)
|
||||
+ list(APPEND private_libs avrt ole32 ksuser)
|
||||
endif()
|
||||
|
||||
check_include_files("windows.h;mmsystem.h" USE_WINMM)
|
||||
@@ -279,6 +301,7 @@ if(USE_WINMM)
|
||||
src/cubeb_winmm.c)
|
||||
target_compile_definitions(cubeb PRIVATE USE_WINMM)
|
||||
target_link_libraries(cubeb PRIVATE winmm)
|
||||
+ list(APPEND private_libs winmm)
|
||||
endif()
|
||||
|
||||
check_include_files(SLES/OpenSLES.h USE_OPENSL)
|
||||
@@ -288,6 +311,7 @@ if(USE_OPENSL)
|
||||
src/cubeb-jni.cpp)
|
||||
target_compile_definitions(cubeb PRIVATE USE_OPENSL)
|
||||
target_link_libraries(cubeb PRIVATE OpenSLES)
|
||||
+ list(APPEND private_libs OpenSLES)
|
||||
endif()
|
||||
|
||||
check_include_files(sys/soundcard.h HAVE_SYS_SOUNDCARD_H)
|
||||
@@ -303,6 +327,7 @@ if(HAVE_SYS_SOUNDCARD_H)
|
||||
pkg_check_modules(libbsd-overlay IMPORTED_TARGET libbsd-overlay)
|
||||
if(libbsd-overlay_FOUND)
|
||||
target_link_libraries(cubeb PRIVATE PkgConfig::libbsd-overlay)
|
||||
+ list(APPEND private_requires libbsd-overlay)
|
||||
set(HAVE_STRLCPY true)
|
||||
endif()
|
||||
endif()
|
||||
@@ -320,6 +345,7 @@ if(USE_AUDIOTRACK)
|
||||
src/cubeb_audiotrack.c)
|
||||
target_compile_definitions(cubeb PRIVATE USE_AUDIOTRACK)
|
||||
target_link_libraries(cubeb PRIVATE log)
|
||||
+ list(APPEND private_libs log)
|
||||
endif()
|
||||
|
||||
check_include_files(sys/audioio.h USE_SUN)
|
||||
@@ -335,6 +361,7 @@ if(USE_KAI)
|
||||
src/cubeb_kai.c)
|
||||
target_compile_definitions(cubeb PRIVATE USE_KAI)
|
||||
target_link_libraries(cubeb PRIVATE kai)
|
||||
+ list(APPEND private_libs kai)
|
||||
endif()
|
||||
|
||||
if(USE_PULSE AND USE_PULSE_RUST)
|
||||
@@ -452,3 +479,26 @@ add_custom_target(clang-format-check
|
||||
| xargs -0 ${CLANG_FORMAT_BINARY} -Werror -n
|
||||
COMMENT "Check formatting with clang-format"
|
||||
VERBATIM)
|
||||
+
|
||||
+
|
||||
+list(TRANSFORM private_libs PREPEND "-l")
|
||||
+string(JOIN " " CUBEB_PC_PRIVATE_LIBS ${private_libs} ${private_libs_flags})
|
||||
+
|
||||
+string(JOIN " " CUBEB_PC_PRIVATE_REQUIRES ${private_requires})
|
||||
+
|
||||
+if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
+ set(CUBEB_PC_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
+else()
|
||||
+ set(CUBEB_PC_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
|
||||
+endif()
|
||||
+if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
|
||||
+ set(CUBEB_PC_LIBDIR "${CMAKE_INSTALL_LIBDIR}")
|
||||
+else()
|
||||
+ set(CUBEB_PC_LIBDIR "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
|
||||
+endif()
|
||||
+
|
||||
+configure_file(libcubeb.pc.in libcubeb.pc @ONLY)
|
||||
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libcubeb.pc"
|
||||
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
||||
+)
|
||||
+
|
||||
diff --git a/libcubeb.pc.in b/libcubeb.pc.in
|
||||
new file mode 100644
|
||||
index 0000000..2310ae6
|
||||
--- /dev/null
|
||||
+++ b/libcubeb.pc.in
|
||||
@@ -0,0 +1,12 @@
|
||||
+prefix=@CMAKE_INSTALL_PREFIX@
|
||||
+exec_prefix=${prefix}
|
||||
+libdir=@CUBEB_PC_LIBDIR@
|
||||
+includedir=@CUBEB_PC_INCLUDEDIR@
|
||||
+
|
||||
+Name: libcubeb
|
||||
+Description: Cross platform audio library
|
||||
+Version: @PROJECT_VERSION@
|
||||
+Requires.private: @CUBEB_PC_PRIVATE_REQUIRES@
|
||||
+Libs: -L${libdir} -lcubeb
|
||||
+Libs.private: @CUBEB_PC_PRIVATE_LIBS@
|
||||
+Cflags: -I${includedir}
|
||||
--
|
||||
2.49.0
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
From 4f8dff52e99bdd70d07d7cb47d357bb91dc5f1a9 Mon Sep 17 00:00:00 2001
|
||||
From: Marcin Serwin <marcin@serwin.dev>
|
||||
Date: Sat, 24 May 2025 16:20:51 +0200
|
||||
Subject: [PATCH] cmake: don't hardcode "include" as the includedir
|
||||
|
||||
When the default CMAKE_INSTALL_INCLUDEDIR is changed
|
||||
headers are installed to a different location, however, the
|
||||
INTERFACE_INCLUDE_DIRECTORIES in exported cmake configuration still
|
||||
point to <prefix>/include.
|
||||
|
||||
Signed-off-by: Marcin Serwin <marcin@serwin.dev>
|
||||
---
|
||||
CMakeLists.txt | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 07618fa..bdf2212 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -91,7 +91,7 @@ add_library(cubeb
|
||||
src/cubeb_utils.cpp
|
||||
)
|
||||
target_include_directories(cubeb
|
||||
- PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>
|
||||
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
set_target_properties(cubeb PROPERTIES
|
||||
VERSION ${cubeb_VERSION}
|
||||
--
|
||||
2.49.0
|
||||
|
|
@ -14,8 +14,6 @@
|
|||
|
||||
# passthru.tests
|
||||
testers,
|
||||
pcsx2,
|
||||
duckstation,
|
||||
|
||||
alsaSupport ? !stdenv.hostPlatform.isDarwin,
|
||||
pulseSupport ? !stdenv.hostPlatform.isDarwin,
|
||||
|
@ -26,13 +24,13 @@
|
|||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "cubeb";
|
||||
version = "0-unstable-2025-04-02";
|
||||
version = "0-unstable-2025-05-29";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "mozilla";
|
||||
repo = "cubeb";
|
||||
rev = "975a727e5e308a04cfb9ecdf7ddaf1150ea3f733";
|
||||
hash = "sha256-3IP++tdiJUwXR6t5mf/MkPd524K/LYESNMkQ8vy10jo=";
|
||||
rev = "78ee5f0efaaa395e3e1806e8ef85dcb15c7c063d";
|
||||
hash = "sha256-PsBlZQTPiBt8Y3okFOZYhiFn58adxVlaf/hLA0doX0o=";
|
||||
};
|
||||
|
||||
outputs = [
|
||||
|
@ -56,14 +54,6 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
++ lib.optional pulseSupport libpulseaudio
|
||||
++ lib.optional sndioSupport sndio;
|
||||
|
||||
patches = [
|
||||
# https://github.com/mozilla/cubeb/pull/813
|
||||
./0001-cmake-add-pkg-config-file-generation.patch
|
||||
|
||||
# https://github.com/mozilla/cubeb/pull/814
|
||||
./0001-cmake-don-t-hardcode-include-as-the-includedir.patch
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
(lib.cmakeBool "BUILD_SHARED_LIBS" enableShared)
|
||||
(lib.cmakeBool "BUILD_TESTS" false) # tests require an audio server
|
||||
|
@ -76,12 +66,7 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
|
||||
passthru = {
|
||||
updateScript = unstableGitUpdater { hardcodeZeroVersion = true; };
|
||||
|
||||
tests = {
|
||||
# These packages depend on a patched version of cubeb
|
||||
inherit pcsx2 duckstation;
|
||||
pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
||||
};
|
||||
tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
callPackage,
|
||||
cmake,
|
||||
cpuinfo,
|
||||
cubeb,
|
||||
curl,
|
||||
extra-cmake-modules,
|
||||
libXrandr,
|
||||
|
@ -56,7 +57,7 @@ llvmPackages.stdenv.mkDerivation (finalAttrs: {
|
|||
buildInputs = [
|
||||
SDL2
|
||||
cpuinfo
|
||||
sources.cubeb
|
||||
cubeb
|
||||
curl
|
||||
libXrandr
|
||||
libbacktrace
|
||||
|
|
|
@ -15,15 +15,19 @@ index af35687..8347825 100644
|
|||
disable_compiler_warnings_for_target(kissfft)
|
||||
|
||||
diff --git a/src/util/cubeb_audio_stream.cpp b/src/util/cubeb_audio_stream.cpp
|
||||
index 85579c4..526d168 100644
|
||||
index 85579c4..339190a 100644
|
||||
--- a/src/util/cubeb_audio_stream.cpp
|
||||
+++ b/src/util/cubeb_audio_stream.cpp
|
||||
@@ -261,7 +261,7 @@ std::vector<std::pair<std::string, std::string>> AudioStream::GetCubebDriverName
|
||||
@@ -261,9 +261,9 @@ 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]);
|
||||
- for (u32 i = 0; cubeb_names[i] != nullptr; i++)
|
||||
- names.emplace_back(cubeb_names[i], cubeb_names[i]);
|
||||
+ cubeb_backend_names backends = cubeb_get_backend_names();
|
||||
+ for (u32 i = 0; i < backends.count; i++)
|
||||
+ names.emplace_back(backends.names[i], backends.names[i]);
|
||||
return names;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
stdenv,
|
||||
cmake,
|
||||
ninja,
|
||||
cubeb,
|
||||
}:
|
||||
|
||||
{
|
||||
|
@ -164,15 +163,4 @@
|
|||
platforms = lib.platforms.linux;
|
||||
};
|
||||
});
|
||||
|
||||
cubeb = cubeb.overrideAttrs (old: {
|
||||
pname = "cubeb-patched-for-duckstation";
|
||||
patches = (old.patches or [ ]) ++ [
|
||||
(fetchpatch {
|
||||
url = "https://github.com/PCSX2/pcsx2/commit/430e31abe4a9e09567cb542f1416b011bb9b6ef9.patch";
|
||||
stripLen = 2;
|
||||
hash = "sha256-bbH0c1X3lMeX6hfNKObhcq5xraFpicFV3mODQGYudvQ=";
|
||||
})
|
||||
];
|
||||
});
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
wayland,
|
||||
zip,
|
||||
zstd,
|
||||
fetchpatch,
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -37,16 +36,6 @@ 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;
|
||||
|
@ -93,7 +82,7 @@ llvmPackages.stdenv.mkDerivation (finalAttrs: {
|
|||
vulkan-headers
|
||||
wayland
|
||||
zstd
|
||||
cubeb'
|
||||
cubeb
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
|
|
|
@ -15,15 +15,19 @@ index ff66f9c..e177c90 100644
|
|||
# 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
|
||||
index 4cd9993..74c2f5a 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
|
||||
@@ -288,9 +288,9 @@ 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]);
|
||||
- for (u32 i = 0; cubeb_names[i] != nullptr; i++)
|
||||
- names.emplace_back(cubeb_names[i], cubeb_names[i]);
|
||||
+ cubeb_backend_names backends = cubeb_get_backend_names();
|
||||
+ for (u32 i = 0; i < backends.count; i++)
|
||||
+ names.emplace_back(backends.names[i], backends.names[i]);
|
||||
|
||||
return names;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue