blob: 9a0d9e586871d83ac58f8c0fd3761c5076e8e002 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI="8"
PYTHON_COMPAT=( python3_{13..14} )
inherit autotools python-single-r1
DESCRIPTION="The fast free Verilog/SystemVerilog simulator"
HOMEPAGE="
https://verilator.org
https://github.com/verilator/verilator
"
if [[ "${PV}" == "9999" ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/${PN}/${PN}.git"
else
SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
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
app-arch/lz4:=
virtual/zlib:=
"
DEPEND="
${RDEPEND}
"
BDEPEND="
sys-devel/bison
sys-devel/flex
test? (
dev-build/cmake
dev-debug/gdb
$(python_gen_cond_dep 'dev-python/distro[${PYTHON_USEDEP}]')
)
"
src_prepare() {
default
# https://bugs.gentoo.org/785151 and https://bugs.gentoo.org/975566
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 and https://bugs.gentoo.org/975970
# Upstream hard-codes -O3 / -Og / -ggdb / -gz / -Os / -O0, overriding user
# CFLAGS/CXXFLAGS.
local v
for v in CFG_CXXFLAGS_OPT CFG_CXXFLAGS_DBG CFG_LDFLAGS_DBG ; do
sed -i "/AC_SUBST(${v})/i ${v}=\"\"" "${S}"/configure.ac || die
done
sed -i -e 's/^OPT_FAST = .*/OPT_FAST =/' \
-e 's/^OPT_GLOBAL = .*/OPT_GLOBAL =/' \
"${S}"/include/verilated.mk.in || die
sed -i -e 's/"OPT_FAST=-O0"/""/g' \
-e 's/"OPT_GLOBAL=-O0"/""/g' \
-e 's/"-Os" if param\[.benchmark.\] else "-O0"/"" if True else ""/g' \
"${S}"/test_regress/driver.py || die
find "${S}"/examples -name Makefile_obj -exec sed -i \
-e 's/^OPT_FAST = .*/OPT_FAST =/' \
-e 's/^OPT_SLOW = .*/OPT_SLOW =/' \
-e 's/^OPT_GLOBAL = .*/OPT_GLOBAL =/' {} + || die
eautoconf --force
}
src_configure() {
# https://bugs.gentoo.org/887919
econf CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}"
}
src_compile() {
# https://github.com/verilator/verilator/issues/3352
export VERILATOR_SRC_VERSION="(Gentoo ${PVR})"
default
}
src_test() {
emake test
}
|