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));
20 mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
24 stdenv.mkDerivation rec {
29 url = "mirror://sourceforge/lame/${pname}-${version}.tar.gz";
30 sha256 = "07nsn5sy3a8xbmw1bidxnsj5fj6kg9ai04icmqw40ybkp353dznx";
33 outputs = [ "out" "lib" "doc" ]; # a small single header
36 nativeBuildInputs = [ ]
37 ++ optional nasmSupport nasm;
40 #++ optional efenceSupport libefence
41 #++ optional mp3xSupport gtk1
42 ++ optional sndfileFileIOSupport libsndfile;
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 "")
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
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;