libffado: refactor lib-prefixed package
This commit is contained in:
parent
e422585c0d
commit
78cabc3ca9
|
@ -1,30 +1,12 @@
|
||||||
{ stdenv, fetchurl, scons, pkgconfig, which, makeWrapper, python
|
{ stdenv, fetchurl, scons, pkgconfig, which, makeWrapper, python
|
||||||
, expat, libraw1394, libconfig, libavc1394, libiec61883, libxmlxx, glibmm
|
, expat, libraw1394, libconfig, libavc1394, libiec61883, libxmlxx
|
||||||
|
, glibmm
|
||||||
# Optional dependencies
|
, alsaLib, dbus, dbus_cplusplus
|
||||||
, libjack2 ? null, dbus ? null, dbus_cplusplus ? null, alsaLib ? null
|
, pyqt4, dbus-python
|
||||||
, pyqt4 ? null, dbus-python ? null, xdg_utils ? null
|
|
||||||
|
|
||||||
# Other Flags
|
|
||||||
, prefix ? ""
|
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
|
||||||
|
|
||||||
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms then pkg else null;
|
|
||||||
|
|
||||||
libOnly = prefix == "lib";
|
|
||||||
|
|
||||||
optLibjack2 = shouldUsePkg libjack2;
|
|
||||||
optDbus = shouldUsePkg dbus;
|
|
||||||
optDbus_cplusplus = shouldUsePkg dbus_cplusplus;
|
|
||||||
optAlsaLib = shouldUsePkg alsaLib;
|
|
||||||
optPyqt4 = shouldUsePkg pyqt4;
|
|
||||||
optPythonDBus = shouldUsePkg dbus-python;
|
|
||||||
optXdg_utils = shouldUsePkg xdg_utils;
|
|
||||||
in
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
name = "${prefix}ffado-${version}";
|
name = "ffado-${version}";
|
||||||
version = "2.4.0";
|
version = "2.4.0";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
|
@ -32,54 +14,47 @@ stdenv.mkDerivation rec {
|
||||||
sha256 = "14rprlcd0gpvg9kljh0zzjzd2rc9hbqqpjidshxxjvvfh4r00f4f";
|
sha256 = "14rprlcd0gpvg9kljh0zzjzd2rc9hbqqpjidshxxjvvfh4r00f4f";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
outputs = [ "out" "bin" "dev" ];
|
||||||
|
|
||||||
nativeBuildInputs = [ scons pkgconfig which makeWrapper python ];
|
nativeBuildInputs = [ scons pkgconfig which makeWrapper python ];
|
||||||
|
|
||||||
|
prefixKey = "PREFIX=";
|
||||||
|
sconsFlags = [
|
||||||
|
"DEBUG=False"
|
||||||
|
"ENABLE_ALL=True"
|
||||||
|
"SERIALIZE_USE_EXPAT=True"
|
||||||
|
"BUILD_TESTS=False"
|
||||||
|
"WILL_DEAL_WITH_XDG_MYSELF=True"
|
||||||
|
"BUILD_MIXER=True"
|
||||||
|
];
|
||||||
|
|
||||||
|
configurePhase = ''
|
||||||
|
mkdir -p $out/lib/udev/rules.d $bin/bin $dev/include \
|
||||||
|
$out/lib/${python.libPrefix}/site-packages
|
||||||
|
sconsFlagsArray+=(UDEVDIR=$out/lib/udev/rules.d)
|
||||||
|
sconsFlagsArray+=(PYPKGDIR=$out/lib/${python.libPrefix}/site-packages)
|
||||||
|
sconsFlagsArray+=(BINDIR=$bin/bin)
|
||||||
|
sconsFlagsArray+=(INCLUDEDIR=$dev/include)
|
||||||
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags libxml++-2.6)"
|
||||||
|
'';
|
||||||
|
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
expat libraw1394 libconfig libavc1394 libiec61883
|
expat libraw1394 libconfig libavc1394 libiec61883 dbus dbus_cplusplus
|
||||||
] ++ stdenv.lib.optionals (!libOnly) [
|
libxmlxx pyqt4 dbus-python glibmm
|
||||||
optLibjack2 optDbus optDbus_cplusplus optAlsaLib optPyqt4
|
|
||||||
optXdg_utils libxmlxx glibmm
|
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
sed '1iimport sys' -i SConstruct
|
sed '1iimport sys' -i SConstruct
|
||||||
# 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
|
|
||||||
sed '/def is_userspace_32bit(cpuinfo):/a\
|
|
||||||
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
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preConfigure = ''
|
postInstall = ''
|
||||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags libxml++-2.6)"
|
for exe in $bin/bin/ffado-mixer $bin/bin/ffado-diag; do
|
||||||
'';
|
wrapProgram $exe \
|
||||||
|
--prefix PYTHONPATH : $out/lib/${python.libPrefix}/site-packages \
|
||||||
# TODO fix ffado-diag, it doesn't seem to use PYPKGDIR
|
--prefix PYTHONPATH : $out/share/libffado/python \
|
||||||
buildPhase = ''
|
--prefix PYTHONPATH : ${pyqt4}/lib/${python.libPrefix}/site-packages \
|
||||||
export PYDIR=$out/lib/${python.libPrefix}/site-packages
|
--prefix PYTHONPATH : ${dbus-python}/lib/${python.libPrefix}/site-packages
|
||||||
|
done
|
||||||
scons PYPKGDIR=$PYDIR DEBUG=False \
|
|
||||||
ENABLE_ALL=True \
|
|
||||||
SERIALIZE_USE_EXPAT=True \
|
|
||||||
'';
|
|
||||||
|
|
||||||
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
|
|
||||||
'' + stdenv.lib.optionalString (optPyqt4 != null && optPythonDBus != null) ''
|
|
||||||
wrapProgram $out/bin/ffado-mixer --prefix PYTHONPATH : \
|
|
||||||
$PYTHONPATH:$PYDIR:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX:
|
|
||||||
|
|
||||||
wrapProgram $out/bin/ffado-diag --prefix PYTHONPATH : \
|
|
||||||
$PYTHONPATH:$PYDIR:$out/share/libffado/python:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX:
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
|
|
|
@ -14326,7 +14326,7 @@ in
|
||||||
ffado = callPackage ../os-specific/linux/ffado {
|
ffado = callPackage ../os-specific/linux/ffado {
|
||||||
inherit (python2Packages) python pyqt4 dbus-python;
|
inherit (python2Packages) python pyqt4 dbus-python;
|
||||||
};
|
};
|
||||||
libffado = ffado.override { prefix = "lib"; };
|
libffado = ffado;
|
||||||
|
|
||||||
fbterm = callPackage ../os-specific/linux/fbterm { };
|
fbterm = callPackage ../os-specific/linux/fbterm { };
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue