2015-04-26 03:14:28 +00:00
|
|
|
{ stdenv, fetchurl, scons, pkgconfig, which, makeWrapper, python
|
2017-08-25 20:06:56 +00:00
|
|
|
, expat, libraw1394, libconfig, libavc1394, libiec61883, libxmlxx, glibmm
|
2012-04-05 21:53:42 +00:00
|
|
|
|
2015-04-26 03:14:28 +00:00
|
|
|
# Optional dependencies
|
|
|
|
, libjack2 ? null, dbus ? null, dbus_cplusplus ? null, alsaLib ? null
|
2016-08-16 20:51:21 +00:00
|
|
|
, pyqt4 ? null, dbus-python ? null, xdg_utils ? null
|
2015-04-26 03:14:28 +00:00
|
|
|
|
|
|
|
# Other Flags
|
|
|
|
, prefix ? ""
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2015-06-01 18:52:03 +00:00
|
|
|
|
|
|
|
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
|
|
|
|
|
2015-04-26 03:14:28 +00:00
|
|
|
libOnly = prefix == "lib";
|
|
|
|
|
|
|
|
optLibjack2 = shouldUsePkg libjack2;
|
|
|
|
optDbus = shouldUsePkg dbus;
|
|
|
|
optDbus_cplusplus = shouldUsePkg dbus_cplusplus;
|
|
|
|
optAlsaLib = shouldUsePkg alsaLib;
|
|
|
|
optPyqt4 = shouldUsePkg pyqt4;
|
2016-08-16 20:51:21 +00:00
|
|
|
optPythonDBus = shouldUsePkg dbus-python;
|
2015-04-26 03:14:28 +00:00
|
|
|
optXdg_utils = shouldUsePkg xdg_utils;
|
|
|
|
in
|
2012-04-05 21:53:42 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2015-04-26 03:14:28 +00:00
|
|
|
name = "${prefix}ffado-${version}";
|
2017-08-25 20:06:56 +00:00
|
|
|
version = "2.3.0";
|
2012-04-05 21:53:42 +00:00
|
|
|
|
2012-09-30 19:23:28 +00:00
|
|
|
src = fetchurl {
|
2015-04-26 03:14:28 +00:00
|
|
|
url = "http://www.ffado.org/files/libffado-${version}.tgz";
|
2017-08-25 20:06:56 +00:00
|
|
|
sha256 = "122z8gya60nyg47i738z2yr4qcjyk2xix4kwhf5ybkmp23kcgqqq";
|
2012-04-05 21:53:42 +00:00
|
|
|
};
|
|
|
|
|
2015-04-26 03:14:28 +00:00
|
|
|
nativeBuildInputs = [ scons pkgconfig which makeWrapper python ];
|
2012-04-05 21:53:42 +00:00
|
|
|
|
2015-04-26 03:14:28 +00:00
|
|
|
buildInputs = [
|
|
|
|
expat libraw1394 libconfig libavc1394 libiec61883
|
|
|
|
] ++ stdenv.lib.optionals (!libOnly) [
|
|
|
|
optLibjack2 optDbus optDbus_cplusplus optAlsaLib optPyqt4
|
2017-08-25 20:06:56 +00:00
|
|
|
optXdg_utils libxmlxx glibmm
|
2015-04-26 03:14:28 +00:00
|
|
|
];
|
2012-04-07 23:57:30 +00:00
|
|
|
|
2017-11-08 17:35:07 +00:00
|
|
|
patches = [
|
|
|
|
./gcc6.patch
|
|
|
|
./glibc226.patch
|
|
|
|
];
|
2015-04-26 03:14:28 +00:00
|
|
|
|
|
|
|
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 17:50:22 +00:00
|
|
|
sed '/def is_userspace_32bit(cpuinfo):/a\
|
2015-04-26 03:14:28 +00: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 17:50:22 +00:00
|
|
|
'';
|
|
|
|
|
2017-08-25 20:06:56 +00:00
|
|
|
preConfigure = ''
|
|
|
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags libxml++-2.6)"
|
|
|
|
'';
|
|
|
|
|
2012-04-07 23:57:30 +00:00
|
|
|
# TODO fix ffado-diag, it doesn't seem to use PYPKGDIR
|
2012-09-30 19:23:28 +00:00
|
|
|
buildPhase = ''
|
2015-04-26 03:14:28 +00:00
|
|
|
export PYDIR=$out/lib/${python.libPrefix}/site-packages
|
2012-09-30 19:23:28 +00:00
|
|
|
|
2015-04-26 03:14:28 +00:00
|
|
|
scons PYPKGDIR=$PYDIR DEBUG=False \
|
|
|
|
ENABLE_ALL=True \
|
|
|
|
SERIALIZE_USE_EXPAT=True \
|
|
|
|
'';
|
2012-04-07 23:57:30 +00:00
|
|
|
|
2015-04-26 03:14:28 +00: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-02 22:54:30 +00:00
|
|
|
'' + stdenv.lib.optionalString (optPyqt4 != null && optPythonDBus != null) ''
|
2012-04-07 23:57:30 +00:00
|
|
|
wrapProgram $out/bin/ffado-mixer --prefix PYTHONPATH : \
|
2015-05-02 22:54:30 +00:00
|
|
|
$PYTHONPATH:$PYDIR:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX:
|
|
|
|
|
2012-04-07 23:57:30 +00:00
|
|
|
wrapProgram $out/bin/ffado-diag --prefix PYTHONPATH : \
|
2015-05-02 22:54:30 +00:00
|
|
|
$PYTHONPATH:$PYDIR:$out/share/libffado/python:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX:
|
2015-04-26 03:14:28 +00:00
|
|
|
'';
|
2012-04-05 21:53:42 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = http://www.ffado.org;
|
2012-04-07 23:57:30 +00:00
|
|
|
description = "FireWire audio drivers";
|
2012-04-05 21:53:42 +00:00
|
|
|
license = licenses.gpl3;
|
2015-04-26 17:24:43 +00:00
|
|
|
maintainers = with maintainers; [ goibhniu wkennington ];
|
2014-03-16 11:08:26 +00:00
|
|
|
platforms = platforms.linux;
|
2012-04-05 21:53:42 +00:00
|
|
|
};
|
|
|
|
}
|