1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, setuptools
5, setuptools_scm
6, sdcc
7, nmigen
8, fx2
9, libusb1
10, aiohttp
11, pyvcd
12, bitarray
13, crcmod
14, yosys
15, icestorm
16, nextpnr
17}:
18
19buildPythonPackage rec {
20 pname = "glasgow";
21 version = "unstable-2020-06-29";
22 # python software/setup.py --version
23 realVersion = "0.1.dev1352+g${lib.substring 0 7 src.rev}";
24
25 src = fetchFromGitHub {
26 owner = "GlasgowEmbedded";
27 repo = "glasgow";
28 rev = "f885790d7927b893e631c33744622d6ebc18b5e3";
29 sha256 = "sha256-fSorSEa5K09aPEOk4XPWOFRxYl1KGVy29jOBqIvs2hk=";
30 };
31
32 nativeBuildInputs = [ setuptools_scm sdcc ];
33
34 propagatedBuildInputs = [
35 setuptools
36 nmigen
37 fx2
38 libusb1
39 aiohttp
40 pyvcd
41 bitarray
42 crcmod
43 ];
44
45 checkInputs = [ yosys icestorm nextpnr ];
46
47 enableParallelBuilding = true;
48
49 preBuild = ''
50 make -C firmware LIBFX2=${fx2}/share/libfx2
51 cp firmware/glasgow.ihex software/glasgow
52 cd software
53 export SETUPTOOLS_SCM_PRETEND_VERSION="${realVersion}"
54 '';
55
56 # installCheck tries to build_ext again
57 doInstallCheck = false;
58
59 checkPhase = ''
60 python -W ignore::DeprecationWarning test.py
61 '';
62
63 makeWrapperArgs = [
64 "--set" "YOSYS" "${yosys}/bin/yosys"
65 "--set" "ICEPACK" "${icestorm}/bin/icepack"
66 "--set" "NEXTPNR_ICE40" "${nextpnr}/bin/nextpnr-ice40"
67 ];
68
69 meta = with lib; {
70 description = "Software for Glasgow, a digital interface multitool";
71 homepage = "https://github.com/GlasgowEmbedded/Glasgow";
72 license = licenses.bsd0;
73 maintainers = with maintainers; [ emily ];
74 };
75}