From 8f4c7af8aa7b47dabeb3cccd30bf1ff51f1127b7 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Mon, 16 Aug 2021 18:42:23 +0200 Subject: [PATCH] mpg123: Refactor * Adds support for more audio APIs * Explicitly requires APIs for sane order of preference * Enables parallel building --- pkgs/applications/audio/mpg123/default.nix | 35 +++++++++++++++++----- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/pkgs/applications/audio/mpg123/default.nix b/pkgs/applications/audio/mpg123/default.nix index 09a588857e33..1023c9ab2b46 100644 --- a/pkgs/applications/audio/mpg123/default.nix +++ b/pkgs/applications/audio/mpg123/default.nix @@ -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 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 30bdd91c4387..4b5af8d26f62 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };