Skip to content

Commit

Permalink
verilog: 11.0 -> 12.0
Browse files Browse the repository at this point in the history
https://github.com/steveicarus/iverilog/releases/tag/v12_0

Bump `iverilog` to 12.0, fixing two build failures:

1. autoconf now picks up on the unwrapped `x86_64-unknown-gnu-gcc` in
   path that fails at configurePhase to link executables.
   See: NixOS#21751
   fix/hack: define the `{CC,CXX}_FOR_BUILD` variables.
2. buildPhase generates a `-Werror=format-security` error. Backport
   the the upstream patch that fixed the warning very shortly after the
   release was cut.

And in the process,

- use post-install tests from `.github/test.sh` and as a result,
  remove the now unneeded clone of `ivtest`
- un-pin the verilog autoconf version

Signed-off-by: Jack Leightcap <[email protected]>
  • Loading branch information
Luflosi authored and selmison committed May 8, 2023
1 parent de07ea3 commit 42c9b2e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
56 changes: 29 additions & 27 deletions pkgs/applications/science/electronics/verilog/default.nix
Original file line number Diff line number Diff line change
@@ -1,62 +1,64 @@
{ lib, stdenv
, fetchFromGitHub
, fetchpatch
, autoconf
, bison
, bzip2
, flex
, 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 ];
doCheck = true;
doInstallCheck = true;

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; {
Expand Down
4 changes: 1 addition & 3 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13360,9 +13360,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 { };

Expand Down

0 comments on commit 42c9b2e

Please sign in to comment.