6 , enableReadline ? true
13 assert stdenv.isDarwin -> hidapi != null && pkg-config != null;
14 assert enableReadline -> readline != null;
15 assert enableMspds -> mspds != null;
17 stdenv.mkDerivation rec {
20 src = fetchFromGitHub {
24 sha256 = "0prgwb5vx6fd4bj12ss1bbb6axj2kjyriyjxqrzd58s5jyyy8d3c";
27 enableParallelBuilding = true;
28 nativeBuildInputs = lib.optional stdenv.isDarwin pkg-config
29 ++ lib.optional (enableMspds && stdenv.isLinux) autoPatchelfHook;
30 buildInputs = [ libusb-compat-0_1 ]
31 ++ lib.optional stdenv.isDarwin hidapi
32 ++ lib.optional enableReadline readline;
34 postPatch = lib.optionalString stdenv.isDarwin ''
35 # TODO: remove once a new 0.26+ release is made
36 substituteInPlace drivers/tilib_api.c --replace .so ${stdenv.hostPlatform.extensions.sharedLibrary}
38 # Makefile only uses pkg-config if it detects homebrew
39 substituteInPlace Makefile --replace brew true
42 # TODO: wrap with MSPDEBUG_TILIB_PATH env var instead of these rpath fixups in 0.26+
43 runtimeDependencies = lib.optional enableMspds mspds;
44 postFixup = lib.optionalString (enableMspds && stdenv.isDarwin) ''
45 # autoPatchelfHook only works on linux so...
46 for dep in $runtimeDependencies; do
47 install_name_tool -add_rpath $dep/lib $out/bin/$pname
51 installFlags = [ "PREFIX=$(out)" "INSTALL=install" ];
52 makeFlags = [ "UNAME_S=$(unameS)" ] ++
53 lib.optional (!enableReadline) "WITHOUT_READLINE=1";
54 unameS = lib.optionalString stdenv.isDarwin "Darwin";
57 description = "A free programmer, debugger, and gdb proxy for MSP430 MCUs";
58 homepage = "https://dlbeer.co.nz/mspdebug/";
59 license = licenses.gpl2;
60 platforms = platforms.all;
61 maintainers = with maintainers; [ aerialx ];