nixpkgs-suyu/pkgs/misc/jackaudio/unstable.nix
2016-11-07 12:59:05 +01:00

78 lines
2.2 KiB
Nix

{ stdenv, fetchFromGitHub, pkgconfig, python2Packages, makeWrapper
, bash, libsamplerate, libsndfile, readline, eigen, celt
# Optional Dependencies
, dbus ? null, libffado ? null, alsaLib ? null
, libopus ? null
# Extra options
, prefix ? ""
}:
with stdenv.lib;
let
inherit (python2Packages) python dbus-python;
shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (x: x == stdenv.system) pkg.meta.platforms then pkg else null;
libOnly = prefix == "lib";
optDbus = shouldUsePkg dbus;
optPythonDBus = if libOnly then null else shouldUsePkg dbus-python;
optLibffado = if libOnly then null else shouldUsePkg libffado;
optAlsaLib = if libOnly then null else shouldUsePkg alsaLib;
optLibopus = shouldUsePkg libopus;
in
stdenv.mkDerivation rec {
name = "${prefix}jack2-unstable-${version}";
version = "2016-08-18";
src = fetchFromGitHub {
owner = "jackaudio";
repo = "jack2";
rev = "f2ece2418c875eb7e7ac3d25fbb484ddda47ab46";
sha256 = "0cvb0m6qz3k8a5njwyw65l4y3izi2rsh512hv5va97kjc6wzzx4j";
};
nativeBuildInputs = [ pkgconfig python makeWrapper ];
buildInputs = [
python
libsamplerate libsndfile readline eigen celt
optDbus optPythonDBus optLibffado optAlsaLib optLibopus
];
patchPhase = ''
substituteInPlace svnversion_regenerate.sh --replace /bin/bash ${bash}/bin/bash
'';
configurePhase = ''
python waf configure --prefix=$out \
${optionalString (optDbus != null) "--dbus"} \
--classic \
${optionalString (optLibffado != null) "--firewire"} \
${optionalString (optAlsaLib != null) "--alsa"} \
--autostart=${if (optDbus != null) then "dbus" else "classic"} \
'';
buildPhase = ''
python waf build
'';
installPhase = ''
python waf install
'' + (if libOnly then ''
rm -rf $out/{bin,share}
rm -rf $out/lib/{jack,libjacknet*,libjackserver*}
'' else ''
wrapProgram $out/bin/jack_control --set PYTHONPATH $PYTHONPATH
'');
meta = {
description = "JACK audio connection kit, version 2 with jackdbus";
homepage = "http://jackaudio.org";
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ goibhniu wkennington ];
};
}