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