2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchurl
|
|
|
|
, alsa-lib
|
|
|
|
, pkg-config
|
|
|
|
, AudioUnit
|
|
|
|
, AudioToolbox
|
|
|
|
, CoreAudio
|
|
|
|
, CoreServices
|
|
|
|
, Carbon }:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "portaudio";
|
2021-12-26 17:43:05 +00:00
|
|
|
version = "190700_20210406";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2021-07-14 22:03:04 +00:00
|
|
|
url = "http://files.portaudio.com/archives/pa_stable_v${version}.tgz";
|
|
|
|
sha256 = "1vrdrd42jsnffh6rq8ap2c6fr4g9fcld89z649fs06bwqx1bzvs7";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
nativeBuildInputs = [ pkg-config ];
|
2021-07-14 22:03:04 +00:00
|
|
|
buildInputs = lib.optional (!stdenv.isDarwin) alsa-lib;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags = [ "--disable-mac-universal" "--enable-cxx" ];
|
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
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";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
propagatedBuildInputs = lib.optionals stdenv.isDarwin [ AudioUnit AudioToolbox CoreAudio CoreServices Carbon ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# Disable parallel build as it fails as:
|
|
|
|
# make: *** No rule to make target '../../../lib/libportaudio.la',
|
|
|
|
# needed by 'libportaudiocpp.la'. Stop.
|
|
|
|
# Next release should address it with
|
|
|
|
# https://github.com/PortAudio/portaudio/commit/28d2781d9216115543aa3f0a0ffb7b4ee0fac551.patch
|
|
|
|
enableParallelBuilding = false;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
# not sure why, but all the headers seem to be installed by the make install
|
|
|
|
installPhase = ''
|
|
|
|
make install
|
2021-02-05 17:12:51 +00:00
|
|
|
'' + lib.optionalString (!stdenv.isDarwin) ''
|
2020-04-24 23:36:52 +00:00
|
|
|
# fixup .pc file to find alsa library
|
2021-06-28 23:13:55 +00:00
|
|
|
sed -i "s|-lasound|-L${alsa-lib.out}/lib -lasound|" "$out/lib/pkgconfig/"*.pc
|
2021-02-05 17:12:51 +00:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2020-04-24 23:36:52 +00:00
|
|
|
cp include/pa_mac_core.h $out/include/pa_mac_core.h
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Portable cross-platform Audio API";
|
|
|
|
homepage = "http://www.portaudio.com/";
|
|
|
|
# Not exactly a bsd license, but alike
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ lovek323 ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
api_version = 19;
|
|
|
|
};
|
|
|
|
}
|