1{
2 lib,
3 stdenv,
4 fetchurl,
5 autoreconfHook,
6 pkg-config,
7 fftw,
8 speexdsp,
9 withFft ? !stdenv.hostPlatform.isMinGW,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "speex";
14 version = "1.2.1";
15
16 src = fetchurl {
17 url = "http://downloads.us.xiph.org/releases/speex/speex-${version}.tar.gz";
18 sha256 = "sha256-S0TU8rOKNwotmKeDKf78VqDPk9HBvnACkhe6rmYo/uo=";
19 };
20
21 postPatch = ''
22 sed -i '/AC_CONFIG_MACRO_DIR/i PKG_PROG_PKG_CONFIG' configure.ac
23 '';
24
25 outputs = [
26 "out"
27 "dev"
28 "doc"
29 ];
30
31 nativeBuildInputs = [
32 autoreconfHook
33 pkg-config
34 ];
35 buildInputs = lib.optionals withFft [ fftw ] ++ [ speexdsp ];
36
37 # TODO: Remove this will help with immediate backward compatibility
38 propagatedBuildInputs = [ speexdsp ];
39
40 configureFlags = lib.optionals withFft [
41 "--with-fft=gpl-fftw3"
42 ];
43
44 meta = with lib; {
45 homepage = "https://www.speex.org/";
46 description = "Open Source/Free Software patent-free audio compression format designed for speech";
47 license = licenses.bsd3;
48 platforms = platforms.unix ++ platforms.windows;
49 };
50}