2021-08-16 17:42:23 +01:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-02 04:31:06 +01:00
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
2021-08-16 17:42:23 +01:00
|
|
|
, pkg-config
|
|
|
|
, perl
|
|
|
|
, withAlsa ? stdenv.hostPlatform.isLinux
|
2021-06-10 03:57:09 +01:00
|
|
|
, alsa-lib
|
2021-08-16 17:42:23 +01:00
|
|
|
, withPulse ? stdenv.hostPlatform.isLinux
|
|
|
|
, libpulseaudio
|
|
|
|
, withCoreAudio ? stdenv.hostPlatform.isDarwin
|
2021-08-16 16:40:03 +01:00
|
|
|
, AudioUnit
|
|
|
|
, AudioToolbox
|
2021-08-16 17:42:23 +01:00
|
|
|
, withJack ? stdenv.hostPlatform.isUnix
|
|
|
|
, jack
|
2021-08-16 16:40:03 +01:00
|
|
|
, withConplay ? !stdenv.hostPlatform.isWindows
|
2017-06-05 00:24:50 +01:00
|
|
|
}:
|
2010-08-21 17:54:02 +01:00
|
|
|
|
2015-06-13 22:19:04 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2021-06-20 11:34:30 +01:00
|
|
|
pname = "mpg123";
|
2021-12-09 09:13:39 +00:00
|
|
|
version = "1.29.2";
|
2010-08-21 17:54:02 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-06-20 11:34:30 +01:00
|
|
|
url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.bz2";
|
2021-12-09 09:13:39 +00:00
|
|
|
sha256 = "sha256-kHEhTr38G27QwKhdUwAQu7jrwETP5a5ZMOg/fmt5N+Y=";
|
2010-08-21 17:54:02 +01:00
|
|
|
};
|
|
|
|
|
2021-04-21 16:49:18 +01:00
|
|
|
outputs = [ "out" ] ++ lib.optionals withConplay [ "conplay" ];
|
2020-04-02 04:31:06 +01:00
|
|
|
|
2021-08-16 17:42:23 +01:00
|
|
|
nativeBuildInputs = lib.optionals withConplay [ makeWrapper ]
|
|
|
|
++ lib.optionals (withPulse || withJack) [ pkg-config ];
|
2020-04-02 04:31:06 +01:00
|
|
|
|
2021-04-21 16:49:18 +01:00
|
|
|
buildInputs = lib.optionals withConplay [ perl ]
|
2021-08-16 17:42:23 +01:00
|
|
|
++ lib.optionals withAlsa [ alsa-lib ]
|
|
|
|
++ lib.optionals withPulse [ libpulseaudio ]
|
|
|
|
++ lib.optionals withCoreAudio [ AudioUnit AudioToolbox ]
|
|
|
|
++ lib.optionals withJack [ jack ];
|
|
|
|
|
|
|
|
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}";
|
2010-08-21 17:54:02 +01:00
|
|
|
|
2021-08-16 17:42:23 +01:00
|
|
|
enableParallelBuilding = true;
|
2010-08-21 17:54:02 +01:00
|
|
|
|
2021-04-21 16:49:18 +01:00
|
|
|
postInstall = lib.optionalString withConplay ''
|
2020-04-02 04:31:06 +01:00
|
|
|
mkdir -p $conplay/bin
|
|
|
|
mv scripts/conplay $conplay/bin/
|
|
|
|
'';
|
|
|
|
|
2021-04-21 16:49:18 +01:00
|
|
|
preFixup = lib.optionalString withConplay ''
|
2020-04-02 04:31:06 +01:00
|
|
|
patchShebangs $conplay/bin/conplay
|
|
|
|
'';
|
|
|
|
|
2021-04-21 16:49:18 +01:00
|
|
|
postFixup = lib.optionalString withConplay ''
|
2020-04-02 04:31:06 +01:00
|
|
|
wrapProgram $conplay/bin/conplay \
|
|
|
|
--prefix PATH : $out/bin
|
|
|
|
'';
|
|
|
|
|
2021-04-21 16:49:18 +01:00
|
|
|
meta = with lib; {
|
2015-06-13 22:19:04 +01:00
|
|
|
description = "Fast console MPEG Audio Player and decoder library";
|
2021-04-21 16:49:18 +01:00
|
|
|
homepage = "https://mpg123.org";
|
2021-08-16 16:40:03 +01:00
|
|
|
license = licenses.lgpl21Only;
|
|
|
|
maintainers = with maintainers; [ ftrvxmtrx ];
|
2021-04-21 16:49:18 +01:00
|
|
|
platforms = platforms.all;
|
2010-08-21 17:54:02 +01:00
|
|
|
};
|
|
|
|
}
|