1{ stdenv, fetchurl, pkgconfig, libsndfile, ApplicationServices, Carbon, CoreServices }:
2
3let
4 inherit (stdenv.lib) optionals optionalString;
5
6in stdenv.mkDerivation rec {
7 name = "libsamplerate-0.1.9";
8
9 src = fetchurl {
10 url = "http://www.mega-nerd.com/SRC/${name}.tar.gz";
11 sha256 = "1ha46i0nbibq0pl0pjwcqiyny4hj8lp1bnl4dpxm64zjw9lb2zha";
12 };
13
14 nativeBuildInputs = [ pkgconfig ];
15 buildInputs = [ libsndfile ]
16 ++ optionals stdenv.isDarwin [ ApplicationServices CoreServices ];
17
18 configureFlags = [ "--disable-fftw" ];
19
20 outputs = [ "bin" "dev" "out" ];
21
22 postConfigure = optionalString stdenv.isDarwin ''
23 # need headers from the Carbon.framework in /System/Library/Frameworks to
24 # compile this on darwin -- not sure how to handle
25 NIX_CFLAGS_COMPILE+=" -I${Carbon}/Library/Frameworks/Carbon.framework/Headers"
26
27 substituteInPlace examples/Makefile --replace "-fpascal-strings" ""
28 '';
29
30 meta = with stdenv.lib; {
31 description = "Sample Rate Converter for audio";
32 homepage = http://www.mega-nerd.com/SRC/index.html;
33 license = licenses.bsd2;
34 maintainers = with maintainers; [ lovek323 wkennington ];
35 platforms = platforms.all;
36 };
37}