2021-08-22 07:53:02 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-09-25 04:45:31 +00:00
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
2021-08-22 07:53:02 +00:00
|
|
|
, pkg-config
|
2020-09-25 04:45:31 +00:00
|
|
|
, perl
|
2021-08-22 07:53:02 +00:00
|
|
|
, withAlsa ? stdenv.hostPlatform.isLinux
|
|
|
|
, alsa-lib
|
|
|
|
, withPulse ? stdenv.hostPlatform.isLinux
|
|
|
|
, libpulseaudio
|
|
|
|
, withCoreAudio ? stdenv.hostPlatform.isDarwin
|
|
|
|
, AudioUnit
|
|
|
|
, AudioToolbox
|
|
|
|
, withJack ? stdenv.hostPlatform.isUnix
|
|
|
|
, jack
|
|
|
|
, withConplay ? !stdenv.hostPlatform.isWindows
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2021-07-21 07:28:18 +00:00
|
|
|
pname = "mpg123";
|
2021-08-22 07:53:02 +00:00
|
|
|
version = "1.28.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-07-21 07:28:18 +00:00
|
|
|
url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.bz2";
|
2021-08-22 07:53:02 +00:00
|
|
|
sha256 = "006v44nz4nkpgvxz1k2vbbrfpa2m47hyydscs0wf3iysiyvd9vvy";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-04-25 03:57:28 +00:00
|
|
|
outputs = [ "out" ] ++ lib.optionals withConplay [ "conplay" ];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
nativeBuildInputs = lib.optionals withConplay [ makeWrapper ]
|
|
|
|
++ lib.optionals (withPulse || withJack) [ pkg-config ];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
2021-04-25 03:57:28 +00:00
|
|
|
buildInputs = lib.optionals withConplay [ perl ]
|
2021-08-22 07:53:02 +00: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}";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-08-22 07:53:02 +00:00
|
|
|
enableParallelBuilding = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-04-25 03:57:28 +00:00
|
|
|
postInstall = lib.optionalString withConplay ''
|
2020-09-25 04:45:31 +00:00
|
|
|
mkdir -p $conplay/bin
|
|
|
|
mv scripts/conplay $conplay/bin/
|
|
|
|
'';
|
|
|
|
|
2021-04-25 03:57:28 +00:00
|
|
|
preFixup = lib.optionalString withConplay ''
|
2020-09-25 04:45:31 +00:00
|
|
|
patchShebangs $conplay/bin/conplay
|
|
|
|
'';
|
|
|
|
|
2021-04-25 03:57:28 +00:00
|
|
|
postFixup = lib.optionalString withConplay ''
|
2020-09-25 04:45:31 +00:00
|
|
|
wrapProgram $conplay/bin/conplay \
|
|
|
|
--prefix PATH : $out/bin
|
|
|
|
'';
|
|
|
|
|
2021-04-25 03:57:28 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Fast console MPEG Audio Player and decoder library";
|
2021-04-25 03:57:28 +00:00
|
|
|
homepage = "https://mpg123.org";
|
2021-08-22 07:53:02 +00:00
|
|
|
license = licenses.lgpl21Only;
|
|
|
|
maintainers = with maintainers; [ ftrvxmtrx ];
|
2021-04-25 03:57:28 +00:00
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|