Commit 3c2052bd authored by Henner Zeller's avatar Henner Zeller Committed by Austin Seipp
Browse files

verilator: 5.022 -> 5.026

 * Properly output version with verilator --version
   (set VERILATOR_SRC_VERSION at compile time)
 * No need to wrap the binaries anymore.
 * Fix verilator --gdbbt
parent 8bd07206
Loading
Loading
Loading
Loading
+10 −18
Original line number Diff line number Diff line
@@ -2,7 +2,6 @@
  lib,
  stdenv,
  fetchFromGitHub,
  fetchpatch,
  perl,
  flex,
  bison,
@@ -17,28 +16,24 @@
  systemc,
  git,
  numactl,
  coreutils,
}:

stdenv.mkDerivation rec {
  pname = "verilator";
  version = "5.022";
  version = "5.026";

  # Verilator gets the version from this environment variable
  # if it can't do git describe while building.
  VERILATOR_SRC_VERSION = "v${version}";

  src = fetchFromGitHub {
    owner = pname;
    repo = pname;
    rev = "v${version}";
    hash = "sha256-Ya3lqK8BfvMVLZUrD2Et6OmptteWXp5VmZb2x2G/V/E=";
    hash = "sha256-Ds6w95tqlKjIFnkq2kKyslprKCwMOtBOoy7LuTon3KM=";
  };

  patches = [
    (fetchpatch {
      # Fix try-lock spuriously fail in V3ThreadPool destructor
      # https://github.com/verilator/verilator/pull/4938
      url = "https://github.com/verilator/verilator/commit/4b9cce4369c78423779238e585ed693c456d464e.patch";
      hash = "sha256-sGrk/pxqZqUcmJdzQoPlzXMmYqHCOmd9Y2n6ieVNg1U=";
    })
  ];

  enableParallelBuilding = true;
  buildInputs = [
    perl
@@ -57,6 +52,7 @@ stdenv.mkDerivation rec {
  nativeCheckInputs = [
    which
    numactl
    coreutils
    # cmake
  ];

@@ -69,16 +65,12 @@ stdenv.mkDerivation rec {
    patchShebangs bin/* src/* nodist/* docs/bin/* examples/xml_py/* \
    test_regress/{driver.pl,t/*.{pl,pf}} \
    ci/* ci/docker/run/* ci/docker/run/hooks/* ci/docker/buildenv/build.sh
    # verilator --gdbbt uses /bin/echo to test if gdb works.
    sed -i 's|/bin/echo|${coreutils}\/bin\/echo|' bin/verilator
  '';
  # grep '^#!/' -R . | grep -v /nix/store | less
  # (in nix-shell after patchPhase)

  postInstall = lib.optionalString stdenv.isLinux ''
    for x in $(ls $out/bin/verilator*); do
      wrapProgram "$x" --set LOCALE_ARCHIVE "${glibcLocales}/lib/locale/locale-archive"
    done
  '';

  env = {
    SYSTEMC_INCLUDE = "${lib.getDev systemc}/include";
    SYSTEMC_LIBDIR = "${lib.getLib systemc}/lib";