14 stdenv.mkDerivation rec {
16 version = "190700_20210406";
19 url = "https://files.portaudio.com/archives/pa_stable_v${version}.tgz";
20 sha256 = "1vrdrd42jsnffh6rq8ap2c6fr4g9fcld89z649fs06bwqx1bzvs7";
24 nativeBuildInputs = [ pkg-config which ];
25 buildInputs = [ libjack2 ] ++ lib.optionals (!stdenv.isDarwin) [ alsa-lib ];
27 configureFlags = [ "--disable-mac-universal" "--enable-cxx" ];
29 env.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";
31 propagatedBuildInputs = lib.optionals stdenv.isDarwin [ AudioUnit AudioToolbox CoreAudio CoreServices Carbon ];
33 # Disable parallel build as it fails as:
34 # make: *** No rule to make target '../../../lib/libportaudio.la',
35 # needed by 'libportaudiocpp.la'. Stop.
36 # Next release should address it with
37 # https://github.com/PortAudio/portaudio/commit/28d2781d9216115543aa3f0a0ffb7b4ee0fac551.patch
38 enableParallelBuilding = false;
41 # workaround for the configure script which expects an absolute path
42 export AR=$(which $AR)
45 # not sure why, but all the headers seem to be installed by the make install
48 '' + lib.optionalString (!stdenv.isDarwin) ''
49 # fixup .pc file to find alsa library
50 sed -i "s|-lasound|-L${alsa-lib.out}/lib -lasound|" "$out/lib/pkgconfig/"*.pc
51 '' + lib.optionalString stdenv.isDarwin ''
52 cp include/pa_mac_core.h $out/include/pa_mac_core.h
56 description = "Portable cross-platform Audio API";
57 homepage = "https://www.portaudio.com/";
58 # Not exactly a bsd license, but alike
59 license = licenses.mit;
60 maintainers = with maintainers; [ lovek323 ];
61 platforms = platforms.unix;