From bc6ea5a8b0ad0e75bc2d8e551eeaf38613f7df99 Mon Sep 17 00:00:00 2001 From: Bruce Date: Sun, 12 Apr 2026 23:00:10 +0800 Subject: [PATCH] Update build files for ARM. --- .gitignore | 7 ++++++- ArmBuild.ps1 | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b5c8693..3a460c0 100644 --- a/.gitignore +++ b/.gitignore @@ -249,4 +249,9 @@ ModelManifest.xml # Arm Build Files package.zip -ArmPackage.zip \ No newline at end of file +ArmPackage.zip +ArmBuild.ps1 +arm_build.bat +ARM_PIE.pfx + +UpgradeLog.htm \ No newline at end of file diff --git a/ArmBuild.ps1 b/ArmBuild.ps1 index 9c162d6..f86cad7 100644 --- a/ArmBuild.ps1 +++ b/ArmBuild.ps1 @@ -18,6 +18,39 @@ function Copy-Binaries-ToDest($src, $dest) } } +function Sign-Files($directory) +{ + $signtool = "C:\Program Files (x86)\Windows Kits\8.1\bin\x64\signtool.exe" + $pfx = Join-Path $root "Arm_PIE.pfx" + $pfxPassword = "" # 如果有密码请填写,例如 "123456" + $timestampUrl = "http://timestamp.digicert.com" + + if (-not (Test-Path $signtool)) { + Write-Warning "signtool not found at $signtool, skipping signing" + return + } + if (-not (Test-Path $pfx)) { + Write-Warning "PFX file not found at $pfx, skipping signing" + return + } + + $files = Get-ChildItem -Path $directory -Recurse -Include *.exe, *.dll + foreach ($file in $files) { + Write-Host "Signing $($file.FullName)..." + $filePath = $file.FullName + if ($pfxPassword) { + & $signtool sign /f $pfx /p $pfxPassword /fd SHA256 /tr $timestampUrl /td SHA256 /a "`"$filePath`"" + } else { + & $signtool sign /f $pfx /fd SHA256 /tr $timestampUrl /td SHA256 /a "`"$filePath`"" + } + if ($LASTEXITCODE -ne 0) { + Write-Error "Failed to sign $filePath (exit code: $LASTEXITCODE)" + # 如需停止脚本,取消下面一行的注释 + # throw "Signing failed" + } + } +} + Write-Host "Preparing staging..." # 清理旧的 staging if (Test-Path $staging) { Remove-Item $staging -Recurse -Force } @@ -50,6 +83,9 @@ if (Test-Path $shared) { } } +# 对最终目录中的所有 .exe 和 .dll 文件进行签名 +Sign-Files $destRoot + Write-Host "Creating ZIP..." if (Test-Path $outZip) { Remove-Item $outZip -Force }