at 22.05-pre 56 lines 1.5 kB view raw
1{ stdenv 2, lib 3, fetchurl, unzip 4, boost, pugixml 5, hidapi 6, libusb1 ? null 7}: 8 9with lib; 10assert stdenv.isLinux -> libusb1 != null; 11 12let 13 hidapiDriver = optionalString stdenv.isLinux "-libusb"; 14 15in stdenv.mkDerivation { 16 pname = "msp-debug-stack"; 17 version = "3.15.1.1"; 18 19 src = fetchurl { 20 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"; 21 sha256 = "1j5sljqwc20zrb50mrji4mnmw5i680qc7n0lb0pakrrxqjc9m9g3"; 22 }; 23 sourceRoot = "."; 24 25 enableParallelBuilding = true; 26 libName = "libmsp430${stdenv.hostPlatform.extensions.sharedLibrary}"; 27 makeFlags = [ "OUTPUT=$(libName)" "HIDOBJ=" ]; 28 NIX_LDFLAGS = [ "-lpugixml" "-lhidapi${hidapiDriver}" ]; 29 NIX_CFLAGS_COMPILE = [ "-I${hidapi}/include/hidapi" ]; 30 31 patches = [ ./bsl430.patch ]; 32 33 preBuild = '' 34 rm ThirdParty/src/pugixml.cpp 35 rm ThirdParty/include/pugi{config,xml}.hpp 36 '' + optionalString stdenv.isDarwin '' 37 makeFlagsArray+=(OUTNAME="-install_name ") 38 ''; 39 40 installPhase = '' 41 install -Dm0755 -t $out/lib $libName 42 install -Dm0644 -t $out/include DLL430_v3/include/*.h 43 ''; 44 45 nativeBuildInputs = [ unzip ]; 46 buildInputs = [ boost hidapi pugixml ] 47 ++ optional stdenv.isLinux libusb1; 48 49 meta = { 50 description = "TI MSP430 FET debug driver"; 51 homepage = "https://www.ti.com/tool/MSPDS"; 52 license = licenses.bsd3; 53 platforms = platforms.linux ++ platforms.darwin; 54 maintainers = with maintainers; [ aerialx ]; 55 }; 56}