summaryrefslogtreecommitdiffstats
path: root/pkgs/development/compilers/yosys/plugins/bluespec.nix
blob: 84a31eb5b12f148c5da5b575b7b6d9c6e3a5a31f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
{
  stdenv,
  lib,
  fetchFromGitHub,
  pkg-config,
  yosys,
  readline,
  zlib,
  bluespec,
}:

stdenv.mkDerivation {
  pname = "yosys-bluespec";
  version = "2021.09.08";
  plugin = "bluespec";

  src = fetchFromGitHub {
    owner = "thoughtpolice";
    repo = "yosys-bluespec";
    rev = "f6f4127a4e96e18080fd5362b6769fa3e24c76b1";
    sha256 = "sha256-3cNFP/k4JsgLyUQHWU10Htl2Rh0staAcA3R4piD6hDE=";
  };

  # yosys >=0.67 headers require C++20; the Makefile otherwise pins c++17.
  postPatch = ''
    substituteInPlace Makefile \
      --replace-fail '-std=c++17' '-std=c++20'
  '';

  buildInputs = [
    yosys
    readline
    zlib
    bluespec
  ];
  nativeBuildInputs = [ pkg-config ];

  doCheck = true;
  makeFlags = [
    "PREFIX=$(out)/share/yosys/plugins"
    "STATIC_BSC_PATH=${bluespec}/bin/bsc"
    "STATIC_BSC_LIBDIR=${bluespec}/lib"
  ];

  meta = {
    description = "Bluespec plugin for Yosys";
    homepage = "https://github.com/thoughtpolice/yosys-bluespec";
    license = lib.licenses.isc;
    platforms = lib.platforms.all;
    maintainers = with lib.maintainers; [ thoughtpolice ];
  };
}