2021-09-18 10:52:07 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, python3, boost, cmake }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
let
|
|
|
|
rev = "03e0070f263fbe31c247de61d259544722786210";
|
2020-04-24 23:36:52 +00:00
|
|
|
# git describe --tags
|
2021-09-18 10:52:07 +00:00
|
|
|
realVersion = "1.0-532-g${builtins.substring 0 7 rev}";
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "trellis";
|
|
|
|
version = "2021-09-01";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
srcs = [
|
|
|
|
(fetchFromGitHub {
|
2021-02-13 14:23:35 +00:00
|
|
|
owner = "YosysHQ";
|
2020-04-24 23:36:52 +00:00
|
|
|
repo = "prjtrellis";
|
2021-09-18 10:52:07 +00:00
|
|
|
inherit rev;
|
|
|
|
sha256 = "joQMsjVj8d3M3IaqOkfVQ1I5qPDM8HHJiye+Ak8f3dg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
name = "trellis";
|
|
|
|
})
|
|
|
|
|
|
|
|
(fetchFromGitHub {
|
2021-02-13 14:23:35 +00:00
|
|
|
owner = "YosysHQ";
|
2020-04-24 23:36:52 +00:00
|
|
|
repo = "prjtrellis-db";
|
2021-09-18 10:52:07 +00:00
|
|
|
rev = "fdf4bf275a7402654bc643db537173e2fbc86103";
|
|
|
|
sha256 = "eDq2wU2pnfK9bOkEVZ07NQPv02Dc6iB+p5GTtVBiyQA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
name = "trellis-database";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
sourceRoot = "trellis";
|
|
|
|
|
2020-12-03 08:41:04 +00:00
|
|
|
buildInputs = [ boost ];
|
2020-04-24 23:36:52 +00:00
|
|
|
nativeBuildInputs = [ cmake python3 ];
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DCURRENT_GIT_VERSION=${realVersion}"
|
2021-10-17 02:12:59 +00:00
|
|
|
# TODO: should this be in stdenv instead?
|
|
|
|
"-DCMAKE_INSTALL_DATADIR=${placeholder "out"}/share"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
preConfigure = ''
|
|
|
|
rmdir database && ln -sfv ${builtins.elemAt srcs 1} ./database
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
cd libtrellis
|
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postInstall = lib.optionalString stdenv.isDarwin ''
|
|
|
|
for f in $out/bin/* ; do
|
|
|
|
install_name_tool -change "$out/lib/libtrellis.dylib" "$out/lib/trellis/libtrellis.dylib" "$f"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2021-10-17 02:12:59 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/ecppack $out/share/trellis/misc/basecfgs/empty_lfe5u-85f.config /tmp/test.bin
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Documentation and bitstream tools for Lattice ECP5 FPGAs";
|
|
|
|
longDescription = ''
|
|
|
|
Project Trellis documents the Lattice ECP5 architecture
|
|
|
|
to enable development of open-source tools. Its goal is
|
|
|
|
to provide sufficient information to develop a free and
|
|
|
|
open Verilog to bitstream toolchain for these devices.
|
|
|
|
'';
|
2021-09-18 10:52:07 +00:00
|
|
|
homepage = "https://github.com/YosysHQ/prjtrellis";
|
|
|
|
license = licenses.isc;
|
2021-10-17 02:12:59 +00:00
|
|
|
maintainers = with maintainers; [ q3k thoughtpolice emily rowanG077 ];
|
2021-09-18 10:52:07 +00:00
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|