From 12315d87b5f80a7528bd95f37286f5a657734a1d Mon Sep 17 00:00:00 2001
From: "jan.nijtmans" <nijtmans@users.sourceforge.net>
Date: Sun, 13 Feb 2022 22:29:11 +0000
Subject: Make a start supporting aarch64-w64-mingw32-clang (WIP)

---
 compat/zlib/win64-arm/libz.dll.a    | Bin 0 -> 13002 bytes
 compat/zlib/win64-arm/zlib1.dll     | Bin 84480 -> 92672 bytes
 win/README                          |  16 +++++-----------
 win/rules.vc                        |   9 ++++-----
 win/x86_64-w64-mingw32-nmakehlp.exe | Bin 0 -> 25600 bytes
 5 files changed, 9 insertions(+), 16 deletions(-)
 create mode 100644 compat/zlib/win64-arm/libz.dll.a
 create mode 100755 win/x86_64-w64-mingw32-nmakehlp.exe

diff --git a/compat/zlib/win64-arm/libz.dll.a b/compat/zlib/win64-arm/libz.dll.a
new file mode 100644
index 0000000..b6cbde7
Binary files /dev/null and b/compat/zlib/win64-arm/libz.dll.a differ
diff --git a/compat/zlib/win64-arm/zlib1.dll b/compat/zlib/win64-arm/zlib1.dll
index 2abef88..7d08dd3 100755
Binary files a/compat/zlib/win64-arm/zlib1.dll and b/compat/zlib/win64-arm/zlib1.dll differ
diff --git a/win/README b/win/README
index f4cdde4..038a7cb 100644
--- a/win/README
+++ b/win/README
@@ -21,26 +21,27 @@ In order to compile Tcl for Windows, you need the following:
 	and
 
 	Visual C++ 6 or newer
+	    (win32 or win64, for IX86/AMD64/ARM64)
 
 	or
 
 	Linux + MinGW-w64 [https://www.mingw-w64.org/]
-	    (win32 or win64)
+	    (win32 or win64, for IX86/AMD64)
 
 	or
 
 	Cygwin + MinGW-w64 [https://cygwin.com/install.html]
-	    (win32 or win64)
+	    (win32 or win64, for IX86/AMD64)
 
 	or
 
 	Darwin + MinGW-w64 [https://www.mingw-w64.org/]
-	    (win32 or win64)
+	    (win32 or win64, for IX86/AMD64)
 
 	or
 
 	Msys + MinGW-w64 [https://www.mingw-w64.org/]
-	    (win32 or win64)
+	    (win32 or win64, for IX86/AMD64)
 
 
 In practice, this release is built with Visual C++ 6.0 and the TEA
@@ -56,13 +57,6 @@ using it, are in the comments of "makefile.vc".  A quick example would be:
 There is also a Developer Studio workspace and project file, too, if you
 would like to use them.
 
-If you want to Cross-compile with Visual Studio (e.g. for X86 or ARM64
-targets, but running on AMD64), first set up the environment for
-your host machine and compile nmakehlp.exe:
-	C:\tcl_source\win\>nmake -f makefile.vc nmakehlp
-Then go to your cross-compile environment and run the nmake
-command again for whatever you want to build.
-
 If you are building with Linux, Cygwin or Msys, you can use the configure
 script that lives in the win subdirectory. The Linux/Cygwin/Msys based
 configure/build process works just like the UNIX one, so you will want
diff --git a/win/rules.vc b/win/rules.vc
index b68b6b4..22aa735 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -77,7 +77,7 @@ NEED_TK_SOURCE = 0
 # 2. Figure out our build structure in terms of the directory, whether
 #    we are building Tcl or an extension, etc.
 # 3. Determine the compiler and linker versions
-# 4. Build the nmakehlp helper application
+# 4. Build the nmakehlp helper application (if not cross-compiling)
 # 5. Determine the supported compiler options and features
 # 6. Parse the OPTS macro value for user-specified build configuration
 # 7. Parse the STATS macro value for statistics instrumentation
@@ -548,13 +548,12 @@ NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c
 
 !endif # NMAKEHLPC
 
-nmakehlp:
-	$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console
-
 # We always build nmakehlp even if it exists since we do not know
 # what source it was built from.
 !if "$(MACHINE)" == "$(NATIVE_ARCH)"
-!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul]
+!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console >NUL]
+#else
+!if [COPY "$(NMAKEHLPC)$(NMAKEHLPC:nmakehlp.c=x86_64-w64-mingw32-nmakehlp.exe)" nmakehlp.exe]
 !endif
 !endif
 
diff --git a/win/x86_64-w64-mingw32-nmakehlp.exe b/win/x86_64-w64-mingw32-nmakehlp.exe
new file mode 100755
index 0000000..2564ec9
Binary files /dev/null and b/win/x86_64-w64-mingw32-nmakehlp.exe differ
-- 
cgit v0.12