File 0002-vvp-install-libvvp-pkg-config-file.patch of Package iverilog

From 4d79c2c10b5a9384ca593a0110bfb0fc62ae00a9 Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Tue, 6 Jan 2026 00:09:30 +0100
Subject: [PATCH 2/2] vvp: install libvvp pkg-config file

Install a libvvp.pc pkg-config file for the VVP runtime library.
This allows downstream projects to discover the correct compiler
and linker flags, improving cross-compilation and MinGW support.
---
 configure.ac     | 2 +-
 vvp/Makefile.in  | 7 ++++++-
 vvp/libvvp.pc.in | 9 +++++++++
 3 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 vvp/libvvp.pc.in

diff --git a/configure.ac b/configure.ac
index 8188f10f5..02584e9c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -365,5 +365,5 @@ then
 AC_MSG_ERROR(cannot configure white space in libdir: $libdir)
 fi
 AC_MSG_RESULT(ok)
-AC_CONFIG_FILES([Makefile ivlpp/Makefile vhdlpp/Makefile vvp/Makefile vpi/Makefile driver/Makefile driver-vpi/Makefile cadpli/Makefile libveriuser/Makefile tgt-null/Makefile tgt-stub/Makefile tgt-vvp/Makefile tgt-vhdl/Makefile tgt-fpga/Makefile tgt-verilog/Makefile tgt-pal/Makefile tgt-vlog95/Makefile tgt-pcb/Makefile tgt-blif/Makefile tgt-sizer/Makefile])
+AC_CONFIG_FILES([Makefile ivlpp/Makefile vhdlpp/Makefile vvp/Makefile vpi/Makefile driver/Makefile driver-vpi/Makefile cadpli/Makefile libveriuser/Makefile tgt-null/Makefile tgt-stub/Makefile tgt-vvp/Makefile tgt-vhdl/Makefile tgt-fpga/Makefile tgt-verilog/Makefile tgt-pal/Makefile tgt-vlog95/Makefile tgt-pcb/Makefile tgt-blif/Makefile tgt-sizer/Makefile vvp/libvvp.pc])
 AC_OUTPUT
diff --git a/vvp/Makefile.in b/vvp/Makefile.in
index b8c69fef7..0f2d8f4b5 100644
--- a/vvp/Makefile.in
+++ b/vvp/Makefile.in
@@ -226,12 +226,14 @@ INSTALL_DOCDIR = $(mandir)/man1
 INSTALL_PDFDIR = $(prefix)
 endif
 
+pkgconfigdir = $(libdir)/pkgconfig
+
 stamp-config-h: $(srcdir)/config.h.in ../config.status
 	@rm -f $@
 	cd ..; ./config.status --header=vvp/config.h
 config.h: stamp-config-h
 
-install: all installdirs installfiles
+install: all installdirs installfiles installpkgconfig
 
 F = ./vvp@EXEEXT@ $(srcdir)/libvvp.h $(INSTALL_DOC)
 
@@ -259,6 +261,9 @@ installdirs: $(srcdir)/../mkinstalldirs
 		"$(DESTDIR)$(INSTALL_DOCDIR)" \
 		"$(DESTDIR)$(INSTALL_PDFDIR)"
 
+installpkgconfig:
+	$(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
+	$(INSTALL_DATA) libvvp.pc $(DESTDIR)$(pkgconfigdir)
 
 uninstall: $(UNINSTALL32)
 	rm -f "$(DESTDIR)$(bindir)/vvp$(suffix)@EXEEXT@"
diff --git a/vvp/libvvp.pc.in b/vvp/libvvp.pc.in
new file mode 100644
index 000000000..8db9a7ca9
--- /dev/null
+++ b/vvp/libvvp.pc.in
@@ -0,0 +1,9 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libvvp
+Description: Icarus Verilog VVP runtime library
+Libs: -L${libdir} -lvvp
+Cflags: -I${includedir}/iverilog
-- 
2.51.0

openSUSE Build Service is sponsored by