File 0705-prepare-nsis-scripts-for-arm64.patch of Package erlang
From 92d8cac337404515a2d61609f785e95553045252 Mon Sep 17 00:00:00 2001
From: Cocoa <i@uwucocoa.moe>
Date: Mon, 20 May 2024 12:16:41 +0100
Subject: [PATCH] prepare nsis scripts for arm64
---
erts/etc/win32/nsis/Makefile | 3 +++
erts/etc/win32/nsis/erlang20.nsi | 12 ++++++++++--
erts/etc/win32/nsis/find_redist.sh | 15 +++++++++++++--
3 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/erts/etc/win32/nsis/Makefile b/erts/etc/win32/nsis/Makefile
index dd4bbd4de6..e007e3deaf 100644
--- a/erts/etc/win32/nsis/Makefile
+++ b/erts/etc/win32/nsis/Makefile
@@ -54,6 +54,9 @@ WTARGET_DIR=$(shell (w32_path.sh -d "$(TARGET_DIR)"))
ifeq ($(CONFIG_SUBTYPE),win64)
WINTYPE=win64
REDIST_TARGET=vcredist_x64.exe
+else ifeq ($(CONFIG_SUBTYPE),arm64)
+ WINTYPE=arm64
+ REDIST_TARGET=vcredist_arm64.exe
else
WINTYPE=win32
REDIST_TARGET=vcredist_x86.exe
diff --git a/erts/etc/win32/nsis/erlang20.nsi b/erts/etc/win32/nsis/erlang20.nsi
index 7d63671f89..2785a103d4 100644
--- a/erts/etc/win32/nsis/erlang20.nsi
+++ b/erts/etc/win32/nsis/erlang20.nsi
@@ -68,7 +68,11 @@ Var STARTMENU_FOLDER
!if ${WINTYPE} == "win64"
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "${OTP_PRODUCT} ${OTP_RELEASE} (x64)"
!else
- !define MUI_STARTMENUPAGE_DEFAULTFOLDER "${OTP_PRODUCT} ${OTP_RELEASE} (i386)"
+ !if ${WINTYPE} == "arm64"
+ !define MUI_STARTMENUPAGE_DEFAULTFOLDER "${OTP_PRODUCT} ${OTP_RELEASE} (arm64)"
+ !else
+ !define MUI_STARTMENUPAGE_DEFAULTFOLDER "${OTP_PRODUCT} ${OTP_RELEASE} (i386)"
+ !endif
!endif
;--------------------------------
@@ -104,7 +108,7 @@ Var STARTMENU_FOLDER
VIProductVersion "${OTP_VERSION_LONG}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "CompanyName" "Ericsson AB"
-VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${OTP_VERSION}"
+VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${OTP_VERSION}"
VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "Erlang/OTP installer"
VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "Copyright Ericsson AB 2010-${YEAR}. All Rights Reserved."
VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Erlang/OTP"
@@ -385,6 +389,10 @@ Function .onInit
StrCmpS ${WINTYPE} "win64" +1 +4
StrCpy $archprefix "amd64"
StrCpy $sysnativedir "$WINDIR\sysnative"
+ Goto +4
+ StrCmpS ${WINTYPE} "arm64" +1 +6
+ StrCpy $archprefix "arm64"
+ StrCpy $sysnativedir "$WINDIR\sysnative"
Goto +3
StrCpy $archprefix "x86"
StrCpy $sysnativedir $SYSDIR
diff --git a/erts/etc/win32/nsis/find_redist.sh b/erts/etc/win32/nsis/find_redist.sh
index f551bc7527..6a43571ff8 100755
--- a/erts/etc/win32/nsis/find_redist.sh
+++ b/erts/etc/win32/nsis/find_redist.sh
@@ -85,13 +85,19 @@ add_path_element()
if [ "$1" = "win64" ]; then
AMD64DIR=true
VCREDIST=vcredist_x64
+ VCREDIST2=vcredist.x64
COMPONENTS="cl amd64 bin vc"
elif [ "$1" = "win32" ]; then
AMD64DIR=false
VCREDIST=vcredist_x86
+ VCREDIST2=vcredist.x86
COMPONENTS="cl bin vc"
+elif [ "$1" = "arm64" ]; then
+ AMD64DIR=false
+ VCREDIST=vcredist_arm64
+ VCREDIST2=vcredist.arm64
else
- echo "TARGET argument should win32 or win64"
+ echo "TARGET argument should win32, win64 or arm64"
exit 2
fi
@@ -101,11 +107,16 @@ if [ x"$VCToolsRedistDir" != x"" ]; then
echo "$File"
exit 0
fi
+ File="$VCToolsRedistDir/$VCREDIST2.exe"
+ if [ -r "$File" ]; then
+ echo "$File"
+ exit 0
+ fi
fi
CLPATH=`lookup_prog_in_path cl`
if [ -z "$CLPATH" ]; then
- echo "Can not locate cl.exe and vcredist_x86/x64.exe - OK if using mingw" >&2
+ echo "Can not locate cl.exe and vcredist_x86/x64/arm64.exe - OK if using mingw" >&2
exit 1
fi
--
2.43.0