2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv
|
2020-11-19 00:13:47 +00:00
|
|
|
, fetchFromGitHub
|
2023-05-24 13:37:59 +00:00
|
|
|
, fetchpatch
|
2020-11-19 00:13:47 +00:00
|
|
|
, autoconf
|
|
|
|
, bison
|
|
|
|
, bzip2
|
|
|
|
, flex
|
|
|
|
, gperf
|
|
|
|
, ncurses
|
2020-10-07 09:15:18 +00:00
|
|
|
, perl
|
2023-05-24 13:37:59 +00:00
|
|
|
, python3
|
2020-11-19 00:13:47 +00:00
|
|
|
, readline
|
|
|
|
, zlib
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2020-11-12 23:50:31 +00:00
|
|
|
pname = "iverilog";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "12.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2020-11-12 23:50:31 +00:00
|
|
|
owner = "steveicarus";
|
|
|
|
repo = pname;
|
2021-01-17 00:15:33 +00:00
|
|
|
rev = "v${lib.replaceStrings ["."] ["_"] version}";
|
2023-05-24 13:37:59 +00:00
|
|
|
hash = "sha256-J9hedSmC6mFVcoDnXBtaTXigxrSCFa2AhhFd77ueo7I=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-11-19 00:13:47 +00:00
|
|
|
nativeBuildInputs = [ autoconf bison flex gperf ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
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=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2020-11-19 00:13:47 +00:00
|
|
|
buildInputs = [ bzip2 ncurses readline zlib ];
|
|
|
|
|
|
|
|
preConfigure = "sh autoconf.sh";
|
2020-11-12 23:50:31 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
2020-11-19 00:13:47 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
env = lib.optionalAttrs stdenv.isDarwin {
|
|
|
|
NIX_CFLAGS_COMPILE = "-Wno-error=implicit-function-declaration";
|
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
# 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;
|
2020-11-19 00:13:47 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
nativeInstallCheckInputs = [
|
|
|
|
perl
|
|
|
|
(python3.withPackages (pp: with pp; [
|
|
|
|
docopt
|
|
|
|
]))
|
|
|
|
];
|
2020-10-07 09:15:18 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
installCheckPhase = ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
export PATH="$PATH:$out/bin"
|
|
|
|
sh .github/test.sh
|
|
|
|
runHook postInstallCheck
|
2020-10-07 09:15:18 +00:00
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Icarus Verilog compiler";
|
2020-11-19 00:13:47 +00:00
|
|
|
homepage = "http://iverilog.icarus.com/"; # https does not work
|
2020-11-12 23:50:31 +00:00
|
|
|
license = with licenses; [ gpl2Plus lgpl21Plus ];
|
2022-07-14 12:49:19 +00:00
|
|
|
maintainers = with maintainers; [ thoughtpolice ];
|
2020-11-12 23:50:31 +00:00
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|