1{ 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)
12}:
13
14assert nasmSupport -> (nasm != null);
15#assert efenceSupport -> (libefence != null);
16assert sndfileFileIOSupport -> (libsndfile != null);
17#assert mp3xSupport -> (analyzerHooksSupport && (gtk1 != null));
18
19let
20 mkFlag = optSet: flag: if optSet then "--enable-${flag}" else "--disable-${flag}";
21in
22
23with stdenv.lib;
24stdenv.mkDerivation rec {
25 name = "lame-${version}";
26 version = "3.99.5";
27
28 src = fetchurl {
29 url = "mirror://sourceforge/lame/${name}.tar.gz";
30 sha256 = "1zr3kadv35ii6liia0bpfgxpag27xcivp571ybckpbz4b10nnd14";
31 };
32
33 patches = [ ./gcc-4.9.patch ];
34
35 outputs = [ "out" "lib" "doc" ]; # a small single header
36 outputMan = "out";
37
38 nativeBuildInputs = [ ]
39 ++ optional nasmSupport nasm;
40
41 buildInputs = [ ]
42 #++ optional efenceSupport libefence
43 #++ optional mp3xSupport gtk1
44 ++ optional sndfileFileIOSupport libsndfile;
45
46 configureFlags = [
47 (mkFlag nasmSupport "nasm")
48 (mkFlag cpmlSupport "cpml")
49 #(mkFlag efenceSupport "efence")
50 (if sndfileFileIOSupport then "--with-fileio=sndfile" else "--with-fileio=lame")
51 (mkFlag analyzerHooksSupport "analyzer-hooks")
52 (mkFlag decoderSupport "decoder")
53 (mkFlag frontendSupport "frontend")
54 (mkFlag frontendSupport "dynamic-frontends")
55 #(mkFlag mp3xSupport "mp3x")
56 (mkFlag mp3rtpSupport "mp3rtp")
57 (if debugSupport then "--enable-debug=alot" else "")
58 ];
59
60 meta = {
61 description = "A high quality MPEG Audio Layer III (MP3) encoder";
62 homepage = http://lame.sourceforge.net;
63 license = licenses.lgpl2;
64 maintainers = with maintainers; [ codyopel ];
65 platforms = platforms.all;
66 };
67}