summary refs log tree commit diff
path: root/pkgs/applications/audio/mpc123/default.nix
blob: 5f9f0229cb4989cc4cae98ca08a09d68909d8e49 (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
51
52
53
54
55
56
57
58
59
60
{ lib
, stdenv
, fetchFromGitLab
, gettext
, libao
, libmpcdec
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "mpc123";
  version = "0.2.4";

  src = fetchFromGitLab {
    domain = "salsa.debian.org";
    owner = "debian";
    repo = "mpc123";
    rev = "upstream/${finalAttrs.version}";
    hash = "sha256-+/yxb19CJzyjQmT3O21pEmPR5YudmyCxWwo+W3uOB9Q=";
  };

  strictDeps = true;

  nativeBuildInputs = [
    gettext
  ];

  buildInputs = [
    gettext
    libao
    libmpcdec
  ];

  makeFlags = [
    "CC=${stdenv.cc.targetPrefix}cc"
  ];

  # Workaround build failure on -fno-common toolchains like upstream
  # gcc-10. Otherwise build fails as:
  #   ld: /build/cc566Cj9.o:(.bss+0x0): multiple definition of `mpc123_file_reader'; ao.o:(.bss+0x40): first defined here
  env.NIX_CFLAGS_COMPILE = "-fcommon";

  # XXX: Should install locales too (though there's only 1 available).
  installPhase = ''
    runHook preInstall

    mkdir -p "$out/bin"
    cp -v mpc123 "$out/bin"

    runHook postInstall
  '';

  meta = {
    description = "A Musepack (.mpc) audio player";
    homepage = "https://github.com/bucciarati/mpc123";
    license = lib.licenses.gpl2Plus;
    mainProgram = "mpc123";
    maintainers = [ ];
    platforms = lib.platforms.unix;
  };
})