anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / development / libraries / audio / cubeb / default.nix
blob478e8478382a1a278726222079ea26854fcb1c56
1 { lib, stdenv, fetchFromGitHub
2 , cmake
3 , pkg-config
4 , alsa-lib
5 , jack2
6 , libpulseaudio
7 , sndio
8 , speexdsp
9 , AudioUnit
10 , CoreAudio
11 , CoreServices
12 , lazyLoad ? !stdenv.hostPlatform.isDarwin
15 assert lib.assertMsg (stdenv.hostPlatform.isDarwin -> !lazyLoad) "cubeb: lazyLoad is inert on Darwin";
17 let
18   backendLibs = [
19     alsa-lib
20     jack2
21     libpulseaudio
22     sndio
23   ];
25 in stdenv.mkDerivation {
26   pname = "cubeb";
27   version = "unstable-2022-10-18";
29   src = fetchFromGitHub {
30     owner = "mozilla";
31     repo = "cubeb";
32     rev = "27d2a102b0b75d9e49d43bc1ea516233fb87d778";
33     hash = "sha256-q+uz1dGU4LdlPogL1nwCR/KuOX4Oy3HhMdA6aJylBRk=";
34   };
36   nativeBuildInputs = [
37     cmake
38     pkg-config
39   ];
41   buildInputs = [ speexdsp ] ++ (
42     if stdenv.hostPlatform.isDarwin then [ AudioUnit CoreAudio CoreServices ]
43     else backendLibs
44   );
46   cmakeFlags = [
47     "-DBUILD_SHARED_LIBS=ON"
48     "-DBUILD_TESTS=OFF" # tests require an audio server
49     "-DBUNDLE_SPEEX=OFF"
50     "-DUSE_SANITIZERS=OFF"
52     # Whether to lazily load libraries with dlopen()
53     "-DLAZY_LOAD_LIBS=${if lazyLoad then "ON" else "OFF"}"
54   ];
56   passthru = {
57     # For downstream users when lazyLoad is true
58     backendLibs = lib.optionals lazyLoad backendLibs;
59   };
61   meta = with lib; {
62     description = "Cross platform audio library";
63     mainProgram = "cubeb-test";
64     homepage = "https://github.com/mozilla/cubeb";
65     license = licenses.isc;
66     platforms = platforms.linux ++ platforms.darwin;
67     maintainers = with maintainers; [ zhaofengli ];
68   };