{lib, stdenv, fetchurl}:

stdenv.mkDerivation rec {
  version = "3.99-u4-b5";
  pname = "monkeys-audio";

  patches = [ ./buildfix.diff ];

  src = fetchurl {
    url = "https://deb-multimedia.org/pool/main/m/${pname}/${pname}_${version}.orig.tar.gz";
    sha256 = "0kjfwzfxfx7f958b2b1kf8yj655lp0ppmn0sh57gbkjvj8lml7nz";
  };

  meta = with lib; {
    description = "Lossless audio codec";
    platforms = platforms.linux;
    license = licenses.lgpl2;
    maintainers = [ ];
  };
}

{lib, gcc10Stdenv, fetchurl}:

gcc10Stdenv.mkDerivation rec {
  version = "3.99-u4-b5";
  pname = "monkeys-audio";

  patches = [ ./buildfix.diff ];

  src = fetchurl {
    url = "https://deb-multimedia.org/pool/main/m/${pname}/${pname}_${version}.orig.tar.gz";
    sha256 = "0kjfwzfxfx7f958b2b1kf8yj655lp0ppmn0sh57gbkjvj8lml7nz";
  };

  meta = with lib; {
    description = "Lossless audio codec";
    platforms = platforms.linux;
    license = licenses.lgpl2;
    maintainers = [ ];
  };
}

Fix compilation using an older version of gcc
monkeysAudio: Fix compilation using an older version of gcc

Fixes this issue:

> /nix/store/...-gcc-11.2.0/include/c++/11.2.0/cmath:1930:1: error: expected declaration before '}' token
>  1930 | } // extern "C++"
>       | ^
