libjack2: fix darwin build

This commit is contained in:
Daiderd Jordan
2017-09-23 22:33:48 +02:00
parent bb02b800a2
commit 7d98316a97
4 changed files with 95 additions and 5 deletions
+23 -5
View File
@@ -1,9 +1,12 @@
{ stdenv, fetchFromGitHub, pkgconfig, python2Packages, makeWrapper
, bash, libsamplerate, libsndfile, readline, eigen, celt
# Darwin Dependencies
, aften, AudioToolbox, CoreAudio, CoreFoundation
# Optional Dependencies
, dbus ? null, libffado ? null, alsaLib ? null
, libopus ? null
, darwin
# Extra options
, prefix ? ""
@@ -16,7 +19,7 @@ let
libOnly = prefix == "lib";
optDbus = shouldUsePkg dbus;
optDbus = if stdenv.isDarwin then null else 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;
@@ -34,21 +37,36 @@ stdenv.mkDerivation rec {
};
nativeBuildInputs = [ pkgconfig python makeWrapper ];
buildInputs = [ python libsamplerate libsndfile readline eigen celt
buildInputs = [ libsamplerate libsndfile readline eigen celt
optDbus optPythonDBus optLibffado optAlsaLib optLibopus
];
] ++ stdenv.lib.optionals stdenv.isDarwin [ aften AudioToolbox CoreAudio CoreFoundation ];
patchPhase = ''
substituteInPlace svnversion_regenerate.sh --replace /bin/bash ${bash}/bin/bash
# CoreFoundation 10.10 doesn't include CFNotificationCenter.h yet.
patches = stdenv.lib.optionals stdenv.isDarwin [ ./clang.patch ./darwin-cf.patch ];
prePatch = ''
substituteInPlace svnversion_regenerate.sh \
--replace /bin/bash ${bash}/bin/bash
'';
# It looks like one of the frameworks depends on <CoreFoundation/CFAttributedString.h>
# since frameworks are impure we also have to use the impure CoreFoundation here.
# FIXME: remove when CoreFoundation is updated to 10.11
preConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
export NIX_CFLAGS_COMPILE="-F${CoreFoundation}/Library/Frameworks $NIX_CFLAGS_COMPILE"
'';
configurePhase = ''
runHook preConfigure
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"} \
runHook postConfigure
'';
buildPhase = ''