Subject: bug#18302: MSYS2 build issues

From: Karol Ostrovsky <[email-masked]>
Date: Fri, 22 Aug 2014 16:18:11 +0200

Hello all,

I will try to summarise the situation, and I am attaching my updated
solution proposal for this particular bug:

1. MSYS2 uname must be handled properly, and that is fixed in the new
proposed patch.  I disagree with not renaming opsys from mingw32 to
mingw, since mingw32 string is used in other places in the same file
and it means something else there, which I find possibly confusing.
But this change is not in my new patch.

2. -mtune is back to what it was with a minimal change required for
MSYS2+MinGW-w64 uname handling.

3. Include path for xpm in MSYS2+MinGW-w64 is handled in the same way
as in Cygwin.  Perhaps, the same type of comment as was added for
Cygwin should be added for MSYS2+MinGW-w64.

4. A loop is added in the recipe for emacs.exe to handle
bootstrap-emacs.exe busy problem.

Best regards,

Karol

On 22 August 2014 15:33, Eli Zaretskii <[email-masked]> wrote:
>> Date: Fri, 22 Aug 2014 09:04:35 -0400
>> From: Ken Brown <[email-masked]>
>> CC: [email-masked], [email-masked], [email-masked]
>>
>> On 8/22/2014 2:10 AM, Eli Zaretskii wrote:
>> > Thanks, but why not on the release branch?  A comment cannot possibly
>> > do any harm.
>>
>> Done, as revision 117454.
>
> Thank you.
diff --git a/configure.ac b/configure.ac
index 3e49527..c350673 100644
--- a/configure.ac
+++ b/configure.ac
@@ -650,7 +650,7 @@ case "${canonical}" in
   i[3456]86-*-* )
     case "${canonical}" in
       *-darwin* )               opsys=darwin ;;
-      *-mingw32 )
+      *-mingw* )
 		opsys=mingw32
 		# MinGW overrides and adds some system headers in nt/inc.
 		GCC_TEST_OPTIONS="-I $srcdir/nt/inc"
@@ -665,7 +665,7 @@ case "${canonical}" in
   # MinGW64
   x86_64-*-* )
     case "${canonical}" in
-      *-mingw32 )
+      *-mingw* )
 		opsys=mingw32
 		# MinGW overrides and adds some system headers in nt/inc.
 		GCC_TEST_OPTIONS="-I $srcdir/nt/inc"
@@ -1323,7 +1323,7 @@ test "$opsys" = "aix4.2" && test "x$GCC" != "xyes" && \
   C_SWITCH_SYSTEM="-ma -qmaxmem=4000"
 if test "$opsys" = "mingw32"; then
   case "$canonical" in
-    x86_64-*-mingw32) C_SWITCH_SYSTEM="-mtune=generic" ;;
+    x86_64-*-mingw*) C_SWITCH_SYSTEM="-mtune=generic" ;;
     *) C_SWITCH_SYSTEM="-mtune=pentium4" ;;
   esac
 fi
@@ -3066,11 +3066,13 @@ fi
 ### run time).
 if test "${opsys}" = "mingw32"; then
   if test "${with_xpm}" != "no"; then
+    CPPFLAGS="$CPPFLAGS -I/mingw64/include/noX"
     AC_CHECK_HEADER(X11/xpm.h, HAVE_XPM=yes, HAVE_XPM=no, [
 #define FOR_MSW 1])
   fi
 
   if test "${HAVE_XPM}" = "yes"; then
+    REAL_CPPFLAGS="$REAL_CPPFLAGS -I/mingw64/include/noX"
     AC_DEFINE(HAVE_XPM, 1, [Define to 1 if you have the Xpm library (-lXpm).])
   fi
 fi
diff --git a/src/Makefile.in b/src/Makefile.in
index 0dc4886..3f1192f 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -435,6 +435,8 @@ emacs$(EXEEXT): temacs$(EXEEXT) \
 	else \
 	  LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \
 	  test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \
-	  rm -f bootstrap-emacs$(EXEEXT); \
+	  while test -f bootstrap-emacs$(EXEEXT); do \
+	    rm -f bootstrap-emacs$(EXEEXT); \
+	  done; \
 	  ln emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \
 	fi