commit:     15bc4ddeb0d78cf15632d7d9247532f295943602
Author:     Huang Rui <vowstar <AT> gmail <DOT> com>
AuthorDate: Mon Apr 25 11:04:38 2022 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Wed Apr 27 13:18:57 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=15bc4dde

sci-electronics/iverilog: backport fix compile bug

EAPI: update EAPI 7 -> 8
fix parse.cc fatal error
fix calls nm directly
fix can't find configure.in
fix depend on sys-libs/readline:=

Bug: https://bugs.gentoo.org/721022
Bug: https://bugs.gentoo.org/734760
Bug: https://bugs.gentoo.org/426262
Closes: https://bugs.gentoo.org/731906
Closes: https://bugs.gentoo.org/730096
Signed-off-by: Huang Rui <vowstar <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/25191
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 .../iverilog/files/iverilog-10.3-call-nm.patch     | 67 +++++++++++++++
 .../files/iverilog-10.3-configure-ac.patch         | 12 +++
 .../files/iverilog-10.3-gen-bison-header.patch     | 97 ++++++++++++++++++++++
 .../files/iverilog-10.3-override-var.patch         | 12 +++
 sci-electronics/iverilog/iverilog-10.3.ebuild      | 23 +++--
 5 files changed, 202 insertions(+), 9 deletions(-)

diff --git a/sci-electronics/iverilog/files/iverilog-10.3-call-nm.patch 
b/sci-electronics/iverilog/files/iverilog-10.3-call-nm.patch
new file mode 100644
index 000000000000..2261a6ada4cf
--- /dev/null
+++ b/sci-electronics/iverilog/files/iverilog-10.3-call-nm.patch
@@ -0,0 +1,67 @@
+From f3396d502d408c1b349c378060027905a2c2a9c3 Mon Sep 17 00:00:00 2001
+From: Huang Rui <vows...@gmail.com>
+Date: Sat, 25 Jul 2020 12:50:49 +0800
+Subject: [PATCH 1/2] aclocal.m4: fix issue in cross-compiling
+
+The aclocal.m4 called nm directly.
+It can cause issue in cross-compiling and because is not possible
+use a different NM implementation (like llvm-nm).
+The compile error log:
+https://bugs.gentoo.org/attachment.cgi?id=648556
+
+Closes: https://bugs.gentoo.org/731906
+Signed-off-by: Huang Rui <vows...@gmail.com>
+---
+ aclocal.m4 | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/aclocal.m4 b/aclocal.m4
+index a47eba42c..16ef69c85 100644
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -25,9 +25,11 @@ AC_SUBST(install_suffix)
+ # Unwarranted assumptions:
+ #   - the object file produced by AC_COMPILE_IFELSE is called 
"conftest.$ac_objext"
+ #   - the nm(1) utility is available, and its name is "nm".
++# Here use $NM because they can cause issue in cross-compiling and because is
++# not possible use a different NM implementation (like llvm-nm)
+ AC_DEFUN([_AX_C_UNDERSCORES_MATCH_IF],
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([void underscore(void){}])],
+-[AS_IF([nm conftest.$ac_objext|grep $1 >/dev/null 2>/dev/null],[$2],[$3])],
++[AS_IF([$NM conftest.$ac_objext|grep $1 >/dev/null 2>/dev/null],[$2],[$3])],
+ [AC_MSG_ERROR([underscore test crashed])]
+ )])
+ 
+
+From d827f674cc0a37d8150c18df6112a0a895f2a584 Mon Sep 17 00:00:00 2001
+From: Huang Rui <vows...@gmail.com>
+Date: Tue, 28 Jul 2020 21:15:49 +0800
+Subject: [PATCH 2/2] aclocal.m4: fix the comment contradicts the previous line
+
+Changed to "the nm(1) utility or an equivalent is available,
+and its name is defined by the $NM variable.
+
+Signed-off-by: Huang Rui <vows...@gmail.com>
+---
+ aclocal.m4 | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/aclocal.m4 b/aclocal.m4
+index 16ef69c85..1b2dd6a1e 100644
+--- a/aclocal.m4
++++ b/aclocal.m4
+@@ -23,10 +23,10 @@ AC_SUBST(install_suffix)
+ # ------------------------------
+ # Sub-macro for AX_C_UNDERSCORES_LEADING and AX_C_UNDERSCORES_TRAILING.
+ # Unwarranted assumptions:
+-#   - the object file produced by AC_COMPILE_IFELSE is called 
"conftest.$ac_objext"
+-#   - the nm(1) utility is available, and its name is "nm".
+-# Here use $NM because they can cause issue in cross-compiling and because is
+-# not possible use a different NM implementation (like llvm-nm)
++#   - the object file produced by AC_COMPILE_IFELSE is called
++#     "conftest.$ac_objext"
++#   - the nm(1) utility or an equivalent is available, and its name
++#     is defined by the $NM variable.
+ AC_DEFUN([_AX_C_UNDERSCORES_MATCH_IF],
+ [AC_COMPILE_IFELSE([AC_LANG_SOURCE([void underscore(void){}])],
+ [AS_IF([$NM conftest.$ac_objext|grep $1 >/dev/null 2>/dev/null],[$2],[$3])],

diff --git a/sci-electronics/iverilog/files/iverilog-10.3-configure-ac.patch 
b/sci-electronics/iverilog/files/iverilog-10.3-configure-ac.patch
new file mode 100644
index 000000000000..b7a81d1facaa
--- /dev/null
+++ b/sci-electronics/iverilog/files/iverilog-10.3-configure-ac.patch
@@ -0,0 +1,12 @@
+https://bugs.gentoo.org/426262
+--- a/Makefile.in      2022-04-25 18:06:16.529673077 +0800
++++ b/Makefile.in      2022-04-25 18:13:12.134356482 +0800
+@@ -200,7 +200,7 @@
+       ./config.status _pli_types.h
+ _pli_types.h: stamp-_pli_types-h
+ 
+-$(srcdir)/configure: $(srcdir)/configure.in $(srcdir)/aclocal.m4
++$(srcdir)/configure: $(srcdir)/configure.ac $(srcdir)/aclocal.m4
+       cd $(srcdir) && autoconf
+ 
+ config.status: $(srcdir)/configure
\ No newline at end of file

diff --git 
a/sci-electronics/iverilog/files/iverilog-10.3-gen-bison-header.patch 
b/sci-electronics/iverilog/files/iverilog-10.3-gen-bison-header.patch
new file mode 100644
index 000000000000..0027184c8338
--- /dev/null
+++ b/sci-electronics/iverilog/files/iverilog-10.3-gen-bison-header.patch
@@ -0,0 +1,97 @@
+From 5b699c1be73e789831db01e779a41478c0c62309 Mon Sep 17 00:00:00 2001
+From: Henner Zeller <h.zel...@acm.org>
+Date: Wed, 29 Jul 2020 15:29:08 -0700
+Subject: [PATCH] Bison includes its generated header in *.cc. Generate with
+ correct name.
+
+The current bison (3.7) generates a *.cc file that includes the header
+it generated. For parse.cc this would be parse.hh. Right now, we rename
+this header to have a common name used in other files, but this results
+in a compile error for the parse.cc file:
+
+parse.cc:462:10: fatal error: parse.hh: No such file or directory
+  462 | #include "parse.hh"
+      |          ^~~~~~~~~~
+
+Fix this by telling bison to output the header file to the correct
+filename in the first place so that we don't have to rename it.
+(using the --defines instead of -d option).
+
+This looks like a bison specific option not available in Posix yacc;
+but looks like we're requiring bison anyway.
+
+Signed-off-by: Henner Zeller <h.zel...@acm.org>
+---
+ Makefile.in         | 4 +---
+ tgt-pcb/Makefile.in | 4 +---
+ vhdlpp/Makefile.in  | 4 +---
+ vvp/Makefile.in     | 4 +---
+ 4 files changed, 4 insertions(+), 12 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 5ac5515a..cc8cac46 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -256,10 +256,8 @@ parse.o: parse.cc
+ 
+ # Build this in two steps to avoid parallel build issues (see pr3462585)
+ parse.cc: $(srcdir)/parse.y
+-      $(YACC) --verbose -t -p VL -d -o $@ $<
++      $(YACC) --verbose -t -p VL --defines=parse.h -o $@ $<
+ parse.h: parse.cc
+-      mv parse.cc.h $@ 2>/dev/null || mv parse.hh $@
+-      touch $@
+ 
+ syn-rules.cc: $(srcdir)/syn-rules.y
+       $(YACC) --verbose -t -p syn_ -o $@ $<
+diff --git a/tgt-pcb/Makefile.in b/tgt-pcb/Makefile.in
+index a5f9b7d5..7345e195 100644
+--- a/tgt-pcb/Makefile.in
++++ b/tgt-pcb/Makefile.in
+@@ -89,10 +89,8 @@ fp_lex.cc: $(srcdir)/fp.lex
+       $(LEX) -s -ofp_lex.cc $(srcdir)/fp.lex
+ 
+ fp.cc: $(srcdir)/fp.y
+-      $(YACC) --verbose -t -p fp -d -o $@ $<
++      $(YACC) --verbose -t -p fp --defines=fp.h -o $@ $<
+ fp.h: fp.cc
+-      mv fp.cc.h $@ 2>/dev/null || mv fp.hh $@
+-      touch $@
+ 
+ ifeq (@WIN32@,yes)
+   TGTLDFLAGS=-L.. -livl
+diff --git a/vhdlpp/Makefile.in b/vhdlpp/Makefile.in
+index 53ae140a..458178bd 100644
+--- a/vhdlpp/Makefile.in
++++ b/vhdlpp/Makefile.in
+@@ -117,10 +117,8 @@ lexor.cc: $(srcdir)/lexor.lex
+ 
+ # Build this in two steps to avoid parallel build issues (see pr3462585)
+ parse.cc: $(srcdir)/parse.y
+-      $(YACC) --verbose -t -d -o $@ $<
++      $(YACC) --verbose -t --defines=parse.h -o $@ $<
+ parse.h: parse.cc
+-      mv parse.cc.h $@ 2>/dev/null || mv parse.hh $@
+-      touch $@
+ 
+ lexor_keyword.o: lexor_keyword.cc parse.h
+ 
+diff --git a/vvp/Makefile.in b/vvp/Makefile.in
+index 8ccdb1d2..cdd940f5 100644
+--- a/vvp/Makefile.in
++++ b/vvp/Makefile.in
+@@ -142,10 +142,8 @@ tables.o: tables.cc
+ 
+ # Build this in two steps to avoid parallel build issues (see pr3462585)
+ parse.cc: $(srcdir)/parse.y
+-      $(YACC) --verbose -t -d -o $@ $<
++      $(YACC) --verbose -t --defines=parse.h -o $@ $<
+ parse.h: parse.cc
+-      mv parse.cc.h $@ 2>/dev/null || mv parse.hh $@
+-      touch $@
+ 
+ lexor.cc: $(srcdir)/lexor.lex
+       $(LEX) -s -olexor.cc $(srcdir)/lexor.lex
+-- 
+2.26.2
+

diff --git a/sci-electronics/iverilog/files/iverilog-10.3-override-var.patch 
b/sci-electronics/iverilog/files/iverilog-10.3-override-var.patch
new file mode 100644
index 000000000000..93b9a616987d
--- /dev/null
+++ b/sci-electronics/iverilog/files/iverilog-10.3-override-var.patch
@@ -0,0 +1,12 @@
+https://bugs.gentoo.org/730096
+--- a/vpi/Makefile.in  2022-04-25 18:39:03.748939186 +0800
++++ b/vpi/Makefile.in  2022-04-25 18:38:43.754679053 +0800
+@@ -71,7 +71,7 @@
+ M = sys_clog2.o v2005_math.o
+ 
+ # Object files for va_math.vpi
+-V = va_math.o
++override V = va_math.o
+ 
+ V2009 = v2009_table.o v2009_array.o v2009_enum.o v2009_string.o
+ 

diff --git a/sci-electronics/iverilog/iverilog-10.3.ebuild 
b/sci-electronics/iverilog/iverilog-10.3.ebuild
index 1a2a537efa44..a0e95ea74ac9 100644
--- a/sci-electronics/iverilog/iverilog-10.3.ebuild
+++ b/sci-electronics/iverilog/iverilog-10.3.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
 inherit autotools
 
@@ -26,23 +26,25 @@ LICENSE="LGPL-2.1"
 SLOT="0"
 IUSE="examples"
 
-# If you are building from git, you will also need gperf to generate
-# the configure scripts.
-RDEPEND="
-       sys-libs/readline:0
+# 721022, should depend on sys-libs/readline:=
+DEPEND="
+       sys-libs/readline:=
        sys-libs/zlib
 "
-
-DEPEND="
+RDEPEND="${DEPEND}"
+BDEPEND="
        dev-util/gperf
        sys-devel/bison
        sys-devel/flex
-       ${RDEPEND}
 "
 
 PATCHES=(
        "${FILESDIR}"/${PN}-10.3-file-missing.patch #705412
        "${FILESDIR}"/${PN}-10.3-fno-common.patch #706366
+       "${FILESDIR}"/${PN}-10.3-gen-bison-header.patch #734760
+       "${FILESDIR}"/${PN}-10.3-call-nm.patch #731906
+       "${FILESDIR}"/${PN}-10.3-configure-ac.patch #426262
+       "${FILESDIR}"/${PN}-10.3-override-var.patch #730096
 )
 
 src_prepare() {
@@ -52,6 +54,9 @@ src_prepare() {
        # Here translate the autoconf.sh, equivalent to the following code
        # > sh autoconf.sh
 
+       # Move configure.in to configure.ac (bug #426262)
+       mv configure.in configure.ac || die
+
        # Autoconf in root ...
        eautoconf --force
        # Precompiling lexor_keyword.gperf

Reply via email to