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.
This commit is contained in:
Martin Whitaker 2025-10-25 13:24:12 +01:00
parent da853622e9
commit 587d87bb96
2 changed files with 51 additions and 26 deletions

View File

@ -1,17 +1,19 @@
_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)"
arch=('any')
pkgdesc="Icarus Verilog, a Verilog simulation tool (mingw-w64)"
arch=('mingw64', 'ucrt64', 'clang64')
url="https://steveicarus.github.io/iverilog/"
license=('GPLv2+')
depends=("${MINGW_PACKAGE_PREFIX}-readline"
"${MINGW_PACKAGE_PREFIX}-gcc-libs")
makedepends=("autoconf"
"man-db"
"${MINGW_PACKAGE_PREFIX}-gcc"
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=("man-db"
"${MINGW_PACKAGE_PREFIX}-cc"
"${MINGW_PACKAGE_PREFIX}-autotools"
"${MINGW_PACKAGE_PREFIX}-ghostscript")
source=()
@ -21,18 +23,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.