[m-rev.] diff: fix the debugger tests with MSYS2/MinGW64

Julien Fischer jfischer at opturion.com
Wed Jul 26 21:11:39 AEST 2023


Fix the debugger tests with MSYS2/MinGW64.

These were failing because debugger expects Windows-style paths in the
test_mdbrc file, but it was being generated with Unix-style paths. A
similar problem was recently fixed for MSVC, this change extends that
fix to also work for MSYS2/MinGW64.

configure.ac:
     Define a new configuration variable, FIX_PATH_FOR_WINDOWS, that expands
     to the command used to do path conversion in Unix-like environments on
     Windows. (The previous fix for MSVC used FIX_PATH_FOR_CC do do this,
     but the MinGW64 port of GCC does use Unix-style paths so that cannot
     be used here.)

scripts/Mmake.vars.in:
     Add a new mmake variable, FIX_PATH_FOR_WINDOWS.

scripts/Mmakefile:
     Use FIX_PATH_FOR_WINDOWS when creating the test_mdbrc file.

Julien.

diff --git a/configure.ac b/configure.ac
index c4590a7..8323940 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1160,6 +1160,7 @@ if test "$ac_microsoft" = "yes" ; then

      USING_MICROSOFT_CL_COMPILER="yes"
      FIX_PATH_FOR_CC="$CYGPATH"
+    FIX_PATH_FOR_WINDOWS="$CYGPATH"

      # MS doesn't use a ranlib.
      RANLIB="echo"
@@ -1216,6 +1217,12 @@ else
      USING_MICROSOFT_CL_COMPILER="no"

      FIX_PATH_FOR_CC=echo
+    FIX_PATH_FOR_WINDOWS=echo
+    case "$host" in
+        *mingw*)
+            FIX_PATH_FOR_WINDOWS="$CYGPATH"
+        ;;
+    esac

      AC_PROG_RANLIB
      RANLIBFLAGS=""
@@ -1258,6 +1265,7 @@ AC_SUBST(LINK_LIB)
  AC_SUBST(LINK_LIB_SUFFIX)
  AC_SUBST(LINK_OPT_SEP)
  AC_SUBST(FIX_PATH_FOR_CC)
+AC_SUBST(FIX_PATH_FOR_WINDOWS)
  AC_SUBST(CYGPATH)

  #-----------------------------------------------------------------------------#
diff --git a/scripts/Mmake.vars.in b/scripts/Mmake.vars.in
index b2536f4..f06d3f5 100644
--- a/scripts/Mmake.vars.in
+++ b/scripts/Mmake.vars.in
@@ -255,6 +255,19 @@ JAR_CREATE_FLAGS = cf

  #-----------------------------------------------------------------------------#
  #
+# Stuff which is specific to Windows.
+#
+
+# On Unix-like environments on Windows (e.g. MSYS2, Cygwin) this is a command
+# that converts Unix-style paths to (mixed) Windows-style paths.
+# This is separate from the other FIX_PATH_FOR_* variables since there are
+# places (e.g. scripts/test_mdbrc with MSYS2/MinGW64 or MSVC) where we *must*
+# do path conversion regardless of what kind of paths the C compiler accepts.
+#
+FIX_PATH_FOR_WINDOWS = @FIX_PATH_FOR_WINDOWS@
+
+#-----------------------------------------------------------------------------#
+#
  # Stuff related to linking (for the C back-end).
  #

diff --git a/scripts/Mmakefile b/scripts/Mmakefile
index 3fd7ecc..049fff4 100644
--- a/scripts/Mmakefile
+++ b/scripts/Mmakefile
@@ -2,6 +2,7 @@
  # vim: ts=8 sw=8 noexpandtab ft=make
  #-----------------------------------------------------------------------------#
  # Copyright (C) 1996-2009, 2011 The University of Melbourne.
+# Copyright (C) 2013, 2015, 2017-2018, 2020, 2022-2023 The Mercury team.
  # This file may only be copied under the terms of the GNU General
  # Public License - see the file COPYING in the Mercury distribution.
  #-----------------------------------------------------------------------------#
@@ -113,7 +114,7 @@ CSHARP_WRAPPER_SCRIPTS = \
  test_mdbrc: mdbrc.in mdbrc
  	@echo making test_mdbrc
  	@ABS_MERCURY_DIR=`(cd $(MERCURY_DIR); /bin/pwd)` ; \
-	ABS_MERCURY_DIR=`$(FIX_PATH_FOR_CC) $${ABS_MERCURY_DIR}` ; \
+	ABS_MERCURY_DIR=`$(FIX_PATH_FOR_WINDOWS) $${ABS_MERCURY_DIR}` ; \
  	sed \
  		-e "s, at DEFAULT_MERCURY_DEBUGGER_DOC@,$${ABS_MERCURY_DIR}/doc/mdb_doc," \
  		-e "s, at DEFAULT_MERCURY_DEBUGGER_INIT_DIR@,$${ABS_MERCURY_DIR}/scripts," \


More information about the reviews mailing list