python312Packages.llama-index: 0.12.9 -> 0.12.9.post1 (#371957)
[NixPkgs.git] / pkgs / by-name / li / libmad / package.nix
blobf6772748edb726a1d7ae3e6512673a44a46b65c0
2   lib,
3   stdenv,
4   fetchurl,
5   fetchpatch,
6   autoconf,
8   # for passthru.tests
9   audacity,
10   mpd,
11   normalize,
12   ocamlPackages,
13   streamripper,
14   vlc,
17 stdenv.mkDerivation rec {
18   pname = "libmad";
19   version = "0.15.1b";
21   src = fetchurl {
22     url = "mirror://sourceforge/mad/${pname}-${version}.tar.gz";
23     sha256 = "14460zhacxhswnzb36qfpd1f2wbk10qvksvm6wyq5hpvdgnw7ymv";
24   };
26   outputs = [
27     "out"
28     "dev"
29   ];
31   patches =
32     [
33       (fetchpatch {
34         url = "https://github.com/openwrt/packages/raw/openwrt-19.07/libs/libmad/patches/001-mips_removal_h_constraint.patch";
35         sha256 = "0layswr6qg6axf4vyz6xrv73jwga34mkma3ifk9w9vrk41454hr5";
36       })
37       (fetchpatch {
38         url = "https://github.com/KaOSx/main/raw/1270b8080f37fb6cca562829a521991800b0a497/libmad/libmad.patch";
39         sha256 = "0rysq0sn3dfdz6pa6bfqkmk4ymc4rzk5ym7p16dyk37sldg1pbzs";
40       })
41       (fetchpatch {
42         url = "https://github.com/KaOSx/main/raw/1270b8080f37fb6cca562829a521991800b0a497/libmad/amd64-64bit.diff";
43         sha256 = "0mx56dmkbvw3zxnqd2hjng48q0d7q7473pns4n0ksdam29b0c5ar";
44       })
45       (fetchpatch {
46         name = "CVE-2017-8372-CVE-2017-8373.patch";
47         url = "https://github.com/openwrt/packages/raw/openwrt-19.07/libs/libmad/patches/102-CVE-2017-8373-CVE-2017-8372-md-size.patch";
48         sha256 = "0p6mkpn66h1ds8jvww28q4vlr58jwm58m9vb7pkvvyvy764agqnk";
49       })
50       (fetchpatch {
51         name = "CVE-2017-8374.patch";
52         url = "https://github.com/openwrt/packages/raw/openwrt-19.07/libs/libmad/patches/101-CVE-2017-8374-length-check.patch";
53         sha256 = "1j1ssxwmx9nfahzl62frbzck93xrjc2v3w30c12vmk29iflf1890";
54       })
55     ]
56     # optimize.diff is taken from https://projects.archlinux.org/svntogit/packages.git/tree/trunk/optimize.diff?h=packages/libmad
57     # It is included here in order to fix a build failure in Clang
58     # But it may be useful to fix other, currently unknown problems as well
59     ++ lib.optionals stdenv.cc.isClang [
60       (fetchpatch {
61         url = "https://github.com/KaOSx/main/raw/1270b8080f37fb6cca562829a521991800b0a497/libmad/optimize.diff";
62         sha256 = "0hcxzz9ql1fizyqbsgdchdwi7bvchfr72172j43hpyj53p0yabc6";
63       })
64     ];
66   # The -fforce-mem flag has been removed in GCC 4.3.
67   postPatch = ''
68     substituteInPlace configure.ac --replace "-fforce-mem" ""
69     substituteInPlace configure.ac --replace "arch=\"-march=i486\"" ""
70   '';
72   nativeBuildInputs = [ autoconf ];
74   preConfigure = "autoconf";
76   passthru.tests = {
77     inherit
78       audacity
79       mpd
80       normalize
81       streamripper
82       vlc
83       ;
84     ocaml-mad = ocamlPackages.mad;
85   };
87   meta = with lib; {
88     homepage = "https://sourceforge.net/projects/mad/";
89     description = "High-quality, fixed-point MPEG audio decoder supporting MPEG-1 and MPEG-2";
90     license = licenses.gpl2;
91     maintainers = with maintainers; [ lovek323 ];
92     platforms = platforms.unix;
93   };