Compare commits

...

10 Commits

Author SHA1 Message Date
Martin Whitaker 70094ce564 Disable PLI1 support in MSYS2/CLANG CI. 2025-10-25 15:49:11 +01:00
Martin Whitaker e32584f228 Remove spurious space in MSYS2 PKGBUILD. 2025-10-25 15:23:12 +01:00
Martin Whitaker 9bf45a85e2 Fix errors in MSYS2 PKGBUILD. 2025-10-25 15:15:51 +01:00
Martin Whitaker 97da696b5a Add missing gperf dependency in MSYS2 PKGBUILD. 2025-10-25 14:33:22 +01:00
Martin Whitaker d392dcf07f Fix syntax error in github workflow. 2025-10-25 14:22:51 +01:00
Martin Whitaker e4b3f1bc69 Make MSYS2 build instructions more prominent in the documentation. 2025-10-25 14:16:00 +01:00
Martin Whitaker b69cb8efda Update documentation to describe the --enable-libveriuser config option.
Also fix a typo in the --with-valgrind description.
2025-10-25 14:16:00 +01:00
Martin Whitaker d766248bc1 Update CI to also test ucrt64 and clang64 builds in MSYS2. 2025-10-25 14:16:00 +01:00
Martin Whitaker 587d87bb96 Update MSYS2 PKGBUILD to support ucrt64 and clang64 as well as mingw64.
Also allow extra configuration options to be passed via the
IVL_CONFIG_OPTIONS environment variable and add some missing
dependencies. Don't include --enable-libveriuser by default.
Update the README accordingly, with sensible line wrapping.
2025-10-25 14:16:00 +01:00
Martin Whitaker da853622e9 Don't delete vvp/libvvp.h when running 'make clean'. 2025-10-25 14:16:00 +01:00
7 changed files with 108 additions and 49 deletions

6
.github/test.sh vendored
View File

@ -9,7 +9,11 @@ status=0
perl vvp_reg.pl || status=1
perl vpi_reg.pl --with-pli1 || status=1
if [ "x$1" = "xno-pli1" ] ; then
perl vpi_reg.pl || status=1
else
perl vpi_reg.pl --with-pli1 || status=1
fi
python3 vvp_reg.py || status=1

View File

@ -76,10 +76,11 @@ jobs:
strategy:
fail-fast: false
matrix:
include: [
{ msystem: MINGW64, arch: x86_64 }
]
name: 🟪 ${{ matrix.msystem}} · ${{ matrix.arch }}
include:
- { msystem: MINGW64, env: x86_64 opt: pli1 }
- { msystem: UCRT64, env: ucrt-x86_64 opt: pli1 }
- { msystem: CLANG64, env: clang-x86_64 opt: no-pli1 }
name: 🟪 ${{ matrix.msystem}}
defaults:
run:
shell: msys2 {0}
@ -99,9 +100,8 @@ jobs:
install: >
git
base-devel
gperf
python-pip
mingw-w64-${{ matrix.arch }}-toolchain
mingw-w64-${{ matrix.env }}-perl
- uses: actions/setup-python@v5
with:
@ -110,6 +110,9 @@ jobs:
- name: Build and check
run: |
cd msys2
if [ ${{ matrix.opt }} = "pli1" ] ; then
export IVL_CONFIG_OPTIONS="--enable-libveriuser"
fi
makepkg-mingw --noconfirm --noprogressbar -sCLf
- name: Install
@ -117,9 +120,9 @@ jobs:
- name: Test
run: |
./.github/test.sh
./.github/test.sh ${{ matrix.opt }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.msystem }}-${{ matrix.arch }}
name: ${{ matrix.msystem }}
path: msys2/*.zst

View File

@ -103,6 +103,22 @@ reference the correct run time files and directories. The run time will check
that it is running a file with a compatible version e.g.(you can not run a
V0.9 file with the V0.8 run time).
.. code-block:: none
--enable-libvvp
The vvp progam is built as a small stub linked to a shared library,
libvvp.so, that may be linked with other programs so that they can host
a vvp simulation.
.. code-block:: none
--enable-libveriuser
PLI version 1 (the ACC and TF routines) were deprecated in IEEE 1364-2005.
These are supported in Icarus Verilog by the libveriuser library and cadpli
module. Starting with v13, these will only be built if this option is used.
A debug options is:
.. code-block:: none
@ -111,7 +127,7 @@ A debug options is:
This option adds extra memory cleanup code and pool management code to allow
better memory leak checking when valgrind is available. This option is not
need when checking for basic errors with valgrind.
needed when checking for basic errors with valgrind.
Compiling on Linux
------------------
@ -222,4 +238,3 @@ or the version branch that you are working on. Your pull request will be run
through continuous integration, and reviewed by one of the main
authors. Feedback may be offered to your PR, and once accepted, an approved
individual will merge it for you. Then you are done.

View File

@ -99,13 +99,19 @@ time). ::
This option adds extra memory cleanup code and pool management code to allow
better memory leak checking when valgrind is available. This option is not
need when checking for basic errors with valgrind. ::
needed when checking for basic errors with valgrind. ::
--enable-libvvp
The vvp progam is built as a small stub linked to a shared library,
libvvp.so, that may be linked with other programs so that they can host
a vvp simulation.
a vvp simulation. ::
--enable-libveriuser
PLI version 1 (the ACC and TF routines) were deprecated in IEEE 1364-2005.
These are supported in Icarus Verilog by the libveriuser library and cadpli
module. Starting with v13, these will only be built if this option is used.
Compiling on Linux/Unix
-----------------------
@ -151,8 +157,8 @@ be updated to version 3. ::
Icarus Verilog is also available through the Homebrew package manager: "brew
install icarus-verilog".
Compiling for Windows
---------------------
Cross-Compiling for Windows
---------------------------
These are instructions for building Icarus Verilog binaries for
Windows using mingw cross compiler tools on Linux.
@ -180,4 +186,8 @@ bits that need to be compiled with the native compiler. (version.exe
for example is used by the build process but is not installed.) The
configure script should have gotten all that right.
There is also a MSYS2 build recipe which you can find under `msys2/` in the repository.
Compiling for Windows using MSYS2
---------------------------------
There is a MSYS2 build recipe which you can find under `msys2/` in the
repository. The accompanying README file provides further details.

View File

@ -1,17 +1,21 @@
_realname=iverilog
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=ci
pkgver=devel
pkgrel=1
pkgdesc="Icarus Verilog, a Verilog simulation and synthesis tool (mingw-w64)"
pkgdesc="Icarus Verilog, a Verilog simulation tool (mingw-w64)"
arch=('any')
mingw_arch=('mingw64', 'ucrt64', 'clang64')
url="https://steveicarus.github.io/iverilog/"
license=('GPLv2+')
depends=("${MINGW_PACKAGE_PREFIX}-readline"
"${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=("autoconf"
license=('spdx:GPL-2.0-or-later')
depends=("${MINGW_PACKAGE_PREFIX}-cc-libs"
"${MINGW_PACKAGE_PREFIX}-readline"
"${MINGW_PACKAGE_PREFIX}-bzip2"
"${MINGW_PACKAGE_PREFIX}-zlib")
makedepends=("gperf"
"man-db"
"${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-autotools"
"${MINGW_PACKAGE_PREFIX}-ghostscript")
source=()
@ -21,18 +25,17 @@ build() {
cd "${srcdir}"/../..
sh autoconf.sh
./configure \
--enable-libveriuser \
--prefix="${MINGW_PREFIX}" \
--host="$CARCH"-w64-mingw32
mingw32-make
${IVL_CONFIG_OPTIONS}
make
}
check() {
cd "${srcdir}"/../..
mingw32-make check
make check
}
package() {
cd "${srcdir}"/../..
mingw32-make DESTDIR="${pkgdir}" PACKAGE="${_realname}" install
make DESTDIR="${pkgdir}" PACKAGE="${_realname}" install
}

View File

@ -1,29 +1,53 @@
# MSYS2 build recipe
This subdir contains a [PKGBUILD](https://wiki.archlinux.org/index.php/PKGBUILD) recipe for building iverilog on [MSYS2](https://www.msys2.org/). MSYS2 is a collection of tools and libraries for Windows, which is closely based on the packaging approach in [Arch Linux](https://www.archlinux.org/). Precisely, the package manager in MSYS2 is a port of [pacman](https://wiki.archlinux.org/index.php/pacman). Therefore, the structure of PKGBUILD recipes in MSYS2 is very similar to packages in Arch Linux and the build script (`makepkg-mingw`) is a port of [makepkg](https://wiki.archlinux.org/index.php/makepkg).
This directory contains a [PKGBUILD](https://wiki.archlinux.org/index.php/PKGBUILD)
recipe for building Icarus Verilog in [MSYS2](https://www.msys2.org/). MSYS2
is a collection of tools and libraries for Windows that is closely based on
the packaging approach in [Arch Linux](https://www.archlinux.org/). The package
manager in MSYS2 is a port of [pacman](https://wiki.archlinux.org/index.php/pacman).
Therefore the structure of PKGBUILD recipes in MSYS2 is very similar to that in
Arch Linux and the build script (`makepkg-mingw`) is a port of
[makepkg](https://wiki.archlinux.org/index.php/makepkg).
Other than that, PKGBUILD files are shell scripts containing some specific functions (build, package, check, etc.) and metadata (variables). The build system takes care of dependencies, creating temporary directories, generating a tarball, etc. Therefore, the recommended approach for building iverilog on Windows is the following:
Other than that, PKGBUILD files are shell scripts containing some specific
functions (build, package, check, etc.) and metadata (variables). The build
system takes care of dependencies, creating temporary directories, generating
a tarball, etc. Therefore, the recommended approach for building Icarus Verilog
on Windows is the following:
```sh
# Install the toolchain
pacman -S mingw-w64-x86_64-toolchain
# and/or mingw-w64-i686-toolchain
# Install the base development tools
pacman -S base-devel
# Retrieve iverilog sources. Optionally, retrieve a tarball, or an specific branch/version.
# Retrieve the Icarus Verilog sources. Optionally, retrieve a tarball, or a
# specific branch/version.
git clone https://github.com/steveicarus/iverilog
cd iverilog
# Call makepkg-mingw from subdir 'msys2'. It will build, check and package iverilog.
# Call makepkg-mingw from the directory 'msys2'. It will install dependencies,
# build, check, and package Icarus Verilog.
cd msys2
MINGW_INSTALLS=mingw64 makepkg-mingw --noconfirm --noprogressbar -sCLf
# or, set the envvar to 'mingw32', or unset it for building both packages at the same time
makepkg-mingw --noconfirm --noprogressbar -sCLf
# Optionally, install the tarball(s)/package(s). Or just distribute it/them.
pacman -U --noconfirm *.zst
```
NOTE: the continuous integration workflow in [github.com/steveicarus](https://github.com/steveicarus) uses the procedure above for building iverilog on MINGW32 and MINGW64 each time a commit is pushed or a Pull Request is updated. The two generated packages are uploaded as artifacts. Hence, users willing to test *nightly* builds or specific features, can download and install the tarballs from the corresponding CI run.
Additional configuration options can be passed to the configuration step
by setting the environment variable `IVL_CONFIG_OPTIONS` before calling
`makepkg-mingw`, e.g.
```sh
export IVL_CONFIG_OPTIONS=-"-enable-suffix=-devel --enable-libvvp"
```
Nevertheless, the content of functions `build` and `check` in the PKGBUILD file should be familiar for any user willing to build iverilog *manually*. Those can be executed in a shell (ignoring makepkg), as long as the few envvars are properly defined.
NOTE: the continuous integration workflow in [github.com/steveicarus/iverilog]
(https://github.com/steveicarus/iverilog) uses the above procedure for building
Icarus Verilog for Windows each time a commit is pushed or a pull request is
updated. The generated packages are uploaded as artifacts. Hence, users willing
to test *development* builds or specific features, can download and install the
tarballs from the corresponding CI run.
HINT: this document explains the most straightforward and automatec solution for building iverilog on Windows. However, intermediate and advanced users might want to check [iverilog.fandom.com/wiki/Installation_using_MSYS2](https://iverilog.fandom.com/wiki/Installation_using_MSYS2) for some specific tweaks, such as using a custom prefix for iverilog executables, or using MSYS2 packages/tarballs outside of MSYS2.
Nevertheless, the content of functions `build` and `check` in the PKGBUILD file
should be familiar to any user willing to build iverilog *manually*. Those can
be executed in a shell (ignoring makepkg), as long as the few environment
variables are properly defined.

View File

@ -62,6 +62,14 @@ CXXFLAGS = @WARNING_FLAGS@ @WARNING_FLAGS_CXX@ @CXXFLAGS@
LDFLAGS = @rdynamic@ @LDFLAGS@
LIBS = @LIBS@ @EXTRALIBS@
ifeq (@WIN32@,yes)
SLDIR=$(bindir)
SLEXT=dll
else
SLDIR=$(libdir)
SLEXT=so
endif
dllib=@DLLIB@
MDIR1 = -DMODULE_DIR1='"$(libdir)/ivl$(suffix)"'
@ -101,7 +109,7 @@ else
endif
clean:
rm -f *.o *~ parse.cc parse.h lexor.cc tables.cc libvvp$(suffix).*
rm -f *.o *~ parse.cc parse.h lexor.cc tables.cc libvvp$(suffix).$(SLEXT)
rm -rf dep vvp@EXEEXT@ parse.output vvp.man vvp.ps vvp.pdf vvp.exp
distclean: clean
@ -130,14 +138,6 @@ ifeq (@LIBVVP@,yes)
CPPFLAGS+= -fpic
ifeq (@WIN32@,yes)
SLDIR=$(bindir)
SLEXT=dll
else
SLDIR=$(libdir)
SLEXT=so
endif
# To avoid setting LD_LIBRARY_PATH when running vvp from the build tree,
# add option -Wl,-rpath=`pwd` to the CXX command below.