修复了一些bug
This commit is contained in:
@@ -29,6 +29,32 @@ if ($zig) {
|
||||
$env:CC = $cc
|
||||
$env:CGO_ENABLED = "1"
|
||||
|
||||
# 双击 bat 时 Explorer 的 PATH 可能没有 go;按常见位置补上
|
||||
if (-not (Get-Command go -ErrorAction SilentlyContinue)) {
|
||||
$goExe = $null
|
||||
$exact = @()
|
||||
if ($env:GOROOT) { $exact += (Join-Path $env:GOROOT "bin\go.exe") }
|
||||
$exact += "C:\Program Files\Go\bin\go.exe"
|
||||
foreach ($p in $exact) {
|
||||
if (Test-Path -LiteralPath $p) { $goExe = $p; break }
|
||||
}
|
||||
if (-not $goExe) {
|
||||
$globs = @(
|
||||
(Join-Path $env:USERPROFILE "sdk\go*\bin\go.exe"),
|
||||
"D:\*\sdk\go*\bin\go.exe"
|
||||
)
|
||||
$hit = Get-ChildItem -Path $globs -ErrorAction SilentlyContinue | Select-Object -First 1
|
||||
if ($hit) { $goExe = $hit.FullName }
|
||||
}
|
||||
if ($goExe) {
|
||||
$env:Path = "$(Split-Path $goExe);$env:Path"
|
||||
Write-Host "== 使用 go: $goExe =="
|
||||
} else {
|
||||
Write-Host "== 未找到 go:请安装 Go 或把 go.exe 加入 PATH。"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
$tags = "gl"
|
||||
if (-not $Release) { $tags = "$tags dev" }
|
||||
|
||||
@@ -40,7 +66,7 @@ try {
|
||||
& (Join-Path $PSScriptRoot "make_icon.ps1")
|
||||
if ($LASTEXITCODE -ne 0) { throw "图标生成失败(make_icon.ps1)" }
|
||||
}
|
||||
go build -tags $tags -trimpath -ldflags "-s -w" -o bin/mc-client.exe ./cmd/client
|
||||
go build -tags $tags -trimpath -ldflags "-s -w -H windowsgui" -o bin/mc-client.exe ./cmd/client
|
||||
go build -trimpath -ldflags "-s -w" -o bin/mc-server.exe ./cmd/server
|
||||
|
||||
# 资源入 bin/(可执行文件目录解析:双击/快捷方式运行无需依赖工作目录)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# 年糕历险记 —— NSIS 正式安装器构建脚本(构建与发布.md §8 交付方案)
|
||||
# 用法:pwsh -File scripts/make_nsis.ps1 [-Version 0.1.0]
|
||||
# 用法:根目录 打包-安装包.bat [版本]
|
||||
# 或 pwsh -File scripts/make_nsis.ps1 [-Version 0.1.0]
|
||||
# 前置:C 工具链(tools/ 下 zig 或 MinGW,构建 GL 客户端需要);
|
||||
# NSIS 3(自动查找 tools/nsis/nsis-*/makensis.exe,其次 PATH 中的 makensis)
|
||||
# 产物:dist/年糕历险记-Setup-v<版本>.exe(简体中文向导、快捷方式选项、完成页运行选项)
|
||||
@@ -8,9 +9,9 @@ param([string]$Version = "0.1.0")
|
||||
$ErrorActionPreference = "Stop"
|
||||
$root = Split-Path $PSScriptRoot -Parent
|
||||
|
||||
# 1) 构建 bin/(复用 build.ps1:定位 zig/gcc,产出 mc-client.exe / mc-server.exe 及资源)
|
||||
& (Join-Path $PSScriptRoot "build.ps1")
|
||||
if ($LASTEXITCODE -ne 0) { throw "构建失败(build.ps1)" }
|
||||
# 1) 构建 bin/(Release:tags gl,无 dev;构建与发布.md §3 / §8)
|
||||
& (Join-Path $PSScriptRoot "build.ps1") -Release
|
||||
if ($LASTEXITCODE -ne 0) { throw "构建失败(build.ps1 -Release)" }
|
||||
|
||||
# 2) 定位 makensis:优先 tools/nsis/(本项目自带 NSIS 3.10),其次系统 PATH
|
||||
$makensisPath = (Get-ChildItem (Join-Path $root "tools\nsis") -Recurse -Filter makensis.exe -ErrorAction SilentlyContinue | Select-Object -First 1).FullName
|
||||
|
||||
Reference in New Issue
Block a user