nixpkgs/pkgs/development/libraries/portaudio/default.nix

53 lines
1.7 KiB
Nix
Raw Normal View History

{ lib, stdenv, fetchurl, alsaLib, pkg-config, libjack2
2017-01-04 19:23:02 +00:00
, AudioUnit, AudioToolbox, CoreAudio, CoreServices, Carbon }:
2019-08-13 22:52:01 +01:00
stdenv.mkDerivation {
name = "portaudio-190600-20161030";
src = fetchurl {
url = "http://www.portaudio.com/archives/pa_stable_v190600_20161030.tgz";
sha256 = "04qmin6nj144b8qb9kkd9a52xfvm0qdgm8bg8jbl7s3frmyiv8pm";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libjack2 ]
++ lib.optional (!stdenv.isDarwin) alsaLib;
configureFlags = [ "--disable-mac-universal" "--enable-cxx" ];
2017-01-04 19:23:02 +00:00
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=nullability-inferred-on-nested-type -Wno-error=nullability-completeness-on-arrays";
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ AudioUnit AudioToolbox CoreAudio CoreServices Carbon ];
patchPhase = lib.optionalString stdenv.isDarwin ''
sed -i '50 i\
#include <CoreAudio/AudioHardware.h>\
#include <CoreAudio/AudioHardwareBase.h>\
#include <CoreAudio/AudioHardwareDeprecated.h>' \
include/pa_mac_core.h
'';
# not sure why, but all the headers seem to be installed by the make install
2017-01-04 19:23:02 +00:00
installPhase = ''
make install
'' + lib.optionalString (!stdenv.isDarwin) ''
# fixup .pc file to find alsa library
sed -i "s|-lasound|-L${alsaLib.out}/lib -lasound|" "$out/lib/pkgconfig/"*.pc
'' + lib.optionalString stdenv.isDarwin ''
2017-01-04 19:23:02 +00:00
cp include/pa_mac_core.h $out/include/pa_mac_core.h
'';
meta = with lib; {
description = "Portable cross-platform Audio API";
homepage = "http://www.portaudio.com/";
# Not exactly a bsd license, but alike
2013-07-07 11:51:41 +01:00
license = licenses.mit;
maintainers = with maintainers; [ lovek323 ];
platforms = platforms.unix;
};
passthru = {
api_version = 19;
};
}