summary refs log tree commit diff
path: root/pkgs/applications/audio/mpg123/default.nix
blob: 44788467d8f62cb6e5655d71dd5a103270e5870c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ lib, stdenv
, fetchurl
, makeWrapper
, alsa-lib
, perl
, withConplay ? !stdenv.targetPlatform.isWindows
}:

stdenv.mkDerivation rec {
  pname = "mpg123";
  version = "1.26.5";

  src = fetchurl {
    url = "mirror://sourceforge/${pname}/${pname}-${version}.tar.bz2";
    sha256 = "sha256-UCqX4Nk1vn432YczgCHY8wG641wohPKoPVnEtSRm7wY=";
  };

  outputs = [ "out" ] ++ lib.optionals withConplay [ "conplay" ];

  nativeBuildInputs = lib.optionals withConplay [ makeWrapper ];

  buildInputs = lib.optionals withConplay [ perl ]
    ++ lib.optionals (!stdenv.isDarwin && !stdenv.targetPlatform.isWindows) [ alsa-lib ];

  configureFlags = lib.optional
    (stdenv.hostPlatform ? mpg123)
    "--with-cpu=${stdenv.hostPlatform.mpg123.cpu}";

  postInstall = lib.optionalString withConplay ''
    mkdir -p $conplay/bin
    mv scripts/conplay $conplay/bin/
  '';

  preFixup = lib.optionalString withConplay ''
    patchShebangs $conplay/bin/conplay
  '';

  postFixup = lib.optionalString withConplay ''
    wrapProgram $conplay/bin/conplay \
      --prefix PATH : $out/bin
  '';

  meta = with lib; {
    description = "Fast console MPEG Audio Player and decoder library";
    homepage = "https://mpg123.org";
    license = licenses.lgpl21;
    maintainers = [ maintainers.ftrvxmtrx ];
    platforms = platforms.all;
  };
}