Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 stdenv,
3 lib,
4 fetchurl,
5 unzip,
6 boost,
7 pugixml,
8 hidapi,
9 libusb1 ? null,
10}:
11
12assert stdenv.hostPlatform.isLinux -> libusb1 != null;
13
14let
15 hidapiDriver = lib.optionalString stdenv.hostPlatform.isLinux "-libusb";
16
17in
18stdenv.mkDerivation {
19 pname = "msp-debug-stack";
20 version = "3.15.1.1";
21
22 src = fetchurl {
23 url = "http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/MSPDS/3_15_1_001/export/MSPDebugStack_OS_Package_3_15_1_1.zip";
24 sha256 = "1j5sljqwc20zrb50mrji4mnmw5i680qc7n0lb0pakrrxqjc9m9g3";
25 };
26 sourceRoot = ".";
27
28 enableParallelBuilding = true;
29 libName = "libmsp430${stdenv.hostPlatform.extensions.sharedLibrary}";
30 makeFlags = [
31 "OUTPUT=$(libName)"
32 "HIDOBJ="
33 ];
34 NIX_LDFLAGS = [
35 "-lpugixml"
36 "-lhidapi${hidapiDriver}"
37 ];
38 env.NIX_CFLAGS_COMPILE = toString [ "-I${hidapi}/include/hidapi" ];
39
40 patches = [ ./bsl430.patch ];
41
42 preBuild = ''
43 rm ThirdParty/src/pugixml.cpp
44 rm ThirdParty/include/pugi{config,xml}.hpp
45 ''
46 + lib.optionalString stdenv.hostPlatform.isDarwin ''
47 makeFlagsArray+=(OUTNAME="-install_name ")
48 '';
49
50 installPhase = ''
51 install -Dm0755 -t $out/lib $libName
52 install -Dm0644 -t $out/include DLL430_v3/include/*.h
53 '';
54
55 nativeBuildInputs = [ unzip ];
56 buildInputs = [
57 boost
58 hidapi
59 pugixml
60 ]
61 ++ lib.optional stdenv.hostPlatform.isLinux libusb1;
62
63 meta = with lib; {
64 description = "TI MSP430 FET debug driver";
65 homepage = "https://www.ti.com/tool/MSPDS";
66 license = licenses.bsd3;
67 platforms = platforms.linux ++ platforms.darwin;
68 maintainers = with maintainers; [ aerialx ];
69 };
70}