From eea4d338fe0976ae8b2aa95b0bc63ce8f706b5ee Mon Sep 17 00:00:00 2001 From: "Alexander V. Nikolaev" Date: Fri, 6 Apr 2018 03:16:52 +0300 Subject: [PATCH 1/2] libffado: refactor lib-prefixed package We can't say final farewell for it, due ffado-mixer, which give us nice build-loop, so postpone it until I (or someone other) write separate derivation for mixer-only (because is just python script, with dependencies in PyQT/PyDbus) --- pkgs/os-specific/linux/ffado/default.nix | 60 +++++++++++++----------- pkgs/top-level/all-packages.nix | 1 - 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/pkgs/os-specific/linux/ffado/default.nix b/pkgs/os-specific/linux/ffado/default.nix index 4e3e373d244c7..dc6be48cabf66 100644 --- a/pkgs/os-specific/linux/ffado/default.nix +++ b/pkgs/os-specific/linux/ffado/default.nix @@ -1,30 +1,42 @@ { stdenv, fetchurl, scons, pkgconfig, which, makeWrapper, python -, expat, libraw1394, libconfig, libavc1394, libiec61883, libxmlxx, glibmm +, expat, libraw1394, libconfig, libavc1394, libiec61883, libxmlxx +, alsaLib, dbus, dbus_cplusplus # Optional dependencies -, libjack2 ? null, dbus ? null, dbus_cplusplus ? null, alsaLib ? null , pyqt4 ? null, dbus-python ? null, xdg_utils ? null # Other Flags -, prefix ? "" +, libOnly ? false }: let shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; - libOnly = prefix == "lib"; - - optLibjack2 = shouldUsePkg libjack2; - optDbus = shouldUsePkg dbus; - optDbus_cplusplus = shouldUsePkg dbus_cplusplus; - optAlsaLib = shouldUsePkg alsaLib; +# Mixer/tools dependencies +# FIXME: can we build mixer separately? Then we can farewell `libOnly` mode +# (otherwise we have perfect loop via qt -> pulseaudio -> jack -> ffado -> qt) +# FIXME: it should work with pyqt5 as well (so we can farewell `qt4` sometimes) optPyqt4 = shouldUsePkg pyqt4; optPythonDBus = shouldUsePkg dbus-python; optXdg_utils = shouldUsePkg xdg_utils; + + PYDIR="$out/lib/${python.libPrefix}/site-packages"; + SCONS_OPTIONS = '' + PREFIX=$out \ + PYPKGDIR=${PYDIR} \ + DEBUG=False \ + ENABLE_ALL=True \ + SERIALIZE_USE_EXPAT=True \ + BUILD_TESTS=False \ + UDEVDIR=$out/lib/udev/rules.d \ + BINDIR=$bin/bin \ + INCLUDEDIR=$dev/include \ + BUILD_MIXER=${if libOnly then "False" else "True"} \ + ''; in stdenv.mkDerivation rec { - name = "${prefix}ffado-${version}"; + name = "ffado-${version}"; version = "2.4.0"; src = fetchurl { @@ -32,13 +44,14 @@ stdenv.mkDerivation rec { sha256 = "14rprlcd0gpvg9kljh0zzjzd2rc9hbqqpjidshxxjvvfh4r00f4f"; }; + outputs = [ "out" "bin" "dev" ]; + nativeBuildInputs = [ scons pkgconfig which makeWrapper python ]; buildInputs = [ - expat libraw1394 libconfig libavc1394 libiec61883 + expat libraw1394 libconfig libavc1394 libiec61883 dbus dbus_cplusplus libxmlxx ] ++ stdenv.lib.optionals (!libOnly) [ - optLibjack2 optDbus optDbus_cplusplus optAlsaLib optPyqt4 - optXdg_utils libxmlxx glibmm + optXdg_utils ]; postPatch = '' @@ -62,25 +75,18 @@ stdenv.mkDerivation rec { # TODO fix ffado-diag, it doesn't seem to use PYPKGDIR buildPhase = '' - export PYDIR=$out/lib/${python.libPrefix}/site-packages - - scons PYPKGDIR=$PYDIR DEBUG=False \ - ENABLE_ALL=True \ - SERIALIZE_USE_EXPAT=True \ + scons ${SCONS_OPTIONS} ''; - 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) '' + installPhase = '' + scons ${SCONS_OPTIONS} install + '' + stdenv.lib.optionalString (!libOnly && optPyqt4 != null && optPythonDBus != null) '' wrapProgram $out/bin/ffado-mixer --prefix PYTHONPATH : \ - $PYTHONPATH:$PYDIR:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX: + $PYTHONPATH:${PYDIR}:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX: wrapProgram $out/bin/ffado-diag --prefix PYTHONPATH : \ - $PYTHONPATH:$PYDIR:$out/share/libffado/python:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX: - ''; + $PYTHONPATH:${PYDIR}:$out/share/libffado/python:${optPyqt4}/$LIBSUFFIX:${optPythonDBus}/$LIBSUFFIX: + ''; meta = with stdenv.lib; { homepage = http://www.ffado.org; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fd778deea95d2..1d99c138972c0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13375,7 +13375,6 @@ with pkgs; ffado = callPackage ../os-specific/linux/ffado { inherit (python2Packages) python pyqt4 dbus-python; }; - libffado = ffado.override { prefix = "lib"; }; fbterm = callPackage ../os-specific/linux/fbterm { }; From 3b07e9fdc48627c705216533ab6198100d82f952 Mon Sep 17 00:00:00 2001 From: "Alexander V. Nikolaev" Date: Wed, 13 Jun 2018 21:54:19 +0300 Subject: [PATCH 2/2] ffado: finish mixer splitting --- pkgs/os-specific/linux/ffado/default.nix | 49 +++++++++++------------- pkgs/top-level/all-packages.nix | 4 +- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/pkgs/os-specific/linux/ffado/default.nix b/pkgs/os-specific/linux/ffado/default.nix index dc6be48cabf66..1cab7e4523b60 100644 --- a/pkgs/os-specific/linux/ffado/default.nix +++ b/pkgs/os-specific/linux/ffado/default.nix @@ -3,25 +3,19 @@ , alsaLib, dbus, dbus_cplusplus # Optional dependencies -, pyqt4 ? null, dbus-python ? null, xdg_utils ? null - -# Other Flags -, libOnly ? false +, pyqt4 ? null, dbus-python ? null + +# ffado contain two (actually) independed packages core libraries and mixer, +# each of them have completely independed set of dependencies, and mixer even +# not use libraries for core packages. So `mixerOnly` parameter change logic of +# these expression, patching out all-but-mixer. Otherwise we have perfect build loop +# (via ffado -> pyqt4 -> qt4 -> pulseaudio -> ffado) +, mixerOnly ? false }: let - - shouldUsePkg = pkg: if pkg != null && pkg.meta.available then pkg else null; - -# Mixer/tools dependencies -# FIXME: can we build mixer separately? Then we can farewell `libOnly` mode -# (otherwise we have perfect loop via qt -> pulseaudio -> jack -> ffado -> qt) -# FIXME: it should work with pyqt5 as well (so we can farewell `qt4` sometimes) - optPyqt4 = shouldUsePkg pyqt4; - optPythonDBus = shouldUsePkg dbus-python; - optXdg_utils = shouldUsePkg xdg_utils; - PYDIR="$out/lib/${python.libPrefix}/site-packages"; + BINDIR = if mixerOnly then "$out/bin" else "$bin/bin"; SCONS_OPTIONS = '' PREFIX=$out \ PYPKGDIR=${PYDIR} \ @@ -30,13 +24,14 @@ let SERIALIZE_USE_EXPAT=True \ BUILD_TESTS=False \ UDEVDIR=$out/lib/udev/rules.d \ - BINDIR=$bin/bin \ + BINDIR=${BINDIR} \ INCLUDEDIR=$dev/include \ - BUILD_MIXER=${if libOnly then "False" else "True"} \ + WILL_DEAL_WITH_XDG_MYSELF=True \ + BUILD_MIXER=${if mixerOnly then "True" else "False"} \ ''; in stdenv.mkDerivation rec { - name = "ffado-${version}"; + name = "ffado-${if mixerOnly then "mixer" else "core"}-${version}"; version = "2.4.0"; src = fetchurl { @@ -44,14 +39,14 @@ stdenv.mkDerivation rec { sha256 = "14rprlcd0gpvg9kljh0zzjzd2rc9hbqqpjidshxxjvvfh4r00f4f"; }; - outputs = [ "out" "bin" "dev" ]; + outputs = if mixerOnly then [ "out" ] else [ "out" "bin" "dev" ]; nativeBuildInputs = [ scons pkgconfig which makeWrapper python ]; buildInputs = [ expat libraw1394 libconfig libavc1394 libiec61883 dbus dbus_cplusplus libxmlxx - ] ++ stdenv.lib.optionals (!libOnly) [ - optXdg_utils + ] ++ stdenv.lib.optionals mixerOnly [ + pyqt4 dbus-python ]; postPatch = '' @@ -67,6 +62,9 @@ stdenv.mkDerivation rec { sed -i -e '1i #include ' \ -e '1i #include "version.h"' \ src/libutil/serialize_expat.cpp + '' + stdenv.lib.optionalString mixerOnly '' + sed 's!dirs=subdirs!dirs=["support/mixer-qt4"]!' -i SConstruct + sed "/env.Install/ d" -i SConstruct ''; preConfigure = '' @@ -79,13 +77,10 @@ stdenv.mkDerivation rec { ''; installPhase = '' - scons ${SCONS_OPTIONS} install - '' + stdenv.lib.optionalString (!libOnly && optPyqt4 != null && optPythonDBus != null) '' + scons ${SCONS_OPTIONS} ${if mixerOnly then "${BINDIR} ${PYDIR}" else "install"} + '' + stdenv.lib.optionalString mixerOnly '' 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: + $PYTHONPATH:${PYDIR}:${pyqt4}/$LIBSUFFIX:${dbus-python}/$LIBSUFFIX: ''; meta = with stdenv.lib; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1d99c138972c0..212084cafa8e2 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13372,8 +13372,10 @@ with pkgs; fatrace = callPackage ../os-specific/linux/fatrace { }; - ffado = callPackage ../os-specific/linux/ffado { + ffado = callPackage ../os-specific/linux/ffado { }; + ffado-mixer = callPackage ../os-specific/linux/ffado { inherit (python2Packages) python pyqt4 dbus-python; + mixerOnly = true; }; fbterm = callPackage ../os-specific/linux/fbterm { };