mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 03:23:29 +03:00
cubeb: add myself to maintainers and make more cusomizable, signal-desktop.ringrtc: use cubeb from nixpkgs (#408510)
This commit is contained in:
commit
10b6dbe0f1
3 changed files with 67 additions and 17 deletions
|
@ -10,6 +10,11 @@
|
|||
sndio,
|
||||
speexdsp,
|
||||
lazyLoad ? !stdenv.hostPlatform.isDarwin,
|
||||
alsaSupport ? !stdenv.hostPlatform.isDarwin,
|
||||
pulseSupport ? !stdenv.hostPlatform.isDarwin,
|
||||
jackSupport ? !stdenv.hostPlatform.isDarwin,
|
||||
sndioSupport ? !stdenv.hostPlatform.isDarwin,
|
||||
buildSharedLibs ? true,
|
||||
}:
|
||||
|
||||
assert lib.assertMsg (
|
||||
|
@ -17,12 +22,11 @@ assert lib.assertMsg (
|
|||
) "cubeb: lazyLoad is inert on Darwin";
|
||||
|
||||
let
|
||||
backendLibs = [
|
||||
alsa-lib
|
||||
jack2
|
||||
libpulseaudio
|
||||
sndio
|
||||
];
|
||||
backendLibs =
|
||||
lib.optional alsaSupport alsa-lib
|
||||
++ lib.optional jackSupport jack2
|
||||
++ lib.optional pulseSupport libpulseaudio
|
||||
++ lib.optional sndioSupport sndio;
|
||||
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
|
@ -44,7 +48,7 @@ stdenv.mkDerivation {
|
|||
buildInputs = [ speexdsp ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) backendLibs;
|
||||
|
||||
cmakeFlags = [
|
||||
"-DBUILD_SHARED_LIBS=ON"
|
||||
(lib.cmakeBool "BUILD_SHARED_LIBS" buildSharedLibs)
|
||||
"-DBUILD_TESTS=OFF" # tests require an audio server
|
||||
"-DBUNDLE_SPEEX=OFF"
|
||||
"-DUSE_SANITIZERS=OFF"
|
||||
|
@ -58,12 +62,27 @@ stdenv.mkDerivation {
|
|||
backendLibs = lib.optionals lazyLoad backendLibs;
|
||||
};
|
||||
|
||||
postInstall = ''
|
||||
# TODO: remove after https://github.com/mozilla/cubeb/pull/813 is merged
|
||||
mkdir -p $out/lib/pkgconfig/
|
||||
echo > $out/lib/pkgconfig/libcubeb.pc \
|
||||
"Name: libcubeb
|
||||
Description: Cross platform audio library
|
||||
Version: 0.0.0
|
||||
Requires.private: libpulse
|
||||
Libs: -L"$out/lib" -lcubeb
|
||||
Libs.private: -lstdc++"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "Cross platform audio library";
|
||||
mainProgram = "cubeb-test";
|
||||
homepage = "https://github.com/mozilla/cubeb";
|
||||
license = licenses.isc;
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
maintainers = with maintainers; [ zhaofengli ];
|
||||
maintainers = with maintainers; [
|
||||
zhaofengli
|
||||
marcin-serwin
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -5,8 +5,19 @@
|
|||
cmake,
|
||||
protobuf,
|
||||
webrtc,
|
||||
pkg-config,
|
||||
cubeb,
|
||||
libpulseaudio,
|
||||
}:
|
||||
|
||||
let
|
||||
cubeb' = cubeb.override {
|
||||
alsaSupport = false;
|
||||
pulseSupport = true;
|
||||
jackSupport = false;
|
||||
sndioSupport = false;
|
||||
buildSharedLibs = false;
|
||||
};
|
||||
in
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "ringrtc";
|
||||
version = "2.51.0";
|
||||
|
@ -28,12 +39,20 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
|||
];
|
||||
doCheck = false;
|
||||
|
||||
env = {
|
||||
LIBCUBEB_SYS_USE_PKG_CONFIG = 1;
|
||||
LIBCUBEB_STATIC = 1;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
protobuf
|
||||
cmake
|
||||
pkg-config
|
||||
];
|
||||
buildInputs = [
|
||||
webrtc
|
||||
cubeb'
|
||||
libpulseaudio
|
||||
];
|
||||
|
||||
meta = {
|
||||
|
|
|
@ -19,14 +19,6 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
gclientDeps = gclient2nix.importGclientDeps ./webrtc-sources.json;
|
||||
sourceRoot = "src";
|
||||
|
||||
preConfigure = ''
|
||||
echo "$SOURCE_DATE_EPOCH" > build/util/LASTCHANGE.committime
|
||||
echo "generate_location_tags = true" >> build/config/gclient_args.gni
|
||||
substituteInPlace build/toolchain/linux/BUILD.gn \
|
||||
--replace-fail 'toolprefix = "aarch64-linux-gnu-"' 'toolprefix = ""'
|
||||
patchShebangs build/mac/should_use_hermetic_xcode.py
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
gn
|
||||
ninja
|
||||
|
@ -44,6 +36,22 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
pulseaudio
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace build/toolchain/linux/BUILD.gn \
|
||||
--replace-fail 'toolprefix = "aarch64-linux-gnu-"' 'toolprefix = ""'
|
||||
patchShebangs build/mac/should_use_hermetic_xcode.py
|
||||
|
||||
substituteInPlace modules/audio_device/linux/pulseaudiosymboltable_linux.cc \
|
||||
--replace-fail "libpulse.so.0" "${pulseaudio}/lib/libpulse.so.0"
|
||||
substituteInPlace modules/audio_device/linux/alsasymboltable_linux.cc \
|
||||
--replace-fail "libasound.so.2" "${alsa-lib}/lib/libasound.so.2"
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
echo "$SOURCE_DATE_EPOCH" > build/util/LASTCHANGE.committime
|
||||
echo "generate_location_tags = true" >> build/config/gclient_args.gni
|
||||
'';
|
||||
|
||||
gnFlags = [
|
||||
''target_os="linux"''
|
||||
"use_sysroot=false"
|
||||
|
@ -66,7 +74,11 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
ninjaFlags = [ "webrtc" ];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -D obj/libwebrtc${stdenv.hostPlatform.extensions.staticLibrary} $out/lib/libwebrtc${stdenv.hostPlatform.extensions.staticLibrary}
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue