Skip to content

Commit

Permalink
rtaudio: refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
OPNA2608 committed Feb 3, 2021
1 parent d8262fc commit 6c22ff0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 16 deletions.
53 changes: 43 additions & 10 deletions pkgs/development/libraries/audio/rtaudio/default.nix
@@ -1,4 +1,19 @@
{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, libjack2, alsaLib, pulseaudio, rtmidi }:
{ stdenv
, lib
, config
, fetchFromGitHub
, fetchpatch
, cmake
, pkg-config
, alsaSupport ? stdenv.hostPlatform.isLinux
, alsaLib
, pulseaudioSupport ? config.pulseaudio or stdenv.hostPlatform.isLinux
, libpulseaudio
, jackSupport ? true
, jack
, coreaudioSupport ? stdenv.hostPlatform.isDarwin
, CoreAudio
}:

stdenv.mkDerivation rec {
version = "5.1.0";
Expand All @@ -11,22 +26,40 @@ stdenv.mkDerivation rec {
sha256 = "1pglnjz907ajlhnlnig3p0sx7hdkpggr8ss7b3wzf1lykzgv9l52";
};

patches = [ ./rtaudio-pkgconfig.patch ];
patches = [
# Fixes missing headers & install location
# Drop with version > 5.1.0
(fetchpatch {
name = "RtAudio-Adjust-CMake-public-header-installs-to-match-autotools.patch";
url = "https://github.com/thestk/rtaudio/commit/4273cf7572b8f51b5996cf6b42e3699cc6b165da.patch";
sha256 = "1p0idll0xsfk3jwjg83jkxkaf20gk0wqa7l982ni389rn6i4n26p";
})
];

enableParallelBuilding = true;
postPatch = ''
substituteInPlace rtaudio.pc.in \
--replace 'Requires:' 'Requires.private:'
'';

buildInputs = [ autoconf automake libtool libjack2 alsaLib pulseaudio rtmidi ];
nativeBuildInputs = [ cmake pkg-config ];

preConfigure = ''
./autogen.sh --no-configure
./configure
'';
buildInputs = lib.optional alsaSupport alsaLib
++ lib.optional pulseaudioSupport libpulseaudio
++ lib.optional jackSupport jack
++ lib.optional coreaudioSupport CoreAudio;

cmakeFlags = [
"-DRTAUDIO_API_ALSA=${if alsaSupport then "ON" else "OFF"}"
"-DRTAUDIO_API_PULSE=${if pulseaudioSupport then "ON" else "OFF"}"
"-DRTAUDIO_API_JACK=${if jackSupport then "ON" else "OFF"}"
"-DRTAUDIO_API_CORE=${if coreaudioSupport then "ON" else "OFF"}"
];

meta = with lib; {
description = "A set of C++ classes that provide a cross platform API for realtime audio input/output";
homepage = "http://www.music.mcgill.ca/~gary/rtaudio/";
homepage = "https://www.music.mcgill.ca/~gary/rtaudio/";
license = licenses.mit;
maintainers = [ maintainers.magnetophon ];
maintainers = with maintainers; [ magnetophon ];
platforms = platforms.unix;
};
}

This file was deleted.

5 changes: 4 additions & 1 deletion pkgs/top-level/all-packages.nix
Expand Up @@ -7277,7 +7277,10 @@ in

rocket = libsForQt5.callPackage ../tools/graphics/rocket { };

rtaudio = callPackage ../development/libraries/audio/rtaudio { };
rtaudio = callPackage ../development/libraries/audio/rtaudio {
jack = libjack2;
inherit (darwin.apple_sdk.frameworks) CoreAudio;
};

rtmidi = callPackage ../development/libraries/audio/rtmidi {
jack = libjack2;
Expand Down

0 comments on commit 6c22ff0

Please sign in to comment.