1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 python3,
7 pkg-config,
8 libuuid,
9 openjdk,
10 gperftools,
11 gtest,
12 uhdm,
13 antlr4,
14 capnproto,
15 nlohmann_json,
16}:
17
18stdenv.mkDerivation (finalAttrs: {
19 pname = "surelog";
20 version = "1.84-unstable-2024-12-06";
21
22 src = fetchFromGitHub {
23 owner = "chipsalliance";
24 repo = "surelog";
25 # Once we're back on a stable tag, use "v$(finalAttrs.version}" below.
26 rev = "298a9cddc672cce7f25ec352f9f8f36f5b23aa4e";
27 hash = "sha256-Qv4dosj2dwakNCcvu483ZMuw+LlYs4fhZTULszERLSI=";
28 fetchSubmodules = false; # we use all dependencies from nix
29 };
30
31 nativeBuildInputs = [
32 cmake
33 pkg-config
34 openjdk
35 (python3.withPackages (
36 p: with p; [
37 psutil
38 orderedmultidict
39 ]
40 ))
41 gtest
42 antlr4
43 ];
44
45 buildInputs = [
46 libuuid
47 gperftools
48 uhdm
49 capnproto
50 antlr4.runtime.cpp
51 nlohmann_json
52 ];
53
54 cmakeFlags = [
55 "-DSURELOG_USE_HOST_CAPNP=On"
56 "-DSURELOG_USE_HOST_UHDM=On"
57 "-DSURELOG_USE_HOST_GTEST=On"
58 "-DSURELOG_USE_HOST_ANTLR=On"
59 "-DSURELOG_USE_HOST_JSON=On"
60 "-DANTLR_JAR_LOCATION=${antlr4.jarLocation}"
61 ];
62
63 doCheck = true;
64 checkPhase = ''
65 runHook preCheck
66 make -j $NIX_BUILD_CORES UnitTests
67 ctest --output-on-failure
68 runHook postCheck
69 '';
70
71 meta = {
72 description = "SystemVerilog 2017 Pre-processor, Parser, Elaborator, UHDM Compiler";
73 homepage = "https://github.com/chipsalliance/Surelog";
74 license = lib.licenses.asl20;
75 mainProgram = "surelog";
76 maintainers = with lib.maintainers; [
77 matthuszagh
78 hzeller
79 ];
80 platforms = lib.platforms.all;
81 };
82})