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
|
2021-12-19 01:06:50 +00:00
|
|
|
rev = "2f06397673bbca3da11928d538b8ab7d01c944c6";
|
2020-04-24 23:36:52 +00:00
|
|
|
# git describe --tags
|
2021-12-19 01:06:50 +00:00
|
|
|
realVersion = "1.0-534-g${builtins.substring 0 7 rev}";
|
2021-09-18 10:52:07 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "trellis";
|
2021-12-19 01:06:50 +00:00
|
|
|
version = "2021-12-14";
|
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;
|
2021-12-19 01:06:50 +00:00
|
|
|
hash = "sha256-m5CalAIbzY2bhOvpBbPBeLZeDp+itk1HlRsSmtiddaA=";
|
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-12-19 01:06:50 +00:00
|
|
|
# note: the upstream submodule points to revision 0ee729d20eaf,
|
|
|
|
# but that's just the tip of the branch that was merged into master.
|
|
|
|
# fdf4bf275a is the merge commit itself
|
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
|
|
|
};
|
|
|
|
}
|