diff options
author | Aaron Lindsay <aerialx@users.noreply.github.com> | 2019-07-02 13:46:54 -0700 |
---|---|---|
committer | Aaron Lindsay <aerialx@users.noreply.github.com> | 2020-06-01 16:53:43 -0700 |
commit | ceef1d2f27b4e1be6d6e3a49ed72c4c7501087df (patch) | |
tree | 8a8e10e4cd227102a7defec0a692a28e57ca6ddc | |
parent | 1436bb9968fd14f2b992b2150c83d9b671d3a75e (diff) |
mspdebug: fix darwin build
-rw-r--r-- | pkgs/development/misc/msp430/mspdebug.nix | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/pkgs/development/misc/msp430/mspdebug.nix b/pkgs/development/misc/msp430/mspdebug.nix index f8abc15de574c..181907a55441c 100644 --- a/pkgs/development/misc/msp430/mspdebug.nix +++ b/pkgs/development/misc/msp430/mspdebug.nix @@ -3,8 +3,11 @@ , libusb-compat-0_1 , readline ? null , enableReadline ? true +, hidapi ? null +, pkg-config ? null }: +assert stdenv.isDarwin -> hidapi != null && pkg-config != null; assert enableReadline -> readline != null; stdenv.mkDerivation rec { @@ -17,11 +20,24 @@ stdenv.mkDerivation rec { sha256 = "0prgwb5vx6fd4bj12ss1bbb6axj2kjyriyjxqrzd58s5jyyy8d3c"; }; + enableParallelBuilding = true; + nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin pkg-config; buildInputs = [ libusb-compat-0_1 ] + ++ stdenv.lib.optional stdenv.isDarwin hidapi ++ stdenv.lib.optional enableReadline readline; + + postPatch = stdenv.lib.optionalString stdenv.isDarwin '' + # TODO: remove once a new 0.26+ release is made + substituteInPlace drivers/tilib_api.c --replace .so ${stdenv.hostPlatform.extensions.sharedLibrary} + + # Makefile only uses pkg-config if it detects homebrew + substituteInPlace Makefile --replace brew true + ''; + installFlags = [ "PREFIX=$(out)" "INSTALL=install" ]; - makeFlags = stdenv.lib.optional (!enableReadline) "WITHOUT_READLINE=1"; - enableParallelBuilding = true; + makeFlags = [ "UNAME_S=$(unameS)" ] ++ + stdenv.lib.optional (!enableReadline) "WITHOUT_READLINE=1"; + unameS = stdenv.lib.optionalString stdenv.isDarwin "Darwin"; meta = with stdenv.lib; { description = "A free programmer, debugger, and gdb proxy for MSP430 MCUs"; |