about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/audio/moc/default.nix
blob: 18b5a980633aa8b3a6dca145ddd8c2925a93677f (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
{ stdenv, fetchurl, pkgconfig
, ncurses, db , popt, libtool
# Sound sub-systems
, alsaSupport ? true, alsaLib
, pulseSupport ? true, libpulseaudio, autoreconfHook
, jackSupport ? true, libjack2
, ossSupport ? true
# Audio formats
, aacSupport ? true, faad2, libid3tag
, flacSupport ? true, flac
, midiSupport ? true, timidity
, modplugSupport ? true, libmodplug
, mp3Support ? true, libmad
, musepackSupport ? true, libmpc, libmpcdec, taglib
, vorbisSupport ? true, libvorbis
, speexSupport ? true, speex
, ffmpegSupport ? true, ffmpeg
, sndfileSupport ? true, libsndfile
, wavpackSupport ? true, wavpack
# Misc
, withffmpeg4 ? false, ffmpeg_4
, curlSupport ? true, curl
, samplerateSupport ? true, libsamplerate
, withDebug ? false
}:

let
  opt = stdenv.lib.optional;
  mkFlag = c: f: if c then "--with-${f}" else "--without-${f}";

in stdenv.mkDerivation rec {

  pname = "moc";
  version = "2.5.2";

  src = fetchurl {
    url = "http://ftp.daper.net/pub/soft/moc/stable/moc-${version}.tar.bz2";
    sha256 = "026v977kwb0wbmlmf6mnik328plxg8wykfx9ryvqhirac0aq39pk";
  };

  patches = []
    ++ opt withffmpeg4 ./moc-ffmpeg4.patch
    ++ opt pulseSupport ./pulseaudio.patch;

  nativeBuildInputs = [ pkgconfig ]
    ++ opt pulseSupport autoreconfHook;

  buildInputs = [ ncurses db popt libtool ]
    # Sound sub-systems
    ++ opt alsaSupport alsaLib
    ++ opt pulseSupport libpulseaudio
    ++ opt jackSupport libjack2
    # Audio formats
    ++ opt (aacSupport || mp3Support) libid3tag
    ++ opt aacSupport faad2
    ++ opt flacSupport flac
    ++ opt midiSupport timidity
    ++ opt modplugSupport libmodplug
    ++ opt mp3Support libmad
    ++ stdenv.lib.optionals musepackSupport [ libmpc libmpcdec taglib ]
    ++ opt vorbisSupport libvorbis
    ++ opt speexSupport speex
    ++ opt (ffmpegSupport && !withffmpeg4) ffmpeg
    ++ opt (ffmpegSupport && withffmpeg4) ffmpeg_4
    ++ opt sndfileSupport libsndfile
    ++ opt wavpackSupport wavpack
    # Misc
    ++ opt curlSupport curl
    ++ opt samplerateSupport libsamplerate;

  configureFlags = [
    # Sound sub-systems
    (mkFlag alsaSupport "alsa")
    (mkFlag pulseSupport "pulse")
    (mkFlag jackSupport "jack")
    (mkFlag ossSupport "oss")
    # Audio formats
    (mkFlag aacSupport "aac")
    (mkFlag flacSupport "flac")
    (mkFlag midiSupport "timidity")
    (mkFlag modplugSupport "modplug")
    (mkFlag mp3Support "mp3")
    (mkFlag musepackSupport "musepack")
    (mkFlag vorbisSupport "vorbis")
    (mkFlag speexSupport "speex")
    (mkFlag ffmpegSupport "ffmpeg")
    (mkFlag sndfileSupport "sndfile")
    (mkFlag wavpackSupport "wavpack")
    # Misc
    (mkFlag curlSupport "curl")
    (mkFlag samplerateSupport "samplerate")
    ("--enable-debug=" + (if withDebug then "yes" else "no"))
    "--disable-cache"
    "--without-rcc"
  ];

  meta = with stdenv.lib; {
    description = "An ncurses console audio player designed to be powerful and easy to use";
    homepage = "http://moc.daper.net/";
    license = licenses.gpl2;
    maintainers = with maintainers; [ aethelz pSub jagajaga ];
    platforms = platforms.linux;
  };
}