1{ lib
2, buildPythonPackage
3, python
4, fetchFromGitHub
5, sdcc
6, libusb1
7, crcmod
8}:
9
10buildPythonPackage {
11 pname = "fx2";
12 version = "unstable-2019-08-27";
13
14 src = fetchFromGitHub {
15 owner = "whitequark";
16 repo = "libfx2";
17 rev = "dd1e42c7b46ff410dbb18beab46111bb5491400c";
18 sha256 = "0xvlmx6ym0ylrvnlqzf18d475wa0mfci7wkdbv30gl3hgdhsppjz";
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}