2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, setuptools
|
2021-03-09 03:18:52 +00:00
|
|
|
, setuptools-scm
|
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
, sdcc
|
|
|
|
, nmigen
|
|
|
|
, fx2
|
|
|
|
, libusb1
|
|
|
|
, aiohttp
|
|
|
|
, pyvcd
|
|
|
|
, bitarray
|
|
|
|
, crcmod
|
|
|
|
, yosys
|
|
|
|
, icestorm
|
|
|
|
, nextpnr
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "glasgow";
|
2021-03-09 03:18:52 +00:00
|
|
|
version = "unstable-2021-03-02";
|
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
# python software/setup.py --version
|
2021-03-09 03:18:52 +00:00
|
|
|
realVersion = "0.1.dev1660+g${lib.substring 0 7 src.rev}";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "GlasgowEmbedded";
|
|
|
|
repo = "glasgow";
|
2021-03-09 03:18:52 +00:00
|
|
|
rev = "41c48bbcee284d024e4249a81419fbbae674cf40";
|
|
|
|
sha256 = "1fg8ps228930d70bczwmcwnrd1gvm02a58mxbpn8pyakwbwwa6hq";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [ setuptools-scm sdcc ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
nmigen
|
|
|
|
fx2
|
|
|
|
libusb1
|
|
|
|
aiohttp
|
|
|
|
pyvcd
|
|
|
|
bitarray
|
|
|
|
crcmod
|
|
|
|
];
|
|
|
|
|
|
|
|
checkInputs = [ yosys icestorm nextpnr ];
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
make -C firmware LIBFX2=${fx2}/share/libfx2
|
|
|
|
cp firmware/glasgow.ihex software/glasgow
|
|
|
|
cd software
|
|
|
|
export SETUPTOOLS_SCM_PRETEND_VERSION="${realVersion}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# installCheck tries to build_ext again
|
|
|
|
doInstallCheck = false;
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
python -W ignore::DeprecationWarning test.py
|
|
|
|
'';
|
|
|
|
|
|
|
|
makeWrapperArgs = [
|
|
|
|
"--set" "YOSYS" "${yosys}/bin/yosys"
|
|
|
|
"--set" "ICEPACK" "${icestorm}/bin/icepack"
|
|
|
|
"--set" "NEXTPNR_ICE40" "${nextpnr}/bin/nextpnr-ice40"
|
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Software for Glasgow, a digital interface multitool";
|
|
|
|
homepage = "https://github.com/GlasgowEmbedded/Glasgow";
|
|
|
|
license = licenses.bsd0;
|
|
|
|
maintainers = with maintainers; [ emily ];
|
|
|
|
};
|
|
|
|
}
|