Unverified Commit 8f4308a4 authored by Robert Scott's avatar Robert Scott Committed by GitHub
Browse files

Merge pull request #229364 from jleightcap/jl/verilog-12.0

verilog: 11.0 -> 12.0
parents e700696f 4fdd191d
Loading
Loading
Loading
Loading
+34 −27
Original line number Diff line number Diff line
{ lib, stdenv
, fetchFromGitHub
, fetchpatch
, autoconf
, bison
, bzip2
@@ -7,56 +8,62 @@
, gperf
, ncurses
, perl
, python3
, readline
, zlib
}:

let
  # iverilog-test has been merged to the main iverilog main source tree
  # in January 2022, so it won't be longer necessary.
  # For now let's fetch it from the separate repo, since 11.0 was released in 2020.
  iverilog-test = fetchFromGitHub {
    owner  = "steveicarus";
    repo   = "ivtest";
    rev    = "a19e629a1879801ffcc6f2e6256ca435c20570f3";
    sha256 = "sha256-3EkmrAXU0/mRxrxp5Hy7C3yWTVK16L+tPqqeEryY/r8=";
  };
in
stdenv.mkDerivation rec {
  pname   = "iverilog";
  version = "11.0";
  version = "12.0";

  src = fetchFromGitHub {
    owner  = "steveicarus";
    repo   = pname;
    rev    = "v${lib.replaceStrings ["."] ["_"] version}";
    sha256 = "0nzcyi6l2zv9wxzsv9i963p3igyjds0n55x0ph561mc3pfbc7aqp";
    hash   = "sha256-J9hedSmC6mFVcoDnXBtaTXigxrSCFa2AhhFd77ueo7I=";
  };

  nativeBuildInputs = [ autoconf bison flex gperf ];

  CC_FOR_BUILD="${stdenv.cc}/bin/cc";
  CXX_FOR_BUILD="${stdenv.cc}/bin/c++";

  patches = [
    # NOTE(jleightcap): `-Werror=format-security` warning patched shortly after release, backport the upstream fix
    (fetchpatch {
      name = "format-security";
      url = "https://github.com/steveicarus/iverilog/commit/23e51ef7a8e8e4ba42208936e0a6a25901f58c65.patch";
      hash = "sha256-fMWfBsCl2fuXe+6AR10ytb8QpC84bXlP5RSdrqsWzEk=";
    })
  ];

  buildInputs = [ bzip2 ncurses readline zlib ];

  preConfigure = "sh autoconf.sh";

  enableParallelBuilding = true;

  nativeInstallCheckInputs = [ perl ];
  # NOTE(jleightcap): the `make check` target only runs a "Hello, World"-esque sanity check.
  # the tests in the doInstallCheck phase run a full regression test suite.
  # however, these tests currently fail upstream on aarch64
  # (see https://github.com/steveicarus/iverilog/issues/917)
  # so disable the full suite for now.
  doCheck = true;
  doInstallCheck = !stdenv.isAarch64;

  installCheckPhase = ''
    # copy tests to allow writing results
    export TESTDIR=$(mktemp -d)
    cp -r ${iverilog-test}/* $TESTDIR

    pushd $TESTDIR
  nativeInstallCheckInputs = [
    perl
    (python3.withPackages (pp: with pp; [
      docopt
    ]))
  ];

    # Run & check tests
    PATH=$out/bin:$PATH perl vvp_reg.pl
    # Check the tests, will error if unexpected tests fail. Some failures MIGHT be normal.
    diff regression_report-devel.txt regression_report.txt
    PATH=$out/bin:$PATH perl vpi_reg.pl

    popd
  installCheckPhase = ''
    runHook preInstallCheck
    export PATH="$PATH:$out/bin"
    sh .github/test.sh
    runHook postInstallCheck
  '';

  meta = with lib; {
+1 −3
Original line number Diff line number Diff line
@@ -13358,9 +13358,7 @@ with pkgs;
  verilator = callPackage ../applications/science/electronics/verilator { };
  verilog = callPackage ../applications/science/electronics/verilog {
    autoconf = buildPackages.autoconf269;
  };
  verilog = callPackage ../applications/science/electronics/verilog { };
  versus = callPackage ../applications/networking/versus { };