1{
2 lib,
3 stdenv,
4 argp-standalone,
5 dbus,
6 dbus_cplusplus,
7 fetchurl,
8 glibmm,
9 libavc1394,
10 libconfig,
11 libiec61883,
12 libraw1394,
13 libxmlxx3,
14 pkg-config,
15 python3,
16 scons,
17 which,
18 withMixer ? false,
19 qt5,
20}:
21
22let
23 python = python3.withPackages (
24 pkgs:
25 with pkgs;
26 (
27 [
28 distutils
29 ]
30 ++ lib.optionals withMixer [
31 pyqt5
32 dbus-python
33 ]
34 )
35 );
36in
37stdenv.mkDerivation rec {
38 pname = "ffado";
39 version = "2.4.9";
40
41 outputs = [
42 "out"
43 "bin"
44 "dev"
45 ];
46
47 src = fetchurl {
48 url = "http://www.ffado.org/files/libffado-${version}.tgz";
49 hash = "sha256-xELFL60Ryv1VE7tOhGyFHxAchIT4karFRe0ZDo/U0Q8=";
50 };
51
52 prePatch =
53 ''
54 substituteInPlace ./support/tools/ffado-diag.in \
55 --replace /lib/modules/ "/run/booted-system/kernel-modules/lib/modules/"
56
57 # prevent build tools from leaking into closure
58 substituteInPlace support/tools/SConscript --replace-fail \
59 'support/tools/ffado-diag --static' \
60 "echo '"'See `nix-store --query --tree ${placeholder "out"}`.'"'"
61 ''
62 + lib.optionalString (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
63 # skip the CC sanity check, since that requires invoking cross-compiled binaries during build
64 substituteInPlace SConstruct \
65 --replace-fail 'conf.CompilerCheck()' 'True' \
66 --replace-fail "pkg-config" "$PKG_CONFIG"
67 substituteInPlace admin/pkgconfig.py \
68 --replace-fail "pkg-config" "$PKG_CONFIG"
69 '';
70
71 nativeBuildInputs =
72 [
73 scons
74 pkg-config
75 which
76 ]
77 ++ lib.optionals withMixer [
78 python
79 python.pkgs.pyqt5
80 qt5.wrapQtAppsHook
81 ];
82
83 prefixKey = "PREFIX=";
84 sconsFlags = [
85 "CUSTOM_ENV=True" # tell SConstruct to use nixpkgs' CC/CXX/CFLAGS
86 "DETECT_USERSPACE_ENV=False"
87 "DEBUG=False"
88 "ENABLE_ALL=True"
89 "BUILD_TESTS=True"
90 "BUILD_MIXER=${if withMixer then "True" else "False"}"
91 "UDEVDIR=${placeholder "out"}/lib/udev/rules.d"
92 "PYPKGDIR=${placeholder "out"}/${python.sitePackages}"
93 "BINDIR=${placeholder "bin"}/bin"
94 "INCLUDEDIR=${placeholder "dev"}/include"
95 "PYTHON_INTERPRETER=${python.interpreter}"
96 ];
97
98 buildInputs =
99 [
100 dbus
101 dbus_cplusplus
102 glibmm
103 libavc1394
104 libconfig
105 libiec61883
106 libraw1394
107 libxmlxx3
108 python
109 ]
110 ++ lib.optionals (!stdenv.hostPlatform.isGnu) [
111 argp-standalone
112 ];
113
114 NIX_LDFLAGS = lib.optionalString (!stdenv.hostPlatform.isGnu) "-largp";
115
116 enableParallelBuilding = true;
117 dontWrapQtApps = true;
118 strictDeps = true;
119
120 preFixup = lib.optionalString withMixer ''
121 wrapQtApp "$bin/bin/ffado-mixer"
122 '';
123
124 meta = with lib; {
125 homepage = "http://www.ffado.org";
126 description = "FireWire audio drivers";
127 license = licenses.gpl3;
128 maintainers = with maintainers; [
129 michojel
130 ];
131 platforms = platforms.linux;
132 };
133}