lol
1{ stdenv, fetchurl, alsaLib, pkgconfig, libjack2
2, AudioUnit, AudioToolbox, CoreAudio, CoreServices, Carbon }:
3
4stdenv.mkDerivation rec {
5 name = "portaudio-190600-20161030";
6
7 src = fetchurl {
8 url = http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz;
9 sha256 = "04qmin6nj144b8qb9kkd9a52xfvm0qdgm8bg8jbl7s3frmyiv8pm";
10 };
11
12 buildInputs = [ pkgconfig libjack2 ]
13 ++ stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
14
15 configureFlags = [ "--disable-mac-universal" ];
16
17 propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ AudioUnit AudioToolbox CoreAudio CoreServices Carbon ];
18
19 patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
20 sed -i '50 i\
21 #include <CoreAudio/AudioHardware.h>\
22 #include <CoreAudio/AudioHardwareBase.h>\
23 #include <CoreAudio/AudioHardwareDeprecated.h>' \
24 include/pa_mac_core.h
25 '';
26
27 # not sure why, but all the headers seem to be installed by the make install
28 installPhase = ''
29 make install
30 '' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
31 # fixup .pc file to find alsa library
32 sed -i "s|-lasound|-L${alsaLib.out}/lib -lasound|" "$out/lib/pkgconfig/"*.pc
33 '' + stdenv.lib.optionalString stdenv.isDarwin ''
34 cp include/pa_mac_core.h $out/include/pa_mac_core.h
35 '';
36
37 meta = with stdenv.lib; {
38 description = "Portable cross-platform Audio API";
39 homepage = http://www.portaudio.com/;
40 # Not exactly a bsd license, but alike
41 license = licenses.mit;
42 maintainers = with maintainers; [ lovek323 ];
43 platforms = platforms.unix;
44 };
45
46 passthru = {
47 api_version = 19;
48 };
49}