libjack2: fix darwin build

+95 -5
+22
pkgs/misc/jackaudio/clang.patch
··· 1 + diff --git a/tests/test.cpp b/tests/test.cpp 2 + index 8a8a811..31e8459 100644 3 + --- a/tests/test.cpp 4 + +++ b/tests/test.cpp 5 + @@ -479,7 +479,7 @@ int process4(jack_nframes_t nframes, void *arg) 6 + jack_nframes_t delta_time = cur_time - last_time; 7 + 8 + Log("calling process4 callback : jack_frame_time = %ld delta_time = %ld\n", cur_time, delta_time); 9 + - if (delta_time > 0 && (jack_nframes_t)abs(delta_time - cur_buffer_size) > tolerance) { 10 + + if (delta_time > 0 && (jack_nframes_t)fabs(delta_time - cur_buffer_size) > tolerance) { 11 + printf("!!! ERROR !!! jack_frame_time seems to return incorrect values cur_buffer_size = %d, delta_time = %d tolerance %d\n", cur_buffer_size, delta_time, tolerance); 12 + } 13 + 14 + @@ -1064,7 +1064,7 @@ int main (int argc, char *argv[]) 15 + } 16 + jack_sleep(1 * 1000); 17 + cur_buffer_size = jack_get_buffer_size(client1); 18 + - if (abs((old_buffer_size * factor) - cur_buffer_size) > 5) { // Tolerance needed for dummy driver... 19 + + if (fabs((old_buffer_size * factor) - cur_buffer_size) > 5) { // Tolerance needed for dummy driver... 20 + printf("!!! ERROR !!! Buffer size has not been changed !\n"); 21 + printf("!!! Maybe jack was compiled without the '--enable-resize' flag...\n"); 22 + } else {
+49
pkgs/misc/jackaudio/darwin-cf.patch
··· 1 + diff --git a/common/Jackdmp.cpp b/common/Jackdmp.cpp 2 + index 7eea281..4b8d75d 100644 3 + --- a/common/Jackdmp.cpp 4 + +++ b/common/Jackdmp.cpp 5 + @@ -50,43 +50,11 @@ are "hard-coded" in the source. A much better approach would be to use the contr 6 + - get available drivers and their possible parameters, then prepare to parse them. 7 + */ 8 + 9 + -#ifdef __APPLE__ 10 + -#include <CoreFoundation/CFNotificationCenter.h> 11 + -#include <CoreFoundation/CoreFoundation.h> 12 + - 13 + -static void notify_server_start(const char* server_name) 14 + -{ 15 + - // Send notification to be used in the JackRouter plugin 16 + - CFStringRef ref = CFStringCreateWithCString(NULL, server_name, kCFStringEncodingMacRoman); 17 + - CFNotificationCenterPostNotificationWithOptions(CFNotificationCenterGetDistributedCenter(), 18 + - CFSTR("com.grame.jackserver.start"), 19 + - ref, 20 + - NULL, 21 + - kCFNotificationDeliverImmediately | kCFNotificationPostToAllSessions); 22 + - CFRelease(ref); 23 + -} 24 + - 25 + -static void notify_server_stop(const char* server_name) 26 + -{ 27 + - // Send notification to be used in the JackRouter plugin 28 + - CFStringRef ref1 = CFStringCreateWithCString(NULL, server_name, kCFStringEncodingMacRoman); 29 + - CFNotificationCenterPostNotificationWithOptions(CFNotificationCenterGetDistributedCenter(), 30 + - CFSTR("com.grame.jackserver.stop"), 31 + - ref1, 32 + - NULL, 33 + - kCFNotificationDeliverImmediately | kCFNotificationPostToAllSessions); 34 + - CFRelease(ref1); 35 + -} 36 + - 37 + -#else 38 + - 39 + static void notify_server_start(const char* server_name) 40 + {} 41 + static void notify_server_stop(const char* server_name) 42 + {} 43 + 44 + -#endif 45 + - 46 + static void copyright(FILE* file) 47 + { 48 + fprintf(file, "jackdmp " VERSION "\n" 49 +
+23 -5
pkgs/misc/jackaudio/default.nix
··· 1 1 { stdenv, fetchFromGitHub, pkgconfig, python2Packages, makeWrapper 2 2 , bash, libsamplerate, libsndfile, readline, eigen, celt 3 + # Darwin Dependencies 4 + , aften, AudioToolbox, CoreAudio, CoreFoundation 3 5 4 6 # Optional Dependencies 5 7 , dbus ? null, libffado ? null, alsaLib ? null 6 8 , libopus ? null 9 + , darwin 7 10 8 11 # Extra options 9 12 , prefix ? "" ··· 16 19 17 20 libOnly = prefix == "lib"; 18 21 19 - optDbus = shouldUsePkg dbus; 22 + optDbus = if stdenv.isDarwin then null else shouldUsePkg dbus; 20 23 optPythonDBus = if libOnly then null else shouldUsePkg dbus-python; 21 24 optLibffado = if libOnly then null else shouldUsePkg libffado; 22 25 optAlsaLib = if libOnly then null else shouldUsePkg alsaLib; ··· 34 37 }; 35 38 36 39 nativeBuildInputs = [ pkgconfig python makeWrapper ]; 37 - buildInputs = [ python libsamplerate libsndfile readline eigen celt 40 + buildInputs = [ libsamplerate libsndfile readline eigen celt 38 41 optDbus optPythonDBus optLibffado optAlsaLib optLibopus 39 - ]; 42 + ] ++ stdenv.lib.optionals stdenv.isDarwin [ aften AudioToolbox CoreAudio CoreFoundation ]; 43 + 44 + # CoreFoundation 10.10 doesn't include CFNotificationCenter.h yet. 45 + patches = stdenv.lib.optionals stdenv.isDarwin [ ./clang.patch ./darwin-cf.patch ]; 40 46 41 - patchPhase = '' 42 - substituteInPlace svnversion_regenerate.sh --replace /bin/bash ${bash}/bin/bash 47 + prePatch = '' 48 + substituteInPlace svnversion_regenerate.sh \ 49 + --replace /bin/bash ${bash}/bin/bash 50 + ''; 51 + 52 + # It looks like one of the frameworks depends on <CoreFoundation/CFAttributedString.h> 53 + # since frameworks are impure we also have to use the impure CoreFoundation here. 54 + # FIXME: remove when CoreFoundation is updated to 10.11 55 + preConfigure = stdenv.lib.optionalString stdenv.isDarwin '' 56 + export NIX_CFLAGS_COMPILE="-F${CoreFoundation}/Library/Frameworks $NIX_CFLAGS_COMPILE" 43 57 ''; 44 58 45 59 configurePhase = '' 60 + runHook preConfigure 61 + 46 62 python waf configure --prefix=$out \ 47 63 ${optionalString (optDbus != null) "--dbus"} \ 48 64 --classic \ 49 65 ${optionalString (optLibffado != null) "--firewire"} \ 50 66 ${optionalString (optAlsaLib != null) "--alsa"} \ 51 67 --autostart=${if (optDbus != null) then "dbus" else "classic"} \ 68 + 69 + runHook postConfigure 52 70 ''; 53 71 54 72 buildPhase = ''
+1
pkgs/top-level/all-packages.nix
··· 18886 18886 18887 18887 jack2Full = callPackage ../misc/jackaudio { 18888 18888 libopus = libopus.override { withCustomModes = true; }; 18889 + inherit (darwin.apple_sdk.frameworks) AudioToolbox CoreAudio CoreFoundation; 18889 18890 }; 18890 18891 libjack2 = jack2Full.override { prefix = "lib"; }; 18891 18892