nixpkgs/pkgs/os-specific/linux/ffado/default.nix

90 lines
2.9 KiB
Nix
Raw Normal View History

2015-04-26 05:14:28 +02:00
{ stdenv, fetchurl, scons, pkgconfig, which, makeWrapper, python
, expat, libraw1394, libconfig, libavc1394, libiec61883
2015-04-26 05:14:28 +02:00
# Optional dependencies
, libjack2 ? null, dbus ? null, dbus_cplusplus ? null, alsaLib ? null
2015-05-03 00:54:30 +02:00
, pyqt4 ? null, pythonDBus ? null, xdg_utils ? null
2015-04-26 05:14:28 +02:00
# Other Flags
, prefix ? ""
}:
let
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
2015-04-26 05:14:28 +02:00
libOnly = prefix == "lib";
optLibjack2 = shouldUsePkg libjack2;
optDbus = shouldUsePkg dbus;
optDbus_cplusplus = shouldUsePkg dbus_cplusplus;
optAlsaLib = shouldUsePkg alsaLib;
optPyqt4 = shouldUsePkg pyqt4;
2015-05-03 00:54:30 +02:00
optPythonDBus = shouldUsePkg pythonDBus;
2015-04-26 05:14:28 +02:00
optXdg_utils = shouldUsePkg xdg_utils;
in
stdenv.mkDerivation rec {
2015-04-26 05:14:28 +02:00
name = "${prefix}ffado-${version}";
2014-08-24 15:11:22 +02:00
version = "2.2.1";
src = fetchurl {
2015-04-26 05:14:28 +02:00
url = "http://www.ffado.org/files/libffado-${version}.tgz";
2014-08-24 15:11:22 +02:00
sha256 = "1ximic90l0av91njb123ra2zp6mg23yg5iz8xa5371cqrn79nacz";
};
2015-04-26 05:14:28 +02:00
nativeBuildInputs = [ scons pkgconfig which makeWrapper python ];
2015-04-26 05:14:28 +02:00
buildInputs = [
expat libraw1394 libconfig libavc1394 libiec61883
] ++ stdenv.lib.optionals (!libOnly) [
optLibjack2 optDbus optDbus_cplusplus optAlsaLib optPyqt4
optXdg_utils
];
2015-04-26 05:14:28 +02:00
patches = [ ./build-fix.patch ];
postPatch = ''
# SConstruct checks cpuinfo and an objdump of /bin/mount to determine the appropriate arch
# Let's just skip this and tell it which to build
2014-08-24 19:50:22 +02:00
sed '/def is_userspace_32bit(cpuinfo):/a\
2015-04-26 05:14:28 +02:00
return ${if stdenv.is64bit then "False" else "True"}' -i SConstruct
# Lots of code is missing random headers to exist
sed -i '1i #include <memory>' \
src/ffadodevice.h src/bebob/bebob_dl_mgr.cpp tests/scan-devreg.cpp
sed -i -e '1i #include <stdlib.h>' \
-e '1i #include "version.h"' \
src/libutil/serialize_expat.cpp
2014-08-24 19:50:22 +02:00
'';
# TODO fix ffado-diag, it doesn't seem to use PYPKGDIR
buildPhase = ''
2015-04-26 05:14:28 +02:00
export PYDIR=$out/lib/${python.libPrefix}/site-packages
2015-04-26 05:14:28 +02:00
scons PYPKGDIR=$PYDIR DEBUG=False \
ENABLE_ALL=True \
SERIALIZE_USE_EXPAT=True \
'';
2015-04-26 05:14:28 +02:00
installPhase = if libOnly then ''
scons PREFIX=$TMPDIR UDEVDIR=$TMPDIR \
LIBDIR=$out/lib INCLUDEDIR=$out/include install
'' else ''
scons PREFIX=$out PYPKGDIR=$PYDIR UDEVDIR=$out/lib/udev/rules.d install
2015-05-03 00:54:30 +02:00
'' + stdenv.lib.optionalString (optPyqt4 != null && optPythonDBus != null) ''
wrapProgram $out/bin/ffado-mixer --prefix PYTHONPATH : \
2015-05-03 00:54:30 +02:00
$PYTHONPATH:$PYDIR:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX:
wrapProgram $out/bin/ffado-diag --prefix PYTHONPATH : \
2015-05-03 00:54:30 +02:00
$PYTHONPATH:$PYDIR:$out/share/libffado/python:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX:
2015-04-26 05:14:28 +02:00
'';
meta = with stdenv.lib; {
homepage = http://www.ffado.org;
description = "FireWire audio drivers";
license = licenses.gpl3;
2015-04-26 19:24:43 +02:00
maintainers = with maintainers; [ goibhniu wkennington ];
platforms = platforms.linux;
};
}