@@ -1,8 +1,6 @@
11{ stdenv, fetchFromGitHub, cmake
22, boost, python3
3−
4−# TODO: also add libtrellis, later on
5−, icestorm
3+, icestorm, trellis
64
75# TODO(thoughtpolice) Currently the GUI build seems broken at runtime on my
86# laptop (and over a remote X server on my server...), so mark it broken for
@@ -13,6 +11,19 @@
1311
1412let
1513 boostPython = boost.override { python = python3; enablePython = true; };
14+
15+ # This is a massive hack. For now, Trellis doesn't really support
16+ # installation through an already-built package; you have to build it once to
17+ # get the tools, then reuse the build directory to build nextpnr -- the
18+ # 'install' phase doesn't install everything it needs. This will be fixed in
19+ # the future but for now we can do this horrific thing.
20+ trellisRoot = trellis.overrideAttrs (_: {
21+ installPhase = ''
22+ mkdir -p $out
23+ cp *.so ..
24+ cd ../../.. && cp -R trellis database $out/
25+ '';
26+ });
1627in
1728stdenv.mkDerivation rec {
1829 name = "nextpnr-${version}";
@@ -32,8 +43,9 @@ stdenv.mkDerivation rec {
3243
3344 enableParallelBuilding = true;
3445 cmakeFlags =
35− [ "-DARCH=generic;ice40"
46+ [ "-DARCH=generic;ice40;ecp5"
3647 "-DICEBOX_ROOT=${icestorm}/share/icebox"
48+ "-DTRELLIS_ROOT=${trellisRoot}/trellis"
3749 ] ++ (stdenv.lib.optional (!enableGui) "-DBUILD_GUI=OFF");
3850
3951 # Fix the version number. This is a bit stupid (and fragile) in practice