tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
libjack2: fix darwin build
Daiderd Jordan
8 years ago
7d98316a
bb02b800
+95
-5
4 changed files
expand all
collapse all
unified
split
pkgs
misc
jackaudio
clang.patch
darwin-cf.patch
default.nix
top-level
all-packages.nix
+22
pkgs/misc/jackaudio/clang.patch
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
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
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
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
{ stdenv, fetchFromGitHub, pkgconfig, python2Packages, makeWrapper
2
, bash, libsamplerate, libsndfile, readline, eigen, celt
0
0
3
4
# Optional Dependencies
5
, dbus ? null, libffado ? null, alsaLib ? null
6
, libopus ? null
0
7
8
# Extra options
9
, prefix ? ""
···
16
17
libOnly = prefix == "lib";
18
19
-
optDbus = shouldUsePkg dbus;
20
optPythonDBus = if libOnly then null else shouldUsePkg dbus-python;
21
optLibffado = if libOnly then null else shouldUsePkg libffado;
22
optAlsaLib = if libOnly then null else shouldUsePkg alsaLib;
···
34
};
35
36
nativeBuildInputs = [ pkgconfig python makeWrapper ];
37
-
buildInputs = [ python libsamplerate libsndfile readline eigen celt
38
optDbus optPythonDBus optLibffado optAlsaLib optLibopus
39
-
];
0
0
0
40
41
-
patchPhase = ''
42
-
substituteInPlace svnversion_regenerate.sh --replace /bin/bash ${bash}/bin/bash
0
0
0
0
0
0
0
0
43
'';
44
45
configurePhase = ''
0
0
46
python waf configure --prefix=$out \
47
${optionalString (optDbus != null) "--dbus"} \
48
--classic \
49
${optionalString (optLibffado != null) "--firewire"} \
50
${optionalString (optAlsaLib != null) "--alsa"} \
51
--autostart=${if (optDbus != null) then "dbus" else "classic"} \
0
0
52
'';
53
54
buildPhase = ''
···
1
{ stdenv, fetchFromGitHub, pkgconfig, python2Packages, makeWrapper
2
, bash, libsamplerate, libsndfile, readline, eigen, celt
3
+
# Darwin Dependencies
4
+
, aften, AudioToolbox, CoreAudio, CoreFoundation
5
6
# Optional Dependencies
7
, dbus ? null, libffado ? null, alsaLib ? null
8
, libopus ? null
9
+
, darwin
10
11
# Extra options
12
, prefix ? ""
···
19
20
libOnly = prefix == "lib";
21
22
+
optDbus = if stdenv.isDarwin then null else shouldUsePkg dbus;
23
optPythonDBus = if libOnly then null else shouldUsePkg dbus-python;
24
optLibffado = if libOnly then null else shouldUsePkg libffado;
25
optAlsaLib = if libOnly then null else shouldUsePkg alsaLib;
···
37
};
38
39
nativeBuildInputs = [ pkgconfig python makeWrapper ];
40
+
buildInputs = [ libsamplerate libsndfile readline eigen celt
41
optDbus optPythonDBus optLibffado optAlsaLib optLibopus
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 ];
46
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"
57
'';
58
59
configurePhase = ''
60
+
runHook preConfigure
61
+
62
python waf configure --prefix=$out \
63
${optionalString (optDbus != null) "--dbus"} \
64
--classic \
65
${optionalString (optLibffado != null) "--firewire"} \
66
${optionalString (optAlsaLib != null) "--alsa"} \
67
--autostart=${if (optDbus != null) then "dbus" else "classic"} \
68
+
69
+
runHook postConfigure
70
'';
71
72
buildPhase = ''
+1
pkgs/top-level/all-packages.nix
···
18886
18887
jack2Full = callPackage ../misc/jackaudio {
18888
libopus = libopus.override { withCustomModes = true; };
0
18889
};
18890
libjack2 = jack2Full.override { prefix = "lib"; };
18891
···
18886
18887
jack2Full = callPackage ../misc/jackaudio {
18888
libopus = libopus.override { withCustomModes = true; };
18889
+
inherit (darwin.apple_sdk.frameworks) AudioToolbox CoreAudio CoreFoundation;
18890
};
18891
libjack2 = jack2Full.override { prefix = "lib"; };
18892