From e97667163ea4b9e17f2341c08c066ff47ce3722a Mon Sep 17 00:00:00 2001 From: Luflosi Date: Tue, 18 Apr 2023 17:45:26 +0200 Subject: [PATCH 1/3] verilog: 11.0 -> 12.0 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: https://github.com/NixOS/nixpkgs/issues/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 --- .../science/electronics/verilog/default.nix | 56 ++++++++++--------- pkgs/top-level/all-packages.nix | 4 +- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/pkgs/applications/science/electronics/verilog/default.nix b/pkgs/applications/science/electronics/verilog/default.nix index 994ecb8c1314..485bc27e801c 100644 --- a/pkgs/applications/science/electronics/verilog/default.nix +++ b/pkgs/applications/science/electronics/verilog/default.nix @@ -1,5 +1,6 @@ { lib, stdenv , fetchFromGitHub +, fetchpatch , autoconf , bison , bzip2 @@ -7,56 +8,57 @@ , 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; + + nativeInstallCheckInputs = [ + perl + (python3.withPackages (pp: with pp; [ + docopt + ])) + ]; installCheckPhase = '' - # copy tests to allow writing results - export TESTDIR=$(mktemp -d) - cp -r ${iverilog-test}/* $TESTDIR - - pushd $TESTDIR - - # 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 + runHook preInstallCheck + export PATH="$PATH:$out/bin" + sh .github/test.sh + runHook postInstallCheck ''; meta = with lib; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5a46b6afe7f6..c2a47535da37 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13336,9 +13336,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 { }; From 03ad8569fd648be154c4258d8d3c02ee7e28bed6 Mon Sep 17 00:00:00 2001 From: Jack Leightcap Date: Sat, 6 May 2023 12:35:27 -0400 Subject: [PATCH 2/3] verilog-12.0: temp disable regression test suite Signed-off-by: Jack Leightcap --- pkgs/applications/science/electronics/verilog/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/science/electronics/verilog/default.nix b/pkgs/applications/science/electronics/verilog/default.nix index 485bc27e801c..bf55ec982ca5 100644 --- a/pkgs/applications/science/electronics/verilog/default.nix +++ b/pkgs/applications/science/electronics/verilog/default.nix @@ -44,8 +44,13 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; + # 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 = true; + doInstallCheck = false; nativeInstallCheckInputs = [ perl From 4fdd191d657239832938a58cf008f4f3f1e28f05 Mon Sep 17 00:00:00 2001 From: Jack Leightcap Date: Sat, 6 May 2023 13:06:47 -0400 Subject: [PATCH 3/3] verilog-12.0: installCheckPhase on supported arch Signed-off-by: Jack Leightcap --- pkgs/applications/science/electronics/verilog/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/science/electronics/verilog/default.nix b/pkgs/applications/science/electronics/verilog/default.nix index bf55ec982ca5..0a93759947d7 100644 --- a/pkgs/applications/science/electronics/verilog/default.nix +++ b/pkgs/applications/science/electronics/verilog/default.nix @@ -50,7 +50,7 @@ stdenv.mkDerivation rec { # (see https://github.com/steveicarus/iverilog/issues/917) # so disable the full suite for now. doCheck = true; - doInstallCheck = false; + doInstallCheck = !stdenv.isAarch64; nativeInstallCheckInputs = [ perl