summary refs log tree commit diff
path: root/pkgs/development/misc
diff options
context:
space:
mode:
authorAaron Lindsay <aerialx@users.noreply.github.com>2019-03-30 15:54:39 -0700
committerAaron Lindsay <aerialx@users.noreply.github.com>2020-06-01 16:59:58 -0700
commit5ba76e94ec8d4d90f1f38b2ac9a2f5800fee0173 (patch)
tree7e13fec7a5539141556e4df29de8ab724510fd8d /pkgs/development/misc
parentceef1d2f27b4e1be6d6e3a49ed72c4c7501087df (diff)
downloadnixpkgs-5ba76e94ec8d4d90f1f38b2ac9a2f5800fee0173.tar
nixpkgs-5ba76e94ec8d4d90f1f38b2ac9a2f5800fee0173.tar.gz
nixpkgs-5ba76e94ec8d4d90f1f38b2ac9a2f5800fee0173.tar.bz2
nixpkgs-5ba76e94ec8d4d90f1f38b2ac9a2f5800fee0173.tar.lz
nixpkgs-5ba76e94ec8d4d90f1f38b2ac9a2f5800fee0173.tar.xz
nixpkgs-5ba76e94ec8d4d90f1f38b2ac9a2f5800fee0173.tar.zst
nixpkgs-5ba76e94ec8d4d90f1f38b2ac9a2f5800fee0173.zip
mspdebug: optional runtime dependency on TI libmsp430
Diffstat (limited to 'pkgs/development/misc')
-rw-r--r--pkgs/development/misc/msp430/mspdebug.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkgs/development/misc/msp430/mspdebug.nix b/pkgs/development/misc/msp430/mspdebug.nix
index 181907a5544..471dd5b3122 100644
--- a/pkgs/development/misc/msp430/mspdebug.nix
+++ b/pkgs/development/misc/msp430/mspdebug.nix
@@ -1,14 +1,18 @@
 { stdenv
 , fetchFromGitHub
+, autoPatchelfHook
 , libusb-compat-0_1
 , readline ? null
 , enableReadline ? true
 , hidapi ? null
 , pkg-config ? null
+, mspds ? null
+, enableMspds ? false
 }:
 
 assert stdenv.isDarwin -> hidapi != null && pkg-config != null;
 assert enableReadline -> readline != null;
+assert enableMspds -> mspds != null;
 
 stdenv.mkDerivation rec {
   version = "0.25";
@@ -21,7 +25,8 @@ stdenv.mkDerivation rec {
   };
 
   enableParallelBuilding = true;
-  nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin pkg-config;
+  nativeBuildInputs = stdenv.lib.optional stdenv.isDarwin pkg-config
+  ++ stdenv.lib.optional (enableMspds && stdenv.isLinux) autoPatchelfHook;
   buildInputs = [ libusb-compat-0_1 ]
   ++ stdenv.lib.optional stdenv.isDarwin hidapi
   ++ stdenv.lib.optional enableReadline readline;
@@ -34,6 +39,15 @@ stdenv.mkDerivation rec {
     substituteInPlace Makefile --replace brew true
   '';
 
+  # TODO: wrap with MSPDEBUG_TILIB_PATH env var instead of these rpath fixups in 0.26+
+  runtimeDependencies = stdenv.lib.optional enableMspds mspds;
+  postFixup = stdenv.lib.optionalString (enableMspds && stdenv.isDarwin) ''
+    # autoPatchelfHook only works on linux so...
+    for dep in $runtimeDependencies; do
+      install_name_tool -add_rpath $dep/lib $out/bin/$pname
+    done
+  '';
+
   installFlags = [ "PREFIX=$(out)" "INSTALL=install" ];
   makeFlags = [ "UNAME_S=$(unameS)" ] ++
     stdenv.lib.optional (!enableReadline) "WITHOUT_READLINE=1";