about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/audio/sox/default.nix
blob: 946150d2b8812b3a506c1d5e6c083843546920e4 (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
{ config, lib, stdenv, fetchurl, pkg-config, CoreAudio
, enableAlsa ? true, alsaLib ? null
, enableLibao ? true, libao ? null
, enableLame ? config.sox.enableLame or false, lame ? null
, enableLibmad ? true, libmad ? null
, enableLibogg ? true, libogg ? null, libvorbis ? null
, enableOpusfile ? true, opusfile ? null
, enableFLAC ? true, flac ? null
, enablePNG ? true, libpng ? null
, enableLibsndfile ? true, libsndfile ? null
, enableWavpack ? true, wavpack ? null
# amrnb and amrwb are unfree, disabled by default
, enableAMR ? false, amrnb ? null, amrwb ? null
, enableLibpulseaudio ? true, libpulseaudio ? null
}:

with lib;

stdenv.mkDerivation rec {
  name = "sox-14.4.2";

  src = fetchurl {
    url = "mirror://sourceforge/sox/${name}.tar.gz";
    sha256 = "0v2znlxkxxcd3f48hf3dx9pq7i6fdhb62kgj7wv8xggz8f35jpxl";
  };

  # configure.ac uses pkg-config only to locate libopusfile
  nativeBuildInputs = optional enableOpusfile pkg-config;

  patches = [ ./0001-musl-rewind-pipe-workaround.patch ];

  buildInputs =
    optional (enableAlsa && stdenv.isLinux) alsaLib ++
    optional enableLibao libao ++
    optional enableLame lame ++
    optional enableLibmad libmad ++
    optionals enableLibogg [ libogg libvorbis ] ++
    optional enableOpusfile opusfile ++
    optional enableFLAC flac ++
    optional enablePNG libpng ++
    optional enableLibsndfile libsndfile ++
    optional enableWavpack wavpack ++
    optionals enableAMR [ amrnb amrwb ] ++
    optional enableLibpulseaudio libpulseaudio ++
    optional (stdenv.isDarwin) CoreAudio;

  meta = {
    description = "Sample Rate Converter for audio";
    homepage = "http://sox.sourceforge.net/";
    maintainers = [ lib.maintainers.marcweber ];
    license = if enableAMR then lib.licenses.unfree else lib.licenses.gpl2Plus;
    platforms = lib.platforms.linux ++ lib.platforms.darwin;
  };
}