nixpkgs/pkgs/applications/audio/mpg123/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

80 lines
2.2 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchurl
, makeWrapper
, pkg-config
, libOnly ? false # whether to build only the library
, withAlsa ? stdenv.hostPlatform.isLinux
, alsa-lib
, withPulse ? stdenv.hostPlatform.isLinux
, libpulseaudio
, withCoreAudio ? stdenv.hostPlatform.isDarwin
2021-08-16 15:40:03 +00:00
, AudioUnit
, AudioToolbox
, withJack ? stdenv.hostPlatform.isUnix
, jack
2021-08-16 15:40:03 +00:00
, withConplay ? !stdenv.hostPlatform.isWindows
, perl
}:
assert withConplay -> !libOnly;
2015-06-13 21:19:04 +00:00
stdenv.mkDerivation rec {
pname = "${lib.optionalString libOnly "lib"}mpg123";
2023-04-06 07:57:58 +00:00
version = "1.31.3";
src = fetchurl {
url = "mirror://sourceforge/mpg123/mpg123-${version}.tar.bz2";
2023-04-06 07:57:58 +00:00
hash = "sha256-HKd9Omml/4RbegU294P+5VThBBE5prl49q/hT1gUrRo=";
};
outputs = [ "out" "dev" "man" ] ++ lib.optional withConplay "conplay";
nativeBuildInputs = lib.optionals (!libOnly) (
lib.optionals withConplay [ makeWrapper ]
++ lib.optionals (withPulse || withJack) [ pkg-config ]
);
buildInputs = lib.optionals (!libOnly) (
lib.optionals withConplay [ perl ]
++ lib.optionals withAlsa [ alsa-lib ]
++ lib.optionals withPulse [ libpulseaudio ]
++ lib.optionals withCoreAudio [ AudioUnit AudioToolbox ]
++ lib.optionals withJack [ jack ]
);
configureFlags = lib.optionals (!libOnly) [
"--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;
2021-04-21 15:49:18 +00:00
postInstall = lib.optionalString withConplay ''
mkdir -p $conplay/bin
mv scripts/conplay $conplay/bin/
'';
2021-04-21 15:49:18 +00:00
preFixup = lib.optionalString withConplay ''
patchShebangs $conplay/bin/conplay
'';
2021-04-21 15:49:18 +00:00
postFixup = lib.optionalString withConplay ''
wrapProgram $conplay/bin/conplay \
--prefix PATH : $out/bin
'';
2021-04-21 15:49:18 +00:00
meta = with lib; {
2015-06-13 21:19:04 +00:00
description = "Fast console MPEG Audio Player and decoder library";
2021-04-21 15:49:18 +00:00
homepage = "https://mpg123.org";
2021-08-16 15:40:03 +00:00
license = licenses.lgpl21Only;
maintainers = with maintainers; [ ftrvxmtrx ];
2021-04-21 15:49:18 +00:00
platforms = platforms.all;
};
}