2019-08-30 21:45:56 +01:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
2019-09-27 15:07:31 +01:00
|
|
|
, setuptools
|
|
|
|
, setuptools_scm
|
2019-08-30 21:45:56 +01:00
|
|
|
, sdcc
|
|
|
|
, nmigen
|
|
|
|
, fx2
|
|
|
|
, libusb1
|
|
|
|
, aiohttp
|
|
|
|
, pyvcd
|
|
|
|
, bitarray
|
|
|
|
, crcmod
|
|
|
|
, yosys
|
|
|
|
, icestorm
|
|
|
|
, nextpnr
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "glasgow";
|
2020-07-08 00:02:52 +01:00
|
|
|
version = "unstable-2020-06-29";
|
2019-10-13 17:29:36 +01:00
|
|
|
# python software/setup.py --version
|
2020-02-08 21:43:04 +00:00
|
|
|
realVersion = "0.1.dev1352+g${lib.substring 0 7 src.rev}";
|
2019-08-30 21:45:56 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "GlasgowEmbedded";
|
2019-10-13 17:29:36 +01:00
|
|
|
repo = "glasgow";
|
2020-07-08 00:02:52 +01:00
|
|
|
rev = "f885790d7927b893e631c33744622d6ebc18b5e3";
|
|
|
|
sha256 = "sha256-fSorSEa5K09aPEOk4XPWOFRxYl1KGVy29jOBqIvs2hk=";
|
2019-08-30 21:45:56 +01:00
|
|
|
};
|
|
|
|
|
2019-09-27 15:07:31 +01:00
|
|
|
nativeBuildInputs = [ setuptools_scm sdcc ];
|
2019-08-30 21:45:56 +01:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
2019-09-27 15:07:31 +01:00
|
|
|
setuptools
|
2019-08-30 21:45:56 +01:00
|
|
|
nmigen
|
|
|
|
fx2
|
|
|
|
libusb1
|
|
|
|
aiohttp
|
|
|
|
pyvcd
|
|
|
|
bitarray
|
|
|
|
crcmod
|
|
|
|
];
|
|
|
|
|
2019-10-13 17:29:36 +01:00
|
|
|
checkInputs = [ yosys icestorm nextpnr ];
|
|
|
|
|
2020-02-08 21:43:04 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2019-08-30 21:45:56 +01:00
|
|
|
preBuild = ''
|
|
|
|
make -C firmware LIBFX2=${fx2}/share/libfx2
|
|
|
|
cp firmware/glasgow.ihex software/glasgow
|
|
|
|
cd software
|
2019-09-27 15:07:31 +01:00
|
|
|
export SETUPTOOLS_SCM_PRETEND_VERSION="${realVersion}"
|
2019-08-30 21:45:56 +01:00
|
|
|
'';
|
|
|
|
|
2019-09-27 15:07:36 +01:00
|
|
|
# installCheck tries to build_ext again
|
2019-08-30 21:45:56 +01:00
|
|
|
doInstallCheck = false;
|
|
|
|
|
|
|
|
checkPhase = ''
|
2020-02-08 21:43:04 +00:00
|
|
|
python -W ignore::DeprecationWarning test.py
|
2019-08-30 21:45:56 +01:00
|
|
|
'';
|
|
|
|
|
2019-10-13 17:29:36 +01:00
|
|
|
makeWrapperArgs = [
|
|
|
|
"--set" "YOSYS" "${yosys}/bin/yosys"
|
|
|
|
"--set" "ICEPACK" "${icestorm}/bin/icepack"
|
|
|
|
"--set" "NEXTPNR_ICE40" "${nextpnr}/bin/nextpnr-ice40"
|
|
|
|
];
|
|
|
|
|
2019-08-30 21:45:56 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Software for Glasgow, a digital interface multitool";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/GlasgowEmbedded/Glasgow";
|
2019-08-30 21:45:56 +01:00
|
|
|
license = licenses.bsd0;
|
|
|
|
maintainers = with maintainers; [ emily ];
|
|
|
|
};
|
|
|
|
}
|