Add Windows on ARM to build scripts.

This commit is contained in:
John Preston 2024-07-18 10:33:58 +02:00
parent f123a9e16c
commit 2f22a8f46b
7 changed files with 108 additions and 24 deletions

View file

@ -155,6 +155,7 @@ int main(int argc, char *argv[])
QString remove;
int version = 0;
[[maybe_unused]] bool targetwin64 = false;
[[maybe_unused]] bool targetwinarm = false;
[[maybe_unused]] bool targetarmac = false;
QFileInfoList files;
for (int i = 0; i < argc; ++i) {
@ -165,6 +166,7 @@ int main(int argc, char *argv[])
if (remove.isEmpty()) remove = info.canonicalPath() + "/";
} else if (string("-target") == argv[i] && i + 1 < argc) {
targetwin64 = (string("win64") == argv[i + 1]);
targetwinarm = (string("winarm") == argv[i + 1]);
} else if (string("-arch") == argv[i] && i + 1 < argc) {
targetarmac = (string("arm64") == argv[i + 1]);
if (!targetarmac && string("x86_64") != argv[i + 1]) {
@ -493,7 +495,7 @@ int main(int argc, char *argv[])
cout << "Signature verified!\n";
RSA_free(pbKey);
#ifdef Q_OS_WIN
QString outName((targetwin64 ? QString("tx64upd%1") : QString("tupdate%1")).arg(AlphaVersion ? AlphaVersion : version));
QString outName((targetwinarm ? QString("tarm64upd%1") : targetwin64 ? QString("tx64upd%1") : QString("tupdate%1")).arg(AlphaVersion ? AlphaVersion : version));
#elif defined Q_OS_MAC
QString outName((targetarmac ? QString("tarmacupd%1") : QString("tmacupd%1")).arg(AlphaVersion ? AlphaVersion : version));
#else

View file

@ -245,6 +245,7 @@ QString FindUpdateFile() {
"^("
"tupdate|"
"tx64upd|"
"tarm64upd|"
"tmacupd|"
"tarmacupd|"
"tlinuxupd|"

View file

@ -14,42 +14,54 @@ if not exist "%FullScriptPath%..\..\..\DesktopPrivate" (
FOR /F "tokens=1* delims= " %%i in (%FullScriptPath%target) do set "BuildTarget=%%i"
if "%BuildTarget%" equ "uwp" (
set "BuildUWP=1"
) else if "%BuildTarget%" equ "uwp64" (
set "BuildUWP=1"
) else (
set "BuildUWP=0"
)
set "Build64=0"
set "BuildARM=0"
set "BuildUWP=0"
if "%BuildTarget%" equ "win64" (
set "Build64=1"
) else if "%BuildTarget%" equ "winarm" (
set "BuildARM=1"
) else if "%BuildTarget%" equ "uwp" (
set "BuildUWP=1"
) else if "%BuildTarget%" equ "uwp64" (
set "Build64=1"
) else (
set "Build64=0"
set "BuildUWP=1"
) else if "%BuildTarget%" equ "uwparm" (
set "BuildARM=1"
set "BuildUWP=1"
)
if %Build64% neq 0 (
if "%Platform%" neq "x64" (
echo Bad environment. Make sure to run from 'x64 Native Tools Command Prompt for VS 2019'.
echo Bad environment. Make sure to run from 'x64 Native Tools Command Prompt for VS 2022'.
exit /b
) else if "%VSCMD_ARG_HOST_ARCH%" neq "x64" (
echo Bad environment. Make sure to run from 'x64 Native Tools Command Prompt for VS 2019'.
echo Bad environment. Make sure to run from 'x64 Native Tools Command Prompt for VS 2022'.
exit /b
) else if "%VSCMD_ARG_TGT_ARCH%" neq "x64" (
echo Bad environment. Make sure to run from 'x64 Native Tools Command Prompt for VS 2019'.
echo Bad environment. Make sure to run from 'x64 Native Tools Command Prompt for VS 2022'.
exit /b
)
) else if %BuildARM% neq 0 (
if "%Platform%" neq "arm64" (
echo Bad environment. Make sure to run from 'ARM64 Native Tools Command Prompt for VS 2022'.
exit /b
) else if "%VSCMD_ARG_HOST_ARCH%" neq "arm64" (
echo Bad environment. Make sure to run from 'ARM64 Native Tools Command Prompt for VS 2022'.
exit /b
) else if "%VSCMD_ARG_TGT_ARCH%" neq "arm64" (
echo Bad environment. Make sure to run from 'ARM64 Native Tools Command Prompt for VS 2022'.
exit /b
)
) else (
if "%Platform%" neq "x86" (
echo Bad environment. Make sure to run from 'x86 Native Tools Command Prompt for VS 2019'.
echo Bad environment. Make sure to run from 'x86 Native Tools Command Prompt for VS 2022'.
exit /b
) else if "%VSCMD_ARG_HOST_ARCH%" neq "x86" (
echo Bad environment. Make sure to run from 'x86 Native Tools Command Prompt for VS 2019'.
echo Bad environment. Make sure to run from 'x86 Native Tools Command Prompt for VS 2022'.
exit /b
) else if "%VSCMD_ARG_TGT_ARCH%" neq "x86" (
echo Bad environment. Make sure to run from 'x86 Native Tools Command Prompt for VS 2019'.
echo Bad environment. Make sure to run from 'x86 Native Tools Command Prompt for VS 2022'.
exit /b
)
)
@ -76,12 +88,16 @@ echo.
if %BuildUWP% neq 0 (
if %Build64% neq 0 (
echo Building version %AppVersionStrFull% for UWP 64 bit..
) else if %BuildARM% neq 0 (
echo Building version %AppVersionStrFull% for UWP ARM..
) else (
echo Building version %AppVersionStrFull% for UWP..
)
) else (
if %Build64% neq 0 (
echo Building version %AppVersionStrFull% for Windows 64 bit..
) else if %BuildARM% neq 0 (
echo Building version %AppVersionStrFull% for Windows on ARM..
) else (
echo Building version %AppVersionStrFull% for Windows..
)
@ -96,6 +112,11 @@ if %Build64% neq 0 (
set "SetupFile=tsetup-x64.%AppVersionStrFull%.exe"
set "PortableFile=tportable-x64.%AppVersionStrFull%.zip"
set "DumpSymsPath=%SolutionPath%\..\..\Libraries\win64\breakpad\src\tools\windows\dump_syms\Release\dump_syms.exe"
) else if %BuildARM% neq 0 (
set "UpdateFile=tarm64upd%AppVersion%"
set "SetupFile=tsetup-arm64.%AppVersionStrFull%.exe"
set "PortableFile=tportable-arm64.%AppVersionStrFull%.zip"
set "DumpSymsPath=%SolutionPath%\..\..\Libraries\breakpad\src\tools\windows\dump_syms\Release\dump_syms.exe"
) else (
set "UpdateFile=tupdate%AppVersion%"
set "SetupFile=tsetup.%AppVersionStrFull%.exe"
@ -210,7 +231,11 @@ if %BuildUWP% equ 0 (
if not exist "%SetupFile%" goto error
)
call Packer.exe -version %VersionForPacker% -path %BinaryName%.exe -path Updater.exe -path "modules\%Platform%\d3d\d3dcompiler_47.dll" -target %BuildTarget% %AlphaBetaParam%
if %BuildARM% neq 0 (
call Packer.exe -version %VersionForPacker% -path %BinaryName%.exe -path Updater.exe -target %BuildTarget% %AlphaBetaParam%
) else (
call Packer.exe -version %VersionForPacker% -path %BinaryName%.exe -path Updater.exe -path "modules\%Platform%\d3d\d3dcompiler_47.dll" -target %BuildTarget% %AlphaBetaParam%
)
if %errorlevel% neq 0 goto error
if %AlphaVersion% neq 0 (
@ -309,10 +334,12 @@ if %BuildUWP% neq 0 (
if %errorlevel% neq 0 goto error
)
if %Build64% equ 0 (
set "FinalDeployPath=%FinalReleasePath%\%AppVersionStrMajor%\%AppVersionStrFull%\tsetup"
) else (
if %Build64% neq 0 (
set "FinalDeployPath=%FinalReleasePath%\%AppVersionStrMajor%\%AppVersionStrFull%\tx64"
) else if %BuildARM% neq 0 (
set "FinalDeployPath=%FinalReleasePath%\%AppVersionStrMajor%\%AppVersionStrFull%\tarm64"
) else (
set "FinalDeployPath=%FinalReleasePath%\%AppVersionStrMajor%\%AppVersionStrFull%\tsetup"
)
if %BuildUWP% equ 0 (

View file

@ -49,6 +49,7 @@ HomePath="$FullScriptPath/.."
DeployMac="0"
DeployWin="0"
DeployWin64="0"
DeployWinArm="0"
DeployLinux="0"
if [ "$DeployTarget" == "mac" ]; then
DeployMac="1"
@ -59,6 +60,9 @@ elif [ "$DeployTarget" == "win" ]; then
elif [ "$DeployTarget" == "win64" ]; then
DeployWin64="1"
echo "Deploying version $AppVersionStrFull for Windows 64 bit.."
elif [ "$DeployTarget" == "winarm" ]; then
DeployWinArm="1"
echo "Deploying version $AppVersionStrFull for Windows on ARM.."
elif [ "$DeployTarget" == "linux" ]; then
DeployLinux="1"
echo "Deploying version $AppVersionStrFull for Linux 64 bit.."
@ -66,8 +70,9 @@ else
DeployMac="1"
DeployWin="1"
DeployWin64="1"
DeployWinArm="1"
DeployLinux="1"
echo "Deploying four versions of $AppVersionStrFull: for Windows 32 bit, Windows 64 bit, macOS and Linux 64 bit.."
echo "Deploying five versions of $AppVersionStrFull: for Windows 32 bit, Windows 64 bit, Windows on ARM, macOS and Linux 64 bit.."
fi
if [ "$BuildTarget" == "mac" ]; then
BackupPath="$HOME/Projects/backup/tdesktop"
@ -94,6 +99,11 @@ Win64UpdateFile="tx64upd$AppVersion"
Win64SetupFile="tsetup-x64.$AppVersionStrFull.exe"
Win64PortableFile="tportable-x64.$AppVersionStrFull.zip"
Win64RemoteFolder="tx64"
WinArmDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tarm64"
WinArmUpdateFile="tarm64upd$AppVersion"
WinArmSetupFile="tsetup-arm64.$AppVersionStrFull.exe"
WinArmPortablefile="tportable-arm64.$AppVersionStrFull.zip"
WinArmRemoteFolder="tarm64"
LinuxDeployPath="$BackupPath/$AppVersionStrMajor/$AppVersionStrFull/tlinux"
LinuxUpdateFile="tlinuxupd$AppVersion"
LinuxSetupFile="tsetup.$AppVersionStrFull.tar.xz"
@ -105,6 +115,8 @@ if [ "$AlphaVersion" != "0" ]; then
AlphaFilePath="$WinDeployPath/$AlphaKeyFile"
elif [ "$DeployTarget" == "win64" ]; then
AlphaFilePath="$Win64DeployPath/$AlphaKeyFile"
elif [ "$DeployTarget" == "winarm" ]; then
AlphaFilePath="$WinArmDeployPath/$AlphaKeyFile"
elif [ "$DeployTarget" == "linux" ]; then
AlphaFilePath="$LinuxDeployPath/$AlphaKeyFile"
else
@ -125,6 +137,8 @@ if [ "$AlphaVersion" != "0" ]; then
WinPortableFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
Win64UpdateFile="${Win64UpdateFile}_${AlphaSignature}"
Win64PortableFile="talpha${AlphaVersion}_${AlphaSignature}.zip"
WinArmUpdateFile="${WinArmUpdateFile}_${AlphaSignature}"
WinArmPortablefile="talpha${AlphaVersion}_${AlphaSignature}.zip"
LinuxUpdateFile="${LinuxUpdateFile}_${AlphaSignature}"
LinuxSetupFile="talpha${AlphaVersion}_${AlphaSignature}.tar.xz"
fi
@ -166,6 +180,19 @@ if [ "$DeployWin64" == "1" ]; then
Error "$Win64PortableFile not found!"
fi
fi
if [ "$DeployWinArm" == "1" ]; then
if [ ! -f "$WinArmDeployPath/$WinArmUpdateFile" ]; then
Error "$WinArmUpdateFile not found!"
fi
if [ "$AlphaVersion" == "0" ]; then
if [ ! -f "$WinArmDeployPath/$WinArmSetupFile" ]; then
Error "$WinArmSetupFile not found!"
fi
fi
if [ ! -f "$WinArmDeployPath/$WinArmPortableFile" ]; then
Error "$WinArmPortableFile not found!"
fi
fi
if [ "$DeployLinux" == "1" ]; then
if [ ! -f "$LinuxDeployPath/$LinuxUpdateFile" ]; then
Error "$LinuxDeployPath/$LinuxUpdateFile not found!"
@ -193,6 +220,12 @@ if [ "$DeployWin64" == "1" ]; then
Files+=("tx64/$Win64SetupFile")
fi
fi
if [ "$DeployWinArm" == "1" ]; then
Files+=("tarm64/$WinArmUpdateFile" "tarm64/$WinArmPortableFile")
if [ "$AlphaVersion" == "0" ]; then
Files+=("tarm64/$WinArmSetupFile")
fi
fi
if [ "$DeployLinux" == "1" ]; then
Files+=("tlinux/$LinuxUpdateFile" "tlinux/$LinuxSetupFile")
fi

View file

@ -220,6 +220,20 @@ files.append({
'mime': 'application/zip',
'label': 'Windows 64 bit: Portable',
})
files.append({
'local': 'tsetup-arm64.' + version_full + '.exe',
'remote': 'tsetup-arm64.' + version_full + '.exe',
'backup_folder': 'tarm64',
'mime': 'application/octet-stream',
'label': 'Windows on ARM: Installer',
})
files.append({
'local': 'tportable-arm64.' + version_full + '.zip',
'remote': 'tportable-arm64.' + version_full + '.zip',
'backup_folder': 'tarm64',
'mime': 'application/zip',
'label': 'Windows on ARM: Portable',
})
files.append({
'local': 'tsetup.' + version_full + '.dmg',
'remote': 'tsetup.' + version_full + '.dmg',

View file

@ -36,7 +36,12 @@ DisableProgramGroupPage=no
WizardStyle=modern
SignTool=sha256
#if MyBuildTarget == "win64"
#if MyBuildTarget == "winarm"
ArchitecturesAllowed="arm64"
OutputBaseFilename=tsetup-arm64.{#MyAppVersionFull}
#define ArchModulesFolder "arm64"
AppVerName={#MyAppName} {#MyAppVersion} arm64
#elif MyBuildTarget == "win64"
ArchitecturesAllowed="x64 arm64"
ArchitecturesInstallIn64BitMode="x64 arm64"
OutputBaseFilename=tsetup-x64.{#MyAppVersionFull}
@ -68,7 +73,9 @@ Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescrip
[Files]
Source: "{#ReleasePath}\Telegram.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#ReleasePath}\Updater.exe"; DestDir: "{app}"; Flags: ignoreversion
#if MyBuildTarget != "winarm"
Source: "{#ReleasePath}\{#ModulesFolder}\d3d\d3dcompiler_47.dll"; DestDir: "{app}\{#ModulesFolder}\d3d"; Flags: ignoreversion
#endif
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]

@ -1 +1 @@
Subproject commit 54639131bf1e5dce87c10dba45062cfec804e343
Subproject commit 4ac8cf9d65e47efa9d2022939c6d0c38f32d9c7a