1{ stdenv, fetchFromGitHub, pkgconfig, pythonPackages, makeWrapper
2, bash, libsamplerate, libsndfile, readline
3
4# Optional Dependencies
5, dbus ? null, libffado ? null, alsaLib ? null
6, libopus ? null
7
8# Extra options
9, prefix ? ""
10}:
11
12with stdenv.lib;
13let
14 inherit (pythonPackages) python dbus-python;
15 shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
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;
23 optLibopus = shouldUsePkg libopus;
24in
25stdenv.mkDerivation rec {
26 name = "${prefix}jack2-${version}";
27 version = "2015-09-03";
28
29 src = fetchFromGitHub {
30 owner = "jackaudio";
31 repo = "jack2";
32 rev = "2e8c5502c692a25f1c0213f3f7eeba1f4434da3c";
33 sha256 = "0r1xdshm251yqb748r5l5f6xpznhwlqyyxkky7vgx5m2q51qb0a1";
34 };
35
36 nativeBuildInputs = [ pkgconfig python makeWrapper ];
37 buildInputs = [
38 python
39
40 libsamplerate libsndfile readline
41
42 optDbus optPythonDBus optLibffado optAlsaLib optLibopus
43 ];
44
45 patchPhase = ''
46 substituteInPlace svnversion_regenerate.sh --replace /bin/bash ${bash}/bin/bash
47 '';
48
49 configurePhase = ''
50 python waf configure --prefix=$out \
51 ${optionalString (optDbus != null) "--dbus"} \
52 --classic \
53 --profile \
54 ${optionalString (optLibffado != null) "--firewire"} \
55 ${optionalString (optAlsaLib != null) "--alsa"} \
56 --autostart=${if (optDbus != null) then "dbus" else "classic"} \
57 '';
58
59 buildPhase = ''
60 python waf build
61 '';
62
63 installPhase = ''
64 python waf install
65 '' + (if libOnly then ''
66 rm -rf $out/{bin,share}
67 rm -rf $out/lib/{jack,libjacknet*,libjackserver*}
68 '' else ''
69 wrapProgram $out/bin/jack_control --set PYTHONPATH $PYTHONPATH
70 '');
71
72 meta = {
73 description = "JACK audio connection kit, version 2 with jackdbus";
74 homepage = "http://jackaudio.org";
75 license = licenses.gpl2Plus;
76 platforms = platforms.unix;
77 maintainers = with maintainers; [ goibhniu wkennington ];
78 };
79}