We rely on pexports to extract exported symbols from DLL files (e.g. for
linking in PLs) when building with mingw. However, this program isn't
present in msys2. Instead the approved way is apparently to call
"gendef" from the appropriate toolset (e.g. /mingw64/bin). I have worked
around this on my new test machine but adding a script liker this in
/usr/bin/pexports:


    #!/bin/sh
    gendef - "$@"


However, requiring that is a bit ugly. Instead I think we should do
something like the attached.


I would not be surprised if we need to test the msys version elsewhere
as time goes on, so this would stand us in good stead if we do.


cheers


andrew


-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

diff --git a/configure b/configure
index b3c92764be..57d634d501 100755
--- a/configure
+++ b/configure
@@ -649,6 +649,7 @@ MSGFMT
 PG_CRC32C_OBJS
 CFLAGS_ARMV8_CRC32C
 CFLAGS_SSE42
+msys_version
 have_win32_dbghelp
 LIBOBJS
 UUID_LIBS
@@ -16082,7 +16083,9 @@ esac
 fi
 
 # Win32 (really MinGW) support
+msys_version=0
 if test "$PORTNAME" = "win32"; then
+  msys_version=`uname -r | sed 's/..*//'`
   for ac_func in _configthreadlocale
 do :
   ac_fn_c_check_func "$LINENO" "_configthreadlocale" "ac_cv_func__configthreadlocale"
@@ -16185,6 +16188,7 @@ else
 
 fi
 
+
 # Cygwin needs only a bit of that
 if test "$PORTNAME" = "cygwin"; then
   case " $LIBOBJS " in
diff --git a/configure.in b/configure.in
index 0d16c1a971..692ea2fabf 100644
--- a/configure.in
+++ b/configure.in
@@ -1768,7 +1768,9 @@ if test "$PORTNAME" = "win32"; then
 fi
 
 # Win32 (really MinGW) support
+msys_version=0
 if test "$PORTNAME" = "win32"; then
+  msys_version=`uname -r | sed 's/[.].*//'`
   AC_CHECK_FUNCS(_configthreadlocale)
   AC_REPLACE_FUNCS(gettimeofday)
   AC_LIBOBJ(dirmod)
@@ -1792,6 +1794,7 @@ if test x"$pgac_minidump_type" = x"yes" ; then
 else
   AC_SUBST(have_win32_dbghelp,no)
 fi
+AC_SUBST(msys_version)
 
 # Cygwin needs only a bit of that
 if test "$PORTNAME" = "cygwin"; then
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index 2d21068183..2c68ffe1da 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -350,6 +350,12 @@ XGETTEXT = @XGETTEXT@
 GZIP	= gzip
 BZIP2	= bzip2
 
+msys_version = @msys_version@ # 0 = not msys
+ifeq ($(msys_version),1)
+	PEXPORTS = pexports
+else
+	PEXPORTS = "gendef -"
+endif
 
 # Tree-wide build support
 
diff --git a/src/pl/plperl/GNUmakefile b/src/pl/plperl/GNUmakefile
index 9b1c514101..04ba95b5ea 100644
--- a/src/pl/plperl/GNUmakefile
+++ b/src/pl/plperl/GNUmakefile
@@ -48,7 +48,7 @@ lib$(perlwithver).a: $(perlwithver).def
 	dlltool --dllname $(perlwithver).dll --def $(perlwithver).def --output-lib lib$(perlwithver).a
 
 $(perlwithver).def: $(PERLDLL)
-	pexports $^ > $@
+	$(PEXPORTS) $^ > $@
 
 endif # win32
 
diff --git a/src/pl/plpython/Makefile b/src/pl/plpython/Makefile
index 667a74469e..e919d17fc8 100644
--- a/src/pl/plpython/Makefile
+++ b/src/pl/plpython/Makefile
@@ -69,7 +69,7 @@ libpython${pytverstr}.a: python${pytverstr}.def
 	dlltool --dllname python${pytverstr}.dll --def python${pytverstr}.def --output-lib libpython${pytverstr}.a
 
 python${pytverstr}.def:
-	pexports $(PYTHONDLL) > $@
+	$(PEXPORTS) $(PYTHONDLL) > $@
 
 endif # win32
 
diff --git a/src/pl/tcl/Makefile b/src/pl/tcl/Makefile
index 8ee4c3ff15..52dd938182 100644
--- a/src/pl/tcl/Makefile
+++ b/src/pl/tcl/Makefile
@@ -44,7 +44,7 @@ lib$(tclwithver).a: $(tclwithver).def
 	dlltool --dllname $(tclwithver).dll --def $(tclwithver).def --output-lib lib$(tclwithver).a
 
 $(tclwithver).def: $(TCLDLL)
-	pexports $^ > $@
+	$(PEXPORTS) $^ > $@
 
 endif # win32
 

Reply via email to