1{stdenv, fetchurl, autoconf}:
2
3stdenv.mkDerivation rec {
4 name = "libmad-0.15.1b";
5
6 src = fetchurl {
7 url = "mirror://sourceforge/mad/${name}.tar.gz";
8 sha256 = "bbfac3ed6bfbc2823d3775ebb931087371e142bb0e9bb1bee51a76a6e0078690";
9 };
10
11 patches = [ ./001-mips_removal_h_constraint.patch ./pkgconfig.patch ]
12 # optimize.diff is taken from https://projects.archlinux.org/svntogit/packages.git/tree/trunk/optimize.diff?h=packages/libmad
13 # It is included here in order to fix a build failure in Clang
14 # But it may be useful to fix other, currently unknown problems as well
15 ++ stdenv.lib.optional stdenv.cc.isClang [ ./optimize.diff ];
16
17 nativeBuildInputs = [ autoconf ];
18
19 # The -fforce-mem flag has been removed in GCC 4.3.
20 preConfigure = ''
21 autoconf
22 substituteInPlace configure --replace "-fforce-mem" ""
23 substituteInPlace configure --replace "arch=\"-march=i486\"" ""
24 '';
25
26 meta = with stdenv.lib; {
27 homepage = https://sourceforge.net/projects/mad/;
28 description = "A high-quality, fixed-point MPEG audio decoder supporting MPEG-1 and MPEG-2";
29 license = licenses.gpl2;
30 maintainers = with maintainers; [ lovek323 ];
31 platforms = platforms.unix;
32 };
33}