2021-09-02 14:14:06 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, python3, boost, cmake }:
|
2020-03-25 11:45:57 +00:00
|
|
|
|
2021-09-02 14:14:06 +00:00
|
|
|
let
|
2022-09-20 14:00:37 +00:00
|
|
|
rev = "488f4e71073062de314c55a037ede7cf03a3324c";
|
2019-09-27 14:06:56 +00:00
|
|
|
# git describe --tags
|
2022-09-20 14:00:37 +00:00
|
|
|
realVersion = "1.2.1-14-g${builtins.substring 0 7 rev}";
|
treewide: noop: refer to `src.name` or similar where appropriate, part 3: more use cases
This continues where d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e left off. Similarly
to that commit, this commit this also points `sourceRoot`s to `src.name` and similar
instead of keeping hardcoded names, and edits other derivation attrs do do the same,
where appropriate.
Also, similarly to d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e some of expressions this
edits use `srcs` attribute with customly-named sources, so they have to be moved
into `let` blocks to keep evaluation efficient (the other, worse, way to do this
would to recurcively refer to `elemAt n finalAttrs.srcs` or, similarly, with `rec`).
2023-08-08 17:18:01 +00:00
|
|
|
|
|
|
|
main_src = fetchFromGitHub {
|
|
|
|
owner = "YosysHQ";
|
|
|
|
repo = "prjtrellis";
|
|
|
|
inherit rev;
|
|
|
|
hash = "sha256-Blbu+0rlM/3izbF0XCvkNpSAND0IclWEwK7anzyrpvw=";
|
|
|
|
name = "trellis";
|
|
|
|
};
|
|
|
|
|
|
|
|
database_src = fetchFromGitHub {
|
|
|
|
owner = "YosysHQ";
|
|
|
|
repo = "prjtrellis-db";
|
|
|
|
rev = "35d900a94ff0db152679a67bf6e4fbf40ebc34aa";
|
|
|
|
hash = "sha256-r6viR8y9ZjURGNbsa0/YY8lzy9kGzjuu408ntxwpqm0=";
|
|
|
|
name = "trellis-database";
|
|
|
|
};
|
|
|
|
|
2021-09-02 14:14:06 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "trellis";
|
2022-09-20 14:00:37 +00:00
|
|
|
version = "unstable-2022-09-14";
|
2018-08-02 08:18:47 +00:00
|
|
|
|
treewide: noop: refer to `src.name` or similar where appropriate, part 3: more use cases
This continues where d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e left off. Similarly
to that commit, this commit this also points `sourceRoot`s to `src.name` and similar
instead of keeping hardcoded names, and edits other derivation attrs do do the same,
where appropriate.
Also, similarly to d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e some of expressions this
edits use `srcs` attribute with customly-named sources, so they have to be moved
into `let` blocks to keep evaluation efficient (the other, worse, way to do this
would to recurcively refer to `elemAt n finalAttrs.srcs` or, similarly, with `rec`).
2023-08-08 17:18:01 +00:00
|
|
|
srcs = [ main_src database_src ];
|
|
|
|
sourceRoot = main_src.name;
|
2018-08-02 08:18:47 +00:00
|
|
|
|
2020-12-02 12:52:53 +00:00
|
|
|
buildInputs = [ boost ];
|
2019-01-08 22:56:16 +00:00
|
|
|
nativeBuildInputs = [ cmake python3 ];
|
2020-02-08 15:32:03 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DCURRENT_GIT_VERSION=${realVersion}"
|
2021-10-14 05:58:32 +00:00
|
|
|
# TODO: should this be in stdenv instead?
|
|
|
|
"-DCMAKE_INSTALL_DATADIR=${placeholder "out"}/share"
|
2020-02-08 15:32:03 +00:00
|
|
|
];
|
2018-08-02 08:18:47 +00:00
|
|
|
|
2021-09-02 14:14:06 +00:00
|
|
|
preConfigure = ''
|
treewide: noop: refer to `src.name` or similar where appropriate, part 3: more use cases
This continues where d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e left off. Similarly
to that commit, this commit this also points `sourceRoot`s to `src.name` and similar
instead of keeping hardcoded names, and edits other derivation attrs do do the same,
where appropriate.
Also, similarly to d8f7f6a5cee067b81bfaaa3aa079adb94ed7c01e some of expressions this
edits use `srcs` attribute with customly-named sources, so they have to be moved
into `let` blocks to keep evaluation efficient (the other, worse, way to do this
would to recurcively refer to `elemAt n finalAttrs.srcs` or, similarly, with `rec`).
2023-08-08 17:18:01 +00:00
|
|
|
rmdir database && ln -sfv ${database_src} ./database
|
2018-08-02 08:18:47 +00:00
|
|
|
|
|
|
|
cd libtrellis
|
|
|
|
'';
|
|
|
|
|
2021-11-13 20:02:48 +00:00
|
|
|
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
|
|
for f in $out/bin/* ; do
|
|
|
|
install_name_tool -change "$out/lib/libtrellis.dylib" "$out/lib/trellis/libtrellis.dylib" "$f"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2021-10-15 10:16:44 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
installCheckPhase = ''
|
|
|
|
$out/bin/ecppack $out/share/trellis/misc/basecfgs/empty_lfe5u-85f.config /tmp/test.bin
|
|
|
|
'';
|
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2019-01-08 22:56:16 +00:00
|
|
|
description = "Documentation and bitstream tools for Lattice ECP5 FPGAs";
|
2018-08-02 08:18:47 +00:00
|
|
|
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-02 14:14:06 +00:00
|
|
|
homepage = "https://github.com/YosysHQ/prjtrellis";
|
|
|
|
license = licenses.isc;
|
2024-06-15 11:37:52 +00:00
|
|
|
maintainers = with maintainers; [ q3k thoughtpolice rowanG077 ];
|
2021-09-02 14:14:06 +00:00
|
|
|
platforms = platforms.all;
|
2018-08-02 08:18:47 +00:00
|
|
|
};
|
|
|
|
}
|