mpg123: Refactor

* Adds support for more audio APIs
* Explicitly requires APIs for sane order of preference
* Enables parallel building
This commit is contained in:
OPNA2608 2021-08-16 18:42:23 +02:00
parent d416e6878c
commit 8f4c7af8aa
2 changed files with 28 additions and 8 deletions

View File

@ -1,10 +1,18 @@
{ lib, stdenv
{ lib
, stdenv
, fetchurl
, makeWrapper
, pkg-config
, perl
, withAlsa ? stdenv.hostPlatform.isLinux
, alsa-lib
, withPulse ? stdenv.hostPlatform.isLinux
, libpulseaudio
, withCoreAudio ? stdenv.hostPlatform.isDarwin
, AudioUnit
, AudioToolbox
, perl
, withJack ? stdenv.hostPlatform.isUnix
, jack
, withConplay ? !stdenv.hostPlatform.isWindows
}:
@ -19,15 +27,26 @@ stdenv.mkDerivation rec {
outputs = [ "out" ] ++ lib.optionals withConplay [ "conplay" ];
nativeBuildInputs = lib.optionals withConplay [ makeWrapper ];
nativeBuildInputs = lib.optionals withConplay [ makeWrapper ]
++ lib.optionals (withPulse || withJack) [ pkg-config ];
buildInputs = lib.optionals withConplay [ perl ]
++ lib.optionals (stdenv.hostPlatform.isLinux) [ alsa-lib ]
++ lib.optionals (stdenv.hostPlatform.isDarwin) [ AudioUnit AudioToolbox ];
++ lib.optionals withAlsa [ alsa-lib ]
++ lib.optionals withPulse [ libpulseaudio ]
++ lib.optionals withCoreAudio [ AudioUnit AudioToolbox ]
++ lib.optionals withJack [ jack ];
configureFlags = lib.optional
(stdenv.hostPlatform ? mpg123)
"--with-cpu=${stdenv.hostPlatform.mpg123.cpu}";
configureFlags = [
"--with-audio=${lib.strings.concatStringsSep "," (
lib.optional withJack "jack"
++ lib.optional withPulse "pulse"
++ lib.optional withAlsa "alsa"
++ lib.optional withCoreAudio "coreaudio"
++ [ "dummy" ]
)}"
] ++ lib.optional (stdenv.hostPlatform ? mpg123) "--with-cpu=${stdenv.hostPlatform.mpg123.cpu}";
enableParallelBuilding = true;
postInstall = lib.optionalString withConplay ''
mkdir -p $conplay/bin

View File

@ -26075,6 +26075,7 @@ with pkgs;
mpg123 = callPackage ../applications/audio/mpg123 {
inherit (darwin.apple_sdk.frameworks) AudioUnit AudioToolbox;
jack = libjack2;
};
mpg321 = callPackage ../applications/audio/mpg321 { };