1{ lib
2, buildPythonPackage
3, python
4, fetchFromGitHub
5, sdcc
6, libusb1
7, crcmod
8}:
9
10buildPythonPackage rec {
11 pname = "fx2";
12 version = "0.9";
13
14 src = fetchFromGitHub {
15 owner = "whitequark";
16 repo = "libfx2";
17 rev = "v${version}";
18 sha256 = "sha256-Uk+K7ym92JX4fC3PyTNxd0UvBzoNZmtbscBYjSWChuk=";
19 };
20
21 nativeBuildInputs = [ sdcc ];
22
23 propagatedBuildInputs = [ libusb1 crcmod ];
24
25 preBuild = ''
26 cd software
27 ${python.pythonForBuild.interpreter} setup.py build_ext
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}