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