File 0001-xspice-fix-building-with-MinGW.patch of Package mingw64-ngspice

From f416c42dcbd85d45f6049e356307a05c820fa52e Mon Sep 17 00:00:00 2001
From: Ralf Habacker <ralf.habacker@freenet.de>
Date: Tue, 6 Jan 2026 01:00:53 +0100
Subject: [PATCH 1/2] xspice: fix building with MinGW

---
 src/xspice/cmpp/Makefile.am   | 25 ++++++++++++-------------
 src/xspice/icm/GNUmakefile.in | 13 ++++---------
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/src/xspice/cmpp/Makefile.am b/src/xspice/cmpp/Makefile.am
index a3f394181..80a1fef68 100644
--- a/src/xspice/cmpp/Makefile.am
+++ b/src/xspice/cmpp/Makefile.am
@@ -16,18 +16,6 @@ cmpp_SOURCES = main.c cmpp.h file_buffer.c file_buffer.h\
 	ifs_lex.l ifs_yacc.y ifs_yacc_y.h \
 	mod_lex.l mod_yacc.y mod_yacc_y.h
 
-if WINGUI
-cmpp_LDADD = -lshlwapi
-endif
-
-if WINCONSOLE
-cmpp_LDADD = -lshlwapi
-endif
-
-if SHWIN
-cmpp_LDADD = -lshlwapi
-endif
-
 mod_lex.c : mod_lex.l
 	$(am__skiplex) $(LEXCOMPILE) -o $@ $<
 
@@ -42,6 +30,17 @@ ifs_yacc.c : ifs_yacc.y
 
 
 if CROSS_COMPILING
+if WINGUI
+cmpp_LDADD = -lshlwapi
+endif
+
+if WINCONSOLE
+cmpp_LDADD = -lshlwapi
+endif
+
+if SHWIN
+cmpp_LDADD = -lshlwapi
+endif
 
 BUILT_SOURCES += build/cmpp$(BUILD_EXEEXT)
 CLEANFILES = build/cmpp$(BUILD_EXEEXT)
@@ -53,7 +52,7 @@ BUILD_CMPP_FILES = main.c file_buffer.c \
 
 build/cmpp$(BUILD_EXEEXT) : $(BUILD_CMPP_FILES)
 	$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) \
-		$(AM_CPPFLAGS) $(LDFLAGS_FOR_BUILD) -o $@ $^ $(cmpp_LDADD)
+		$(AM_CPPFLAGS) $(LDFLAGS_FOR_BUILD) -o $@ $^
 
 distclean-local:
 	-rm -rf build
diff --git a/src/xspice/icm/GNUmakefile.in b/src/xspice/icm/GNUmakefile.in
index d26ed30b8..0612d00b2 100644
--- a/src/xspice/icm/GNUmakefile.in
+++ b/src/xspice/icm/GNUmakefile.in
@@ -59,13 +59,8 @@ tline_common.o: $(srcdir)/../tlines/tline_common.c $(srcdir)/../tlines/tline_com
 
 ifdef cm
 
-ifeq ($(OS),Windows_NT)
-    cmpp = ../cmpp/cmpp.exe
-else
-    cmpp = ../cmpp/cmpp
-endif
-modlst := $(shell $(cmpp) -p $(srcdir)/$(cm)/modpath.lst)
-udnlst := $(shell $(cmpp) -p $(srcdir)/$(cm)/udnpath.lst)
+modlst := $(shell $(CMPP) -p $(srcdir)/$(cm)/modpath.lst)
+udnlst := $(shell $(CMPP) -p $(srcdir)/$(cm)/udnpath.lst)
 
 cm-dirs := $(cm) $(udnlst:%=$(cm)/%) $(modlst:%=$(cm)/%)
 cm-dep-dirs := $(cm-dirs:%=%/.deps)
@@ -145,10 +140,10 @@ $(cm-dirs) $(cm-dep-dirs) :
 %/cmextrn.h %/cminfo.h %/udnextrn.h %/udninfo.h %/objects.inc : $(srcdir)/%/modpath.lst $(srcdir)/%/udnpath.lst
 	CMPP_IDIR=$(srcdir)/$(@D) CMPP_ODIR=$(@D) $(CMPP) -lst
 
-%/ifspec.c : $(srcdir)/%/ifspec.ifs $(cmpp)
+%/ifspec.c : $(srcdir)/%/ifspec.ifs $(CMPP)
 	CMPP_IDIR=$(srcdir)/$(@D) CMPP_ODIR=$(@D) $(CMPP) -ifs
 
-%/cfunc.c : $(srcdir)/%/cfunc.mod $(cmpp)
+%/cfunc.c : $(srcdir)/%/cfunc.mod $(CMPP)
 	CMPP_IDIR=$(srcdir)/$(@D) CMPP_ODIR=$(@D) $(CMPP) -mod
 
 
-- 
2.51.0

openSUSE Build Service is sponsored by