1{
2 lib,
3 buildPythonPackage,
4 python,
5 fetchFromGitHub,
6 sdcc,
7 libusb1,
8 crcmod,
9}:
10
11buildPythonPackage rec {
12 pname = "fx2";
13 version = "0.13";
14 format = "setuptools";
15
16 src = fetchFromGitHub {
17 owner = "whitequark";
18 repo = "libfx2";
19 rev = "v${version}";
20 hash = "sha256-PtWxjT+97+EeNMN36zOT1+ost/w3lRRkaON3Cl3dpp4=";
21 };
22
23 nativeBuildInputs = [ sdcc ];
24
25 propagatedBuildInputs = [
26 libusb1
27 crcmod
28 ];
29
30 preBuild = ''
31 make -C firmware
32 cd software
33 '';
34
35 preInstall = ''
36 mkdir -p $out/share/libfx2
37 cp -R ../firmware/library/{.stamp,lib,include,fx2{rules,conf}.mk} \
38 $out/share/libfx2
39 '';
40
41 # installCheckPhase tries to run build_ext again and there are no tests
42 doCheck = false;
43
44 meta = with lib; {
45 description = "Chip support package for Cypress EZ-USB FX2 series microcontrollers";
46 mainProgram = "fx2tool";
47 homepage = "https://github.com/whitequark/libfx2";
48 license = licenses.bsd0;
49 maintainers = with maintainers; [ emily ];
50 };
51}