13 stdenv.mkDerivation rec {
15 version = "190700_20210406";
18 url = "http://files.portaudio.com/archives/pa_stable_v${version}.tgz";
19 sha256 = "1vrdrd42jsnffh6rq8ap2c6fr4g9fcld89z649fs06bwqx1bzvs7";
23 nativeBuildInputs = [ pkg-config which ];
24 buildInputs = lib.optional (!stdenv.isDarwin) alsa-lib;
26 configureFlags = [ "--disable-mac-universal" "--enable-cxx" ];
28 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=nullability-inferred-on-nested-type -Wno-error=nullability-completeness-on-arrays -Wno-error=implicit-const-int-float-conversion";
30 propagatedBuildInputs = lib.optionals stdenv.isDarwin [ AudioUnit AudioToolbox CoreAudio CoreServices Carbon ];
32 # Disable parallel build as it fails as:
33 # make: *** No rule to make target '../../../lib/libportaudio.la',
34 # needed by 'libportaudiocpp.la'. Stop.
35 # Next release should address it with
36 # https://github.com/PortAudio/portaudio/commit/28d2781d9216115543aa3f0a0ffb7b4ee0fac551.patch
37 enableParallelBuilding = false;
40 # workaround for the configure script which expects an absolute path
41 export AR=$(which $AR)
44 # not sure why, but all the headers seem to be installed by the make install
47 '' + lib.optionalString (!stdenv.isDarwin) ''
48 # fixup .pc file to find alsa library
49 sed -i "s|-lasound|-L${alsa-lib.out}/lib -lasound|" "$out/lib/pkgconfig/"*.pc
50 '' + lib.optionalString stdenv.isDarwin ''
51 cp include/pa_mac_core.h $out/include/pa_mac_core.h
55 description = "Portable cross-platform Audio API";
56 homepage = "http://www.portaudio.com/";
57 # Not exactly a bsd license, but alike
58 license = licenses.mit;
59 maintainers = with maintainers; [ lovek323 ];
60 platforms = platforms.unix;