Merge pull request #232452 from adamcstephens/squeezelite/mac

squeezelite: add darwin support
This commit is contained in:
Weijia Wang 2023-05-22 15:21:13 +03:00 committed by GitHub
commit f491fc656a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 7 deletions

View file

@ -1,13 +1,14 @@
{ lib
, stdenv
, fetchFromGitHub
, alsa-lib
, flac
, libmad
, libpulseaudio
, libvorbis
, mpg123
, audioBackend ? "alsa"
, audioBackend ? if stdenv.isLinux then "alsa" else "portaudio"
, alsaSupport ? stdenv.isLinux
, alsa-lib
, dsdSupport ? true
, faad2Support ? true
, faad2
@ -19,10 +20,18 @@
, soxr
, sslSupport ? true
, openssl
, portaudioSupport ? stdenv.isDarwin
, portaudio
, AudioToolbox
, AudioUnit
, Carbon
, CoreAudio
, CoreVideo
, VideoDecodeAcceleration
}:
let
inherit (lib) optional optionalString;
inherit (lib) optional optionals optionalString;
pulseSupport = audioBackend == "pulse";
@ -44,7 +53,10 @@ stdenv.mkDerivation {
};
buildInputs = [ flac libmad libvorbis mpg123 ]
++ lib.singleton (if pulseSupport then libpulseaudio else alsa-lib)
++ optional pulseSupport libpulseaudio
++ optional alsaSupport alsa-lib
++ optional portaudioSupport portaudio
++ optionals stdenv.isDarwin [ CoreVideo VideoDecodeAcceleration CoreAudio AudioToolbox AudioUnit Carbon ]
++ optional faad2Support faad2
++ optional ffmpegSupport ffmpeg
++ optional opusSupport opusfile
@ -65,10 +77,15 @@ stdenv.mkDerivation {
++ optional (!faad2Support) "-DNO_FAAD"
++ optional ffmpegSupport "-DFFMPEG"
++ optional opusSupport "-DOPUS"
++ optional portaudioSupport "-DPORTAUDIO"
++ optional pulseSupport "-DPULSEAUDIO"
++ optional resampleSupport "-DRESAMPLE"
++ optional sslSupport "-DUSE_SSL";
env = lib.optionalAttrs stdenv.isDarwin {
LDADD = "-lportaudio -lpthread";
};
installPhase = ''
runHook preInstall
@ -85,6 +102,6 @@ stdenv.mkDerivation {
homepage = "https://github.com/ralph-irving/squeezelite";
license = with licenses; [ gpl3Plus ] ++ optional dsdSupport bsd2;
maintainers = with maintainers; [ adamcstephens ];
platforms = platforms.linux;
platforms = if (audioBackend == "pulse") then platforms.linux else platforms.linux ++ platforms.darwin;
};
}

View file

@ -34213,9 +34213,15 @@ with pkgs;
psst = callPackage ../applications/audio/psst { };
squeezelite = callPackage ../applications/audio/squeezelite { audioBackend = "alsa"; };
squeezelite = darwin.apple_sdk_11_0.callPackage ../applications/audio/squeezelite {
inherit (darwin.apple_sdk_11_0.frameworks) CoreVideo VideoDecodeAcceleration CoreAudio AudioToolbox AudioUnit Carbon;
};
squeezelite-pulse = callPackage ../applications/audio/squeezelite { audioBackend = "pulse"; };
squeezelite-pulse = darwin.apple_sdk_11_0.callPackage ../applications/audio/squeezelite {
inherit (darwin.apple_sdk_11_0.frameworks) CoreVideo VideoDecodeAcceleration CoreAudio AudioToolbox AudioUnit Carbon;
audioBackend = "pulse";
};
ltunify = callPackage ../tools/misc/ltunify { };