--- postgresql-10.0/src/pl/tcl/Makefile.orig 2017-10-02 16:09:15.000000000 -0500
+++ postgresql-10.0/src/pl/tcl/Makefile 2017-11-04 13:50:43.945313037 -0500
@@ -16,6 +16,10 @@
# On Windows, we don't link directly with the Tcl library; see below
ifneq ($(PORTNAME), win32)
SHLIB_LINK = $(TCL_LIB_SPEC) $(TCL_LIBS) -lc
+else
+ifeq ($(host_os), mingw32)
+SHLIB_LINK = $(TCL_LIB_SPEC) $(TCL_LIBS)
+endif
endif
PGFILEDESC = "PL/Tcl - procedural language"
@@ -34,6 +38,7 @@
# which are not compatible with mingw gcc. Therefore we need to build a
# new import library to link with.
ifeq ($(PORTNAME), win32)
+ifneq ($(host_os), mingw32)
tclwithver = $(subst -l,,$(filter -l%, $(TCL_LIB_SPEC)))
TCLDLL = $(dir $(TCLSH))/$(tclwithver).dll
@@ -46,6 +51,7 @@
$(tclwithver).def: $(TCLDLL)
pexports $^ > $@
+endif # mingw32
endif # win32
@@ -94,8 +100,10 @@
rm -f $(OBJS)
rm -rf $(pg_regress_clean_files)
ifeq ($(PORTNAME), win32)
+ifneq ($(host_os), mingw32)
rm -f $(tclwithver).def
endif
+endif
maintainer-clean: distclean
rm -f pltclerrcodes.h