summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumbach <healther@users.noreply.github.com>2020-10-02 21:06:01 +0200
committerGitHub <noreply@github.com>2020-10-02 12:06:01 -0700
commit145e3c721551c65b8e1c2845f22dcc00f7212529 (patch)
tree0b5ec67fd48eed3545243b2967a55c1b0685323d
parent569eb866fc7f42da0018b73ac7b4bc7a5dbc76ff (diff)
downloadspack-145e3c721551c65b8e1c2845f22dcc00f7212529.tar.gz
spack-145e3c721551c65b8e1c2845f22dcc00f7212529.tar.bz2
spack-145e3c721551c65b8e1c2845f22dcc00f7212529.tar.xz
spack-145e3c721551c65b8e1c2845f22dcc00f7212529.zip
New package: Icarus (#19092)
Co-authored-by: Philipp Spilger <philipp.spilger@kip.uni-heidelberg.de> Co-authored-by: Eric Müller <mueller@kip.uni-heidelberg.de>
-rw-r--r--var/spack/repos/builtin/packages/icarus/fix-gcc-10.patch71
-rw-r--r--var/spack/repos/builtin/packages/icarus/package.py37
2 files changed, 108 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/icarus/fix-gcc-10.patch b/var/spack/repos/builtin/packages/icarus/fix-gcc-10.patch
new file mode 100644
index 0000000000..6485f3bb72
--- /dev/null
+++ b/var/spack/repos/builtin/packages/icarus/fix-gcc-10.patch
@@ -0,0 +1,71 @@
+From d49d26a5c502faf132a7a65e5cc7173ac0dfa1f5 Mon Sep 17 00:00:00 2001
+From: Huang Rui <vowstar@gmail.com>
+Date: Wed, 29 Jan 2020 00:08:59 +0800
+Subject: [PATCH] Fix fails to build with -fno-common or gcc-10
+
+See also: https://bugs.gentoo.org/706366
+
+gcc-10 and above flipped a default from -fcommon to -fno-common:
+https://gcc.gnu.org/PR85678
+
+Usually all it takes is to add a few 'extern' declarations and
+move definitions from header files to modules. I've port iverilog
+to gcc-10 accroding to this guide:
+https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common
+
+To fix this, I analyzed the code, and found ``pli_trace`` has been
+defined at here:
+https://github.com/steveicarus/iverilog/blob/v10_3/libveriuser/priv.c#L24
+
+So I changed ``FILE* pli_trace;`` to ``extern FILE* pli_trace;``.
+
+The var ``current_file`` only in ``cfparse_misc.h``, I changed it
+from ``char *current_file;`` to ``extern char *current_file;`` and
+declaring it in cflexor.lex
+
+And then it works.
+
+Signed-off-by: Huang Rui <vowstar@gmail.com>
+---
+ driver/cflexor.lex | 2 ++
+ driver/cfparse_misc.h | 2 +-
+ libveriuser/priv.h | 2 +-
+ 3 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/driver/cflexor.lex b/driver/cflexor.lex
+index 5e9e2f506..1bf7cec1d 100644
+--- a/driver/cflexor.lex
++++ b/driver/cflexor.lex
+@@ -27,6 +27,8 @@
+ # include "globals.h"
+ # include <string.h>
+
++char *current_file = NULL;
++
+ static int comment_enter;
+ static char* trim_trailing_white(char*txt, int trim);
+
+diff --git a/driver/cfparse_misc.h b/driver/cfparse_misc.h
+index 3cb7ddd6e..0323690ce 100644
+--- a/driver/cfparse_misc.h
++++ b/driver/cfparse_misc.h
+@@ -39,6 +39,6 @@ int cferror(const char *);
+ int cfparse(void);
+ void switch_to_command_file(const char *);
+ void destroy_lexor(void);
+-char *current_file;
++extern char *current_file;
+
+ #endif /* IVL_cfparse_misc_H */
+diff --git a/libveriuser/priv.h b/libveriuser/priv.h
+index 8256e16d3..8d3566087 100644
+--- a/libveriuser/priv.h
++++ b/libveriuser/priv.h
+@@ -31,6 +31,6 @@ extern char* __acc_newstring(const char*txt);
+ /*
+ * Trace file for logging ACC and TF calls.
+ */
+-FILE* pli_trace;
++extern FILE* pli_trace;
+
+ #endif /* IVL_priv_H */
diff --git a/var/spack/repos/builtin/packages/icarus/package.py b/var/spack/repos/builtin/packages/icarus/package.py
new file mode 100644
index 0000000000..16e9c80d0e
--- /dev/null
+++ b/var/spack/repos/builtin/packages/icarus/package.py
@@ -0,0 +1,37 @@
+# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
+from spack import *
+
+
+class Icarus(AutotoolsPackage):
+ """Icarus Verilog is a Verilog simulation and synthesis tool."""
+
+ homepage = "http://www.iverilog.icarus.com"
+
+ version('v10_3', git='https://github.com/steveicarus/iverilog.git',
+ commit='453c5465895eaca4a792d18b75e9ec14db6ea50e')
+
+ depends_on('autoconf', type='build')
+ depends_on('bison', type='build')
+ depends_on('flex', type='build')
+ depends_on('gperf @3.0:', type='build')
+ depends_on('readline @4.2:', type=('build', 'link'))
+ depends_on('zlib', type=('build', 'link'))
+
+ patch('fix-gcc-10.patch', when='@v10_3')
+
+ def autoreconf(self, spec, prefix):
+ bash = which('bash')
+ bash('./autoconf.sh')
+
+ @run_before('install')
+ def create_install_folders(self):
+ mkdirp(prefix.bin)
+ mkdirp(join_path(prefix.include, 'iverilog'))
+ mkdirp(join_path(prefix.lib, 'ivl'))
+ mkdirp(join_path(prefix.lib, 'ivl', 'include'))
+ mkdirp(join_path(prefix.share, 'man'))
+ mkdirp(join_path(prefix.share, 'man', 'man1'))