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