acr-cli: init at 0.14 (#359508)
[NixPkgs.git] / pkgs / by-name / bl / blackmagic / package.nix
blobbb09ade35f2ffc2af4e230aeb59358b95ef9ca10
1 { stdenv, lib
2 , fetchFromGitHub
3 , gcc-arm-embedded
4 , pkg-config
5 , python3
6 , hidapi
7 , libftdi1
8 , libusb1
9 }:
11 stdenv.mkDerivation rec {
12   pname = "blackmagic";
13   version = "1.8.2";
14   # `git describe --always`
15   firmwareVersion = "v${version}";
17   src = fetchFromGitHub {
18     owner = "blacksphere";
19     repo = "blackmagic";
20     rev = firmwareVersion;
21     hash = "sha256-NGzoohmpVwGOncr9AvHYANMf/oEskjmTXYj/Kdx2RwM=";
22     fetchSubmodules = true;
23   };
25   nativeBuildInputs = [
26     gcc-arm-embedded
27     pkg-config
28     python3
29   ];
31   buildInputs = [
32     hidapi
33     libftdi1
34     libusb1
35   ];
37   strictDeps = true;
39   postPatch = ''
40     # Prevent calling out to `git' to generate a version number:
41     substituteInPlace src/Makefile \
42       --replace '$(shell git describe --always --dirty)' '${firmwareVersion}'
44     # Fix scripts that generate headers:
45     for f in $(find scripts libopencm3/scripts -type f); do
46       patchShebangs "$f"
47     done
48   '';
50   buildPhase = ''
51     runHook preBuild
52     ${stdenv.shell} ${./helper.sh}
53     runHook postBuild
54   '';
56   dontInstall = true;
58   enableParallelBuilding = true;
60   meta = with lib; {
61     description = "In-application debugger for ARM Cortex microcontrollers";
62     mainProgram = "blackmagic";
63     longDescription = ''
64       The Black Magic Probe is a modern, in-application debugging tool
65       for embedded microprocessors. It allows you to see what is going
66       on "inside" an application running on an embedded microprocessor
67       while it executes.
69       This package builds the firmware for all supported platforms,
70       placing them in separate directories under the firmware
71       directory.  It also places the FTDI version of the blackmagic
72       executable in the bin directory.
73     '';
74     homepage = "https://github.com/blacksphere/blackmagic";
75     license = licenses.gpl3Plus;
76     maintainers = with maintainers; [ pjones sorki ];
77     platforms = platforms.unix;
78   };