Skip to content

Commit 8707838

Browse files
committed
fix(windows): add perl and protoc to bootstrap
Strawberry Perl 供 openssl-sys vendored 编译:zap_sftp → ssh2(openssl-on-win32)会从源码编译 OpenSSL,需原生 perl 运行其 Configure 脚本,Git 自带的 cygwin perl 不适用于 MSVC 构建。 固定 protoc 25.1 供 proto 依赖的 build.rs 代码生成,版本与 script/linux/install_build_deps 对齐,满足 prost-build 对 proto3 optional 的 >= 3.15 要求。
1 parent c1c00f5 commit 8707838

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

script/windows/bootstrap.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,27 @@ winget install jqlang.jq
4949
# CMake is needed to build native dependencies.
5050
winget install -e --id Kitware.CMake
5151

52+
# Strawberry Perl 用于从源码编译 OpenSSL。zap_sftp → ssh2(openssl-on-win32)→
53+
# openssl-sys 的 vendored 构建会调用 perl 运行 OpenSSL 的 Configure 脚本。
54+
# 必须用原生 Windows perl(Strawberry),Git for Windows 自带的 cygwin perl 不适用于 MSVC 构建。
55+
winget install -e --id StrawberryPerl.StrawberryPerl `
56+
--accept-package-agreements --accept-source-agreements
57+
58+
# protoc(Protocol Buffers 编译器)用于 proto 依赖(如 warp_multi_agent_api)的 build.rs 代码生成。
59+
# 固定到与 script/linux/install_build_deps 相同的版本,保证跨平台代码生成一致;
60+
# prost-build 要求 protoc >= 3.15(proto3 optional 字段)。winget 的 Google.Protobuf 版本过新,故直接取官方发行版 zip。
61+
$protocVersion = '25.1'
62+
$protocDir = "$env:LOCALAPPDATA\protoc"
63+
$protocExe = "$protocDir\bin\protoc.exe"
64+
if (-not (Test-Path $protocExe)) {
65+
$protocZip = "$env:TEMP\protoc-$protocVersion-win64.zip"
66+
Invoke-WebRequest -Uri "https://github.com/protocolbuffers/protobuf/releases/download/v$protocVersion/protoc-$protocVersion-win64.zip" -OutFile $protocZip
67+
Expand-Archive -Path $protocZip -DestinationPath $protocDir -Force
68+
Remove-Item $protocZip
69+
}
70+
# prost-build 优先读取 PROTOC 环境变量(见构建错误提示),指向固定版本二进制最稳妥。
71+
[Environment]::SetEnvironmentVariable('PROTOC', $protocExe, 'User')
72+
5273
# We use InnoSetup to build our release bundle installer.
5374
winget install -e --id JRSoftware.InnoSetup
5475

0 commit comments

Comments
 (0)