summary refs log tree commit diff
path: root/pkgs/development/libraries/lame/default.nix
blob: 4a61d188ef6987ab29eb5dd5da1e516bf28c5577 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{ stdenv, fetchurl
, nasmSupport ? true, nasm ? null # Assembly optimizations
, cpmlSupport ? true # Compaq's fast math library
#, efenceSupport ? false, libefence ? null # Use ElectricFence for malloc debugging
, sndfileFileIOSupport ? false, libsndfile ? null # Use libsndfile, instead of lame's internal routines
, analyzerHooksSupport ? true # Use analyzer hooks
, decoderSupport ? true # mpg123 decoder
, frontendSupport ? true # Build the lame executable
#, mp3xSupport ? false, gtk1 ? null # Build GTK frame analyzer
, mp3rtpSupport ? false # Build mp3rtp
, debugSupport ? false # Debugging (disables optimizations)
}:

assert nasmSupport -> (nasm != null);
#assert efenceSupport -> (libefence != null);
assert sndfileFileIOSupport -> (libsndfile != null);
#assert mp3xSupport -> (analyzerHooksSupport && (gtk1 != null));

let
  sndfileFileIO = if sndfileFileIOSupport then "sndfile" else "lame";
in

with stdenv.lib;
stdenv.mkDerivation rec {
  name = "lame-${version}";
  version = "3.99.5";

  src = fetchurl {
    url = "mirror://sourceforge/lame/${name}.tar.gz";
    sha256 = "1zr3kadv35ii6liia0bpfgxpag27xcivp571ybckpbz4b10nnd14";
  };

  nativeBuildInputs = [ ]
    ++ optional nasmSupport nasm;

  buildInputs = [ ]
    #++ optional efenceSupport libefence
    #++ optional mp3xSupport gtk1
    ++ optional sndfileFileIOSupport libsndfile;

  configureFlags = [
    (mkEnable nasmSupport          "nasm"              null)
    (mkEnable cpmlSupport          "cpml"              null)
    #(mkEnable efenceSupport        "efence"            null)
    (mkWith   true                 "fileio"            sndfileFileIO)
    (mkEnable analyzerHooksSupport "analyzer-hooks"    null)
    (mkEnable decoderSupport       "decoder"           null)
    (mkEnable frontendSupport      "frontend"          null)
    (mkEnable frontendSupport      "dynamic-frontends" null)
    #(mkEnable mp3xSupport          "mp3x"              null)
    (mkEnable mp3rtpSupport        "mp3rtp"            null)
  ] ++ optional debugSupport [
    (mkEnable true                 "debug"             "alot")
  ];

  meta = {
    description = "A high quality MPEG Audio Layer III (MP3) encoder";
    homepage    = http://lame.sourceforge.net;
    license     = licenses.lgpl2;
    maintainers = with maintainers; [ codyopel ];
    platforms   = platforms.all;
  };
}