commit:     01e3aec7e7e42a3ff27a057482656b825e1648ed
Author:     Huang Rui <vowstar <AT> gmail <DOT> com>
AuthorDate: Mon Mar 18 13:19:09 2024 +0000
Commit:     Julien Roy <julien <AT> jroy <DOT> ca>
CommitDate: Mon Mar 18 13:19:09 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=01e3aec7

sci-electronics/verilator: fix compile bugs

- fix fails to compile with dev-lang/python-exec[-native-symlinks]
- fix adds debug flags (-g/-ggdb) on its own

Closes: https://bugs.gentoo.org/785151
Closes: https://bugs.gentoo.org/887917
Signed-off-by: Huang Rui <vowstar <AT> gmail.com>

 sci-electronics/verilator/verilator-5.022.ebuild | 29 +++++++++++++++++++++-
 sci-electronics/verilator/verilator-9999.ebuild  | 31 ++++++++++++++++++++++--
 2 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/sci-electronics/verilator/verilator-5.022.ebuild 
b/sci-electronics/verilator/verilator-5.022.ebuild
index a71b2db38c..b5557f2f17 100644
--- a/sci-electronics/verilator/verilator-5.022.ebuild
+++ b/sci-electronics/verilator/verilator-5.022.ebuild
@@ -3,7 +3,9 @@
 
 EAPI="8"
 
-inherit autotools
+PYTHON_COMPAT=( python3_{9..12} )
+
+inherit autotools python-single-r1
 
 DESCRIPTION="The fast free Verilog/SystemVerilog simulator"
 HOMEPAGE="
@@ -21,8 +23,12 @@ fi
 
 LICENSE="|| ( Artistic-2 LGPL-3 )"
 SLOT="0"
+IUSE="debug test"
+RESTRICT="!test? ( test )"
 
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
 RDEPEND="
+       ${PYTHON_DEPS}
        dev-lang/perl
        sys-libs/zlib
 "
@@ -34,13 +40,34 @@ DEPEND="
 BDEPEND="
        sys-devel/bison
        sys-devel/flex
+       test? (
+               dev-build/cmake
+       )
 "
 
+pkg_setup() {
+       python-single-r1_pkg_setup
+}
+
 src_prepare() {
        default
        if [[ ! "${PV}" == "9999" ]] ; then
                # https://github.com/verilator/verilator/issues/3352
                sed -i "s/UNKNOWN_REV/(Gentoo ${PVR})/g" "${S}"/src/config_rev 
|| die
        fi
+       # https://bugs.gentoo.org/785151
+       sed -i "s/python3/${EPYTHON}/g" "${S}"/configure.ac || die
+       find . -name "Makefile" -exec sed -i "s/python3/${EPYTHON}/g" {} + || 
die
+       find test_regress -type f -exec sed -i "s/python3/${EPYTHON}/g" {} + || 
die
+       python_fix_shebang .
+       # https://bugs.gentoo.org/887917
+       if ! use debug; then
+               sed -i '/AC_SUBST(CFG_CXXFLAGS_DEBUG)/i CFG_CXXFLAGS_DEBUG=""' 
"${S}"/configure.ac || die
+               sed -i '/AC_SUBST(CFG_LDFLAGS_DEBUG)/i CFG_LDFLAGS_DEBUG=""' 
"${S}"/configure.ac || die
+       fi
        eautoconf --force
 }
+
+src_test() {
+       emake test
+}

diff --git a/sci-electronics/verilator/verilator-9999.ebuild 
b/sci-electronics/verilator/verilator-9999.ebuild
index 644cb0bfca..b5557f2f17 100644
--- a/sci-electronics/verilator/verilator-9999.ebuild
+++ b/sci-electronics/verilator/verilator-9999.ebuild
@@ -1,9 +1,11 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI="8"
 
-inherit autotools
+PYTHON_COMPAT=( python3_{9..12} )
+
+inherit autotools python-single-r1
 
 DESCRIPTION="The fast free Verilog/SystemVerilog simulator"
 HOMEPAGE="
@@ -21,8 +23,12 @@ fi
 
 LICENSE="|| ( Artistic-2 LGPL-3 )"
 SLOT="0"
+IUSE="debug test"
+RESTRICT="!test? ( test )"
 
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
 RDEPEND="
+       ${PYTHON_DEPS}
        dev-lang/perl
        sys-libs/zlib
 "
@@ -34,13 +40,34 @@ DEPEND="
 BDEPEND="
        sys-devel/bison
        sys-devel/flex
+       test? (
+               dev-build/cmake
+       )
 "
 
+pkg_setup() {
+       python-single-r1_pkg_setup
+}
+
 src_prepare() {
        default
        if [[ ! "${PV}" == "9999" ]] ; then
                # https://github.com/verilator/verilator/issues/3352
                sed -i "s/UNKNOWN_REV/(Gentoo ${PVR})/g" "${S}"/src/config_rev 
|| die
        fi
+       # https://bugs.gentoo.org/785151
+       sed -i "s/python3/${EPYTHON}/g" "${S}"/configure.ac || die
+       find . -name "Makefile" -exec sed -i "s/python3/${EPYTHON}/g" {} + || 
die
+       find test_regress -type f -exec sed -i "s/python3/${EPYTHON}/g" {} + || 
die
+       python_fix_shebang .
+       # https://bugs.gentoo.org/887917
+       if ! use debug; then
+               sed -i '/AC_SUBST(CFG_CXXFLAGS_DEBUG)/i CFG_CXXFLAGS_DEBUG=""' 
"${S}"/configure.ac || die
+               sed -i '/AC_SUBST(CFG_LDFLAGS_DEBUG)/i CFG_LDFLAGS_DEBUG=""' 
"${S}"/configure.ac || die
+       fi
        eautoconf --force
 }
+
+src_test() {
+       emake test
+}

Reply via email to