1{ stdenv, lib, fetchurl, unzip, autoPatchelfHook }:
2
3let
4 archPostfix = lib.optionalString (stdenv.is64bit && !stdenv.isDarwin) "_64";
5in stdenv.mkDerivation rec {
6 pname = "msp-debug-stack-bin";
7 version = "3.15.1.1";
8 src = fetchurl {
9 url = "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPDS/3_15_1_001/export/MSP430_DLL_Developer_Package_Rev_3_15_1_1.zip";
10 sha256 = "1m1ssrwbhqvqwbp3m4hnjyxnz3f9d4acz9vl1av3fbnhvxr0d2hb";
11 };
12 sourceRoot = ".";
13
14 libname =
15 if stdenv.hostPlatform.isWindows then "MSP430${archPostfix}.dll"
16 else "libmsp430${archPostfix}${stdenv.hostPlatform.extensions.sharedLibrary}";
17
18 nativeBuildInputs = [ unzip ]
19 ++ lib.optional stdenv.isLinux autoPatchelfHook;
20 buildInputs = [ stdenv.cc.cc ];
21
22 installPhase = ''
23 install -Dm0755 $libname $out/lib/''${libname//_64/}
24 install -Dm0644 -t $out/include Inc/*.h
25 '';
26
27 meta = with lib; {
28 description = "Unfree binary release of the TI MSP430 FET debug driver";
29 homepage = "https://www.ti.com/tool/MSPDS";
30 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
31 license = licenses.unfree;
32 platforms = platforms.linux ++ platforms.darwin;
33 maintainers = with maintainers; [ aerialx ];
34 };
35}