at 18.03-beta 92 lines 3.1 kB view raw
1{ stdenv, fetchurl, scons, pkgconfig, which, makeWrapper, python 2, expat, libraw1394, libconfig, libavc1394, libiec61883, libxmlxx, glibmm 3 4# Optional dependencies 5, libjack2 ? null, dbus ? null, dbus_cplusplus ? null, alsaLib ? null 6, pyqt4 ? null, dbus-python ? null, xdg_utils ? null 7 8# Other Flags 9, prefix ? "" 10}: 11 12let 13 14 shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null; 15 16 libOnly = prefix == "lib"; 17 18 optLibjack2 = shouldUsePkg libjack2; 19 optDbus = shouldUsePkg dbus; 20 optDbus_cplusplus = shouldUsePkg dbus_cplusplus; 21 optAlsaLib = shouldUsePkg alsaLib; 22 optPyqt4 = shouldUsePkg pyqt4; 23 optPythonDBus = shouldUsePkg dbus-python; 24 optXdg_utils = shouldUsePkg xdg_utils; 25in 26stdenv.mkDerivation rec { 27 name = "${prefix}ffado-${version}"; 28 version = "2.4.0"; 29 30 src = fetchurl { 31 url = "http://www.ffado.org/files/libffado-${version}.tgz"; 32 sha256 = "14rprlcd0gpvg9kljh0zzjzd2rc9hbqqpjidshxxjvvfh4r00f4f"; 33 }; 34 35 nativeBuildInputs = [ scons pkgconfig which makeWrapper python ]; 36 37 buildInputs = [ 38 expat libraw1394 libconfig libavc1394 libiec61883 39 ] ++ stdenv.lib.optionals (!libOnly) [ 40 optLibjack2 optDbus optDbus_cplusplus optAlsaLib optPyqt4 41 optXdg_utils libxmlxx glibmm 42 ]; 43 44 postPatch = '' 45 sed '1iimport sys' -i SConstruct 46 # SConstruct checks cpuinfo and an objdump of /bin/mount to determine the appropriate arch 47 # Let's just skip this and tell it which to build 48 sed '/def is_userspace_32bit(cpuinfo):/a\ 49 return ${if stdenv.is64bit then "False" else "True"}' -i SConstruct 50 51 # Lots of code is missing random headers to exist 52 sed -i '1i #include <memory>' \ 53 src/ffadodevice.h src/bebob/bebob_dl_mgr.cpp tests/scan-devreg.cpp 54 sed -i -e '1i #include <stdlib.h>' \ 55 -e '1i #include "version.h"' \ 56 src/libutil/serialize_expat.cpp 57 ''; 58 59 preConfigure = '' 60 export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags libxml++-2.6)" 61 ''; 62 63 # TODO fix ffado-diag, it doesn't seem to use PYPKGDIR 64 buildPhase = '' 65 export PYDIR=$out/lib/${python.libPrefix}/site-packages 66 67 scons PYPKGDIR=$PYDIR DEBUG=False \ 68 ENABLE_ALL=True \ 69 SERIALIZE_USE_EXPAT=True \ 70 ''; 71 72 installPhase = if libOnly then '' 73 scons PREFIX=$TMPDIR UDEVDIR=$TMPDIR \ 74 LIBDIR=$out/lib INCLUDEDIR=$out/include install 75 '' else '' 76 scons PREFIX=$out PYPKGDIR=$PYDIR UDEVDIR=$out/lib/udev/rules.d install 77 '' + stdenv.lib.optionalString (optPyqt4 != null && optPythonDBus != null) '' 78 wrapProgram $out/bin/ffado-mixer --prefix PYTHONPATH : \ 79 $PYTHONPATH:$PYDIR:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX: 80 81 wrapProgram $out/bin/ffado-diag --prefix PYTHONPATH : \ 82 $PYTHONPATH:$PYDIR:$out/share/libffado/python:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX: 83 ''; 84 85 meta = with stdenv.lib; { 86 homepage = http://www.ffado.org; 87 description = "FireWire audio drivers"; 88 license = licenses.gpl3; 89 maintainers = with maintainers; [ goibhniu wkennington ]; 90 platforms = platforms.linux; 91 }; 92}