patch 9.1.1386: MS-Windows: some minor problems building on AARCH64

Problem:  MS-Windows: some minor problems building on AARCH64
Solution: Update Make_cyg_ming with aarch64 specific changes,
          document how to build on aarch64 using msys2 packages

closes: #17048

Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/INSTALLpc.txt b/src/INSTALLpc.txt
index c109929..24bbe04 100644
--- a/src/INSTALLpc.txt
+++ b/src/INSTALLpc.txt
@@ -1,4 +1,4 @@
-INSTALLpc.txt - Installation of Vim on PC - Last Update: 2024 Dec 27
+INSTALLpc.txt - Installation of Vim on PC - Last Update: 2025 May 14
 
 This file contains instructions for compiling Vim. If you already have an
 executable version of Vim, you don't need this.
@@ -183,7 +183,9 @@
 2. MSYS2 with MinGW
 ===================
 
-2.1. Setup the basic msys2 environment
+2.1 Buidling x86 32bit or 64bit versions.
+
+2.1.1. Setup the basic msys2 environment
 
 Go to the official page of MSYS2: https://www.msys2.org
 Download an installer:
@@ -208,7 +210,7 @@
 package, select `y` to remove them.
 
 
-2.2. Install additional packages for building Vim
+2.1.2. Install additional packages for building Vim
 
 The following package groups are required for building Vim:
 
@@ -230,7 +232,7 @@
 
 The suffix ":" means that it disables the package name translation.
 The suffix ":m" means both i686 and x86_64.  You can also use the ":i" suffix
-to install only i686, and the ":x" suffix to install only x86_64.
+to install only i686, the ":x" suffix for x86_64 and ":a" for "aarch64".
 (See `pacboy help` for the help.)
 
 See also the pacman page in ArchWiki for the general usage of pacman:
@@ -241,7 +243,7 @@
     $ pacman -S git
 
 
-2.3. Keep the build environment up-to-date
+2.1.3. Keep the build environment up-to-date
 
 After you have installed the build environment, you may want to keep it
 up-to-date (E.g. always use the latest GCC).
@@ -249,7 +251,7 @@
     $ pacman -Syu
 
 
-2.4. Build Vim
+2.1.4. Build Vim
 
 Select one of the following icon from the Start Menu:
 
@@ -276,7 +278,7 @@
 If you have msys64 in another location you will need to adjust the paths for
 that.
 
-2.5. Build Vim with Clang
+2.1.5. Build Vim with Clang
 
 The following package group is required for building Vim with Clang:
 
@@ -301,6 +303,71 @@
     CXX=clang++
     make -f Make_ming.mak DEBUG=yes ASAN=yes
 
+2.2 Buidling an Arch64 version of Vim
+
+2.2.1. Setup the basic msys2 environment
+
+See also https://www.msys2.org/wiki/arm64/
+Go to the official page of MSYS2: https://www.msys2.org
+
+Download the self-extracting archive:
+
+* msys2-base-x86_64-latest.sfx.exe
+
+Execute the self-extracting archive into a folder of your choice.
+In the extracted folder, run clangarm64.exe
+This will open a MSYS2 terminal window for you.
+
+Execute:
+    $ pacman -Syu
+
+And restart MSYS2 console. Then execute:
+    $ pacman -Su
+
+
+2.2.2. Install additional packages for building Vim
+
+    $ pacman -S mingw-w64-clang-aarch64-clang mingw-w64-clang-aarch64-toolchain base-devel git
+
+Or you can use the `pacboy` command to avoid long package names:
+
+    $ pacboy -S base-devel: toolchain:a
+
+The suffix ":" means that it disables the package name translation.
+The suffix ":m" means both i686 and x86_64.  You can also use the ":i" suffix
+to install only i686, the ":x" suffix for x86_64 and ":a" for "aarch64".
+(See `pacboy help` for the help.)
+
+See also the pacman page in ArchWiki for the general usage of pacman:
+    https://wiki.archlinux.org/index.php/pacman
+
+2.2.3. Keep the build environment up-to-date
+
+After you have installed the build environment, you may want to keep it
+up-to-date (E.g. always use the latest GCC).
+In that case, you just need to execute the command:
+    $ pacman -Syu
+
+
+2.2.4. Build Vim
+
+Before building look through notes for MinGW in part 3 below.
+
+Go to the source directory of Vim, then execute the make command.  E.g.:
+
+    CC=clang
+    CXX=clang++
+    make -f Make_ming.mak
+    make -f Make_ming.mak GUI=yes
+    make -f Make_ming.mak GUI=no DEBUG=yes
+
+NOTE: you can't execute vim.exe in the MSYS2 console, open a normal Windows
+console for that.
+
+To build Vim with the address sanitizer (ASAN), execute the following command:
+
+    make -f Make_ming.mak DEBUG=yes ASAN=yes
+
 3. MinGW
 ========
 
diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak
index c8d2707..ab9c3b1 100644
--- a/src/Make_cyg_ming.mak
+++ b/src/Make_cyg_ming.mak
@@ -25,7 +25,7 @@
 #     http://www.matcode.com/mpress.htm
 #
 # Maintained by Ron Aaron <ronaharon@yahoo.com> et al.
-# Updated 2014 Oct 13.
+# Last Update: 2025 May 14.
 
 #>>>>> choose options:
 # FEATURES=[TINY | NORMAL | HUGE]
@@ -58,6 +58,7 @@
 
 # Set to no if you do not want to use DirectWrite (DirectX).
 # MinGW-w64 is needed, and ARCH should be set to i686 or x86-64.
+# Note: Does not work with AARCH64
 DIRECTX=yes
 
 # Disable Color emoji support
@@ -66,6 +67,7 @@
 
 # Set to one of i386, i486, i586, i686 as the minimum target processor.
 # For amd64/x64 architecture set ARCH=x86-64 .
+# For AARCH64, set to native
 # If not set, it will be automatically detected. (Normally i686 or x86-64.)
 #ARCH=i686
 # Set to yes to cross-compile from unix; no=native Windows (and Cygwin).
@@ -221,9 +223,14 @@
 DIRSLASH = \\
  endif
 endif
+
+# for AARCH64, set to clang
+# CC := clang
 # set $CC to "gcc" unless it matches "clang"
 ifeq ($(findstring clang,$(CC)),)
 CC := $(CROSS_COMPILE)gcc
+else ifeq ($(findstring clang,$(CXX)),)
+CXX := clang++
 endif
 # set $CXX to "g++" unless it matches "clang"
 ifeq ($(findstring clang,$(CXX)),)
@@ -238,8 +245,15 @@
 endif
 
 # Get the default ARCH.
+# clang on AARCH64 does not like the native arch64-w64-windows-gnu
+# so set to native instead
 ifndef ARCH
+ARCH := $(shell $(CC) -dumpmachine)
+ ifeq ($(ARCH), aarch64-w64-windows-gnu)
+ARCH := native
+ else
 ARCH := $(shell $(CC) -dumpmachine | sed -e "s/-.*//" -e "s/_/-/" -e "s/^mingw32$$/i686/")
+ endif
 endif
 
 
@@ -718,6 +732,9 @@
   ifeq ($(ARCH),x86-64)
 XPM = xpm/x64
   endif
+  ifeq ($(ARCH),native)
+XPM = no
+  endif
  endif
  ifdef XPM
   ifneq ($(XPM),no)
@@ -1186,7 +1203,7 @@
 	$(MAKE) -C tee -f Make_ming.mak CC='$(CC)'
 
 GvimExt/gvimext.dll: GvimExt/gvimext.cpp GvimExt/gvimext.rc GvimExt/gvimext.h
-	$(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX='$(CXX)' STATIC_STDCPLUS=$(STATIC_STDCPLUS)
+	$(MAKE) -C GvimExt -f Make_ming.mak CROSS=$(CROSS) CROSS_COMPILE=$(CROSS_COMPILE) CXX=$(CXX) STATIC_STDCPLUS=$(STATIC_STDCPLUS)
 
 tags: notags
 	$(CTAGS) $(TAGS_FILES)
diff --git a/src/version.c b/src/version.c
index a2cfb00..78a6e7b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1386,
+/**/
     1385,
 /**/
     1384,