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