feat(installer): 增加 Windows 和 Linux 安装包脚本

- 增加 Inno Setup 安装器及运行库安装支持
- 增加 deb、rpm、AppImage 打包与完整 Release 目录校验
- 修复 WSL 打包权限和安装路径,补充构建说明及换行规则
This commit is contained in:
tongtong committed 2026-11-28 02:50:41 +08:00
1 parent 37b2cff82b
commit a0b77a3e7a
8 files changed
+283 -7

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#ifndef AppVersion
#error AppVersion is required
#endif
[Setup]
AppId={{68CC5D47-729F-4E7B-875F-BA091EC0BF9D}
AppName=TTSTDConnect
AppVersion={#AppVersion}
AppPublisher=TTSTD
DefaultDirName={localappdata}\Programs\TTSTDConnect
DefaultGroupName=TTSTDConnect
PrivilegesRequired=lowest
MinVersion=10.0
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
OutputDir={#OutputDir}
OutputBaseFilename=TTSTDConnect-{#AppVersion}-windows-x64-setup
SetupIconFile=..\..\flutter_sender\windows\runner\resources\app_icon.ico
UninstallDisplayIcon={app}\ttstd_sender.exe
Compression=lzma2
SolidCompression=yes
WizardStyle=modern
CloseApplications=yes
[Tasks]
Name: desktopicon; Description: "Create a desktop shortcut"; Flags: unchecked
[Files]
Source: "{#VCRedist}"; DestDir: "{tmp}"; DestName: "vc_redist.x64.exe"; Flags: deleteafterinstall
Source: "{#BundleDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{group}\TTSTDConnect"; Filename: "{app}\ttstd_sender.exe"
Name: "{autodesktop}\TTSTDConnect"; Filename: "{app}\ttstd_sender.exe"; Tasks: desktopicon
[Run]
Filename: "{tmp}\vc_redist.x64.exe"; Parameters: "/install /passive /norestart"; StatusMsg: "Installing Microsoft Visual C++ Runtime"; Flags: waituntilterminated
Filename: "{app}\ttstd_sender.exe"; Description: "Launch TTSTDConnect"; Flags: nowait postinstall skipifsilent
+53
View File
@@ -0,0 +1,53 @@
param(
[string]$Bundle,
[string]$Iscc,
[string]$Version,
[Parameter(Mandatory = $true)][string]$VCRedist
)
$ErrorActionPreference = 'Stop'
$root = (Resolve-Path (Join-Path $PSScriptRoot '../..')).Path
if (-not $Version) {
$Version = ([regex]::Match((Get-Content "$root/flutter_sender/pubspec.yaml" -Raw), '(?m)^version:\s*(\d+\.\d+\.\d+)')).Groups[1].Value
}
if ($Version -notmatch '^\d+\.\d+\.\d+$') { throw 'Version must be major.minor.patch' }
if (-not $Iscc) {
$command = Get-Command ISCC.exe -ErrorAction SilentlyContinue
if ($command) { $Iscc = $command.Source }
else {
foreach ($base in @(${env:ProgramFiles(x86)}, $env:ProgramFiles)) {
if ($base -and (Test-Path "$base/Inno Setup 6/ISCC.exe")) { $Iscc = "$base/Inno Setup 6/ISCC.exe"; break }
}
}
}
if (-not $Iscc -or -not (Test-Path -LiteralPath $Iscc)) { throw 'Install Inno Setup 6 or supply -Iscc path/to/ISCC.exe' }
$VCRedist = (Resolve-Path -LiteralPath $VCRedist).Path
function Invoke-Step([string]$Directory, [string]$Command, [string[]]$Arguments) {
Push-Location $Directory
try {
& $Command @Arguments
if ($LASTEXITCODE -ne 0) { throw "$Command failed: $LASTEXITCODE" }
} finally { Pop-Location }
}
$output = "$root/dist/windows"
New-Item -ItemType Directory -Force -Path $output | Out-Null
if (-not $Bundle) {
Invoke-Step "$root/rust_core" cargo @('check', '--offline')
Invoke-Step "$root/rust_core" cargo @('test', '--offline', '--lib')
Invoke-Step "$root/rust_core" cargo @('build', '--release', '--offline', '--target', 'x86_64-pc-windows-msvc', '--target-dir', "$root/rust_core/target")
Invoke-Step "$root/flutter_sender" flutter @('pub', 'get')
Invoke-Step "$root/flutter_sender" dart @('analyze', 'lib')
Invoke-Step "$root/flutter_sender" flutter @('build', 'windows', '--debug')
Invoke-Step "$root/flutter_sender" flutter @('build', 'windows', '--release')
$Bundle = Join-Path $output ('stage-' + [guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Path $Bundle | Out-Null
Copy-Item "$root/flutter_sender/build/windows/x64/runner/Release/*" $Bundle -Recurse
Copy-Item "$root/rust_core/target/x86_64-pc-windows-msvc/release/ttstdconnect_core.dll" $Bundle
Invoke-Step "$root/signaling_server" go @('build', '-o', "$Bundle/signaling_server.exe", '.')
}
$Bundle = (Resolve-Path -LiteralPath $Bundle).Path
foreach ($file in @('ttstd_sender.exe', 'flutter_windows.dll', 'ttstdconnect_core.dll', 'signaling_server.exe', 'data/app.so', 'data/flutter_assets')) {
if (-not (Test-Path -LiteralPath (Join-Path $Bundle $file))) { throw "Incomplete Release bundle: $file" }
}
& $Iscc "/DAppVersion=$Version" "/DBundleDir=$Bundle" "/DOutputDir=$output" "/DVCRedist=$VCRedist" "$PSScriptRoot/setup.iss"
if ($LASTEXITCODE -ne 0) { throw "Inno Setup failed: $LASTEXITCODE" }
Write-Host "Installer: $output/TTSTDConnect-$Version-windows-x64-setup.exe"