3
0
Fork 0
forked from mirrors/nixpkgs

ffado: Refactor

This commit is contained in:
William A. Kennington III 2015-04-25 20:14:28 -07:00
parent f11859b464
commit 60a39dec54
4 changed files with 124 additions and 55 deletions

View file

@ -0,0 +1,61 @@
diff --git a/SConstruct b/SConstruct
index ca5d5cf..76738e3 100644
--- a/SConstruct
+++ b/SConstruct
@@ -354,7 +354,7 @@ if conf.CheckForApp( 'which pyuic4' ) and conf.CheckForPyModule( 'dbus' ) and co
env['PYUIC4'] = True
build_mixer = True
-if conf.CheckForApp( 'xdg-desktop-menu --help' ):
+if conf.CheckForApp( 'which xdg-desktop-menu' ):
env['XDG_TOOLS'] = True
else:
print """
diff --git a/support/dbus/SConscript b/support/dbus/SConscript
index 2b0f0c6..23069d8 100644
--- a/support/dbus/SConscript
+++ b/support/dbus/SConscript
@@ -44,6 +44,7 @@ if not env.GetOption( "clean" ):
env.MergeFlags( env['LIBXML26_FLAGS'] )
else:
env.PrependUnique( LIBS=["expat"] )
+ env.MergeFlags( "-DSERIALIZE_USE_EXPAT" )
env.Xml2Cpp_Proxy('controlclient-glue.h', 'control-interface.xml')
env.Xml2Cpp_Adaptor('controlserver-glue.h', 'control-interface.xml')
diff --git a/support/firmware/SConscript b/support/firmware/SConscript
index 2939cb0..307b295 100644
--- a/support/firmware/SConscript
+++ b/support/firmware/SConscript
@@ -36,6 +36,7 @@ if not env.GetOption( "clean" ):
env.MergeFlags( env['LIBXML26_FLAGS'] )
else:
env.PrependUnique( LIBS=["expat"] )
+ env.MergeFlags( "-DSERIALIZE_USE_EXPAT" )
static_env = env.Clone()
diff --git a/support/tools/SConscript b/support/tools/SConscript
index 651621d..01b11f4 100644
--- a/support/tools/SConscript
+++ b/support/tools/SConscript
@@ -36,6 +36,7 @@ if not e.GetOption( "clean" ):
e.MergeFlags( env['LIBXML26_FLAGS'] )
else:
e.PrependUnique( LIBS=["expat"] )
+ e.MergeFlags( "-DSERIALIZE_USE_EXPAT" )
#
# For the the ffado-diag tools
diff --git a/tests/SConscript b/tests/SConscript
index 307341f..4800b93 100644
--- a/tests/SConscript
+++ b/tests/SConscript
@@ -35,6 +35,7 @@ if not env.GetOption( "clean" ):
env.MergeFlags( env['LIBXML26_FLAGS'] )
else:
env.PrependUnique( LIBS=["expat"] )
+ env.MergeFlags( "-DSERIALIZE_USE_EXPAT" )
static_env = env.Clone()

View file

@ -1,54 +1,87 @@
{ stdenv, fetchurl, dbus, dbus_cplusplus, expat, glibmm, libconfig
, libavc1394, libiec61883, libraw1394, libxmlxx, makeWrapper, pkgconfig
, pyqt4, python, pythonDBus, qt4, scons }:
{ stdenv, fetchurl, scons, pkgconfig, which, makeWrapper, python
, expat, libraw1394, libconfig, libavc1394, libiec61883
# Optional dependencies
, libjack2 ? null, dbus ? null, dbus_cplusplus ? null, alsaLib ? null
, pyqt4 ? null, xdg_utils ? null
, glibmm
, pythonDBus, qt4
# Other Flags
, prefix ? ""
}:
let
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) 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;
optXdg_utils = shouldUsePkg xdg_utils;
in
stdenv.mkDerivation rec {
name = "libffado-${version}";
name = "${prefix}ffado-${version}";
version = "2.2.1";
src = fetchurl {
url = "http://www.ffado.org/files/${name}.tgz";
url = "http://www.ffado.org/files/libffado-${version}.tgz";
sha256 = "1ximic90l0av91njb123ra2zp6mg23yg5iz8xa5371cqrn79nacz";
};
buildInputs =
[ dbus dbus_cplusplus expat glibmm libavc1394 libconfig
libiec61883 libraw1394 libxmlxx makeWrapper pkgconfig pyqt4
python pythonDBus qt4 scons
];
nativeBuildInputs = [ scons pkgconfig which makeWrapper python ];
patches = [ ./enable-mixer-and-dbus.patch ];
buildInputs = [
expat libraw1394 libconfig libavc1394 libiec61883
] ++ stdenv.lib.optionals (!libOnly) [
optLibjack2 optDbus optDbus_cplusplus optAlsaLib optPyqt4
optXdg_utils
# dbus dbus_cplusplus glibmm
# pyqt4
# python pythonDBus qt4
];
# 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
postPatch = if stdenv.isi686 then ''
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
sed '/def is_userspace_32bit(cpuinfo):/a\
return True' -i SConstruct
''
else ''
sed '/def is_userspace_32bit(cpuinfo):/a\
return False' -i SConstruct
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
'';
# TODO fix ffado-diag, it doesn't seem to use PYPKGDIR
buildPhase = ''
export PYLIBSUFFIX=lib/${python.libPrefix}/site-packages
scons PYPKGDIR=$out/$PYLIBSUFFIX DEBUG=False
sed -e "s#/usr/local#$out#" -i support/mixer-qt4/ffado/config.py
'';
export PYDIR=$out/lib/${python.libPrefix}/site-packages
installPhase = ''
scons PREFIX=$out LIBDIR=$out/lib SHAREDIR=$out/share/libffado \
PYPKGDIR=$out/$PYLIBSUFFIX UDEVDIR=$out/lib/udev/rules.d install
scons PYPKGDIR=$PYDIR DEBUG=False \
ENABLE_ALL=True \
SERIALIZE_USE_EXPAT=True \
'';
sed -e "s#/usr/local#$out#g" -i $out/bin/ffado-diag
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
PYDIR=$out/$PYLIBSUFFIX
wrapProgram $out/bin/ffado-mixer --prefix PYTHONPATH : \
$PYTHONPATH:$PYDIR:${pyqt4}/$LIBSUFFIX:${pythonDBus}/$LIBSUFFIX:
wrapProgram $out/bin/ffado-diag --prefix PYTHONPATH : \
$PYTHONPATH:$PYDIR:$out/share/libffado/python:${pyqt4}/$LIBSUFFIX:${pythonDBus}/$LIBSUFFIX:
'';
'';
meta = with stdenv.lib; {
homepage = http://www.ffado.org;

View file

@ -1,26 +0,0 @@
--- libffado-2.1.0/SConstruct 1970-01-01 01:00:01.000000000 +0100
+++ libffado-2.1.0/SConstruct 2012-09-30 16:50:23.603283095 +0000
@@ -349,11 +349,9 @@
# Optional checks follow:
#
-# PyQT checks
-build_mixer = False
-if conf.CheckForApp( 'which pyuic4' ) and conf.CheckForPyModule( 'dbus' ) and conf.CheckForPyModule( 'PyQt4' ) and conf.CheckForPyModule( 'dbus.mainloop.qt' ):
- env['PYUIC4'] = True
- build_mixer = True
+env['PYUIC4'] = True
+build_mixer = True
+
if conf.CheckForApp( 'xdg-desktop-menu --help' ):
env['XDG_TOOLS'] = True
@@ -384,7 +382,7 @@
name2 = pkg.replace("+","").replace(".","").replace("-","").upper()
env['%s_FLAGS' % name2] = conf.GetPKGFlags( pkg, pkgs[pkg] )
-if not env['DBUS1_FLAGS'] or not env['DBUSC1_FLAGS'] or not conf.CheckForApp('which dbusxx-xml2cpp'):
+if False:
env['DBUS1_FLAGS'] = ""
env['DBUSC1_FLAGS'] = ""
print """

View file

@ -8993,6 +8993,7 @@ let
fatrace = callPackage ../os-specific/linux/fatrace { };
ffado = callPackage ../os-specific/linux/ffado { };
libffado = ffado.override { prefix = "lib"; };
fbterm = callPackage ../os-specific/linux/fbterm { };