linux_xanmod: 5.11.14 -> 5.11.15
[NixPkgs.git] / pkgs / development / libraries / lame / default.nix
blob8ed0962bece85e691c8da8f227cdde7583c88c2f
1 { lib, stdenv, fetchurl
2 , nasmSupport ? true, nasm ? null # Assembly optimizations
3 , cpmlSupport ? true # Compaq's fast math library
4 #, efenceSupport ? false, libefence ? null # Use ElectricFence for malloc debugging
5 , sndfileFileIOSupport ? false, libsndfile ? null # Use libsndfile, instead of lame's internal routines
6 , analyzerHooksSupport ? true # Use analyzer hooks
7 , decoderSupport ? true # mpg123 decoder
8 , frontendSupport ? true # Build the lame executable
9 #, mp3xSupport ? false, gtk1 ? null # Build GTK frame analyzer
10 , mp3rtpSupport ? false # Build mp3rtp
11 , debugSupport ? false # Debugging (disables optimizations)
14 assert nasmSupport -> (nasm != null);
15 #assert efenceSupport -> (libefence != null);
16 assert sndfileFileIOSupport -> (libsndfile != null);
17 #assert mp3xSupport -> (analyzerHooksSupport && (gtk1 != null));
19 let
20   mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
23 with lib;
24 stdenv.mkDerivation rec {
25   pname = "lame";
26   version = "3.100";
28   src = fetchurl {
29     url = "mirror://sourceforge/lame/${pname}-${version}.tar.gz";
30     sha256 = "07nsn5sy3a8xbmw1bidxnsj5fj6kg9ai04icmqw40ybkp353dznx";
31   };
33   outputs = [ "out" "lib" "doc" ]; # a small single header
34   outputMan = "out";
36   nativeBuildInputs = [ ]
37     ++ optional nasmSupport nasm;
39   buildInputs = [ ]
40     #++ optional efenceSupport libefence
41     #++ optional mp3xSupport gtk1
42     ++ optional sndfileFileIOSupport libsndfile;
44   configureFlags = [
45     (mkFlag nasmSupport "nasm")
46     (mkFlag cpmlSupport "cpml")
47     #(mkFlag efenceSupport "efence")
48     (if sndfileFileIOSupport then "--with-fileio=sndfile" else "--with-fileio=lame")
49     (mkFlag analyzerHooksSupport "analyzer-hooks")
50     (mkFlag decoderSupport "decoder")
51     (mkFlag frontendSupport "frontend")
52     (mkFlag frontendSupport "dynamic-frontends")
53     #(mkFlag mp3xSupport "mp3x")
54     (mkFlag mp3rtpSupport "mp3rtp")
55     (if debugSupport then "--enable-debug=alot" else "")
56   ];
58   preConfigure = ''
59     # Prevent a build failure for 3.100 due to using outdated symbol list
60     # https://hydrogenaud.io/index.php/topic,114777.msg946373.html#msg946373
61     sed -i '/lame_init_old/d' include/libmp3lame.sym
62   '';
64   meta = {
65     description = "A high quality MPEG Audio Layer III (MP3) encoder";
66     homepage    = "http://lame.sourceforge.net";
67     license     = licenses.lgpl2;
68     maintainers = with maintainers; [ codyopel fpletz ];
69     platforms   = platforms.all;
70   };