build: finish cross-platform release tooling
This commit is contained in:
+31
-6
@@ -5,6 +5,20 @@
|
||||
|
||||
## 安装
|
||||
|
||||
### 安装包
|
||||
|
||||
从 [Release](https://git.whcself.xyz/WHC/CST-agent/releases) 下载
|
||||
`cst-agent-VERSION-windows-x86_64-setup.exe` 运行即可:按当前用户安装到
|
||||
`%LOCALAPPDATA%\Programs\cst-agent`(不需要管理员),把这个目录加进**用户** PATH,
|
||||
开始菜单里放一个“CST-Agent WebUI”(在用户目录启动 `cst-agent --web --web-open`)。
|
||||
系统低于 Windows 10 1903 时安装包会直接拒绝。
|
||||
|
||||
卸载:设置 → 应用 → CST-Agent,或运行安装目录里的 `uninstall.exe`;会去掉 PATH 里的这一项。
|
||||
API key 和设置在 `%APPDATA%\cst-agent`,卸载时保留。
|
||||
安装包装的文件和 zip 一样,所以之后也能用 `cst-agent-update` 升级,或者重新运行新版安装包覆盖。
|
||||
|
||||
### PowerShell 脚本
|
||||
|
||||
在 PowerShell 里(Windows PowerShell 5.1 或 PowerShell 7 都行):
|
||||
|
||||
```powershell
|
||||
@@ -123,7 +137,9 @@ windows-x86_64/
|
||||
|
||||
## 从源码构建
|
||||
|
||||
两种方式产物一样:`dist/windows-x86_64/` 和 `dist/cst-agent-VERSION-windows-x86_64.zip`。
|
||||
两种方式产物一样:`dist/windows-x86_64/` 和 `dist/cst-agent-VERSION-windows-x86_64.zip`;
|
||||
装了 `makensis`(NSIS)时还有安装包 `dist/cst-agent-VERSION-windows-x86_64-setup.exe`
|
||||
(脚本在 `scripts/windows/cst-agent.nsi`)。
|
||||
第三方依赖(curl、ncurses、busybox-w32)都按固定版本从源码编译、静态链接。
|
||||
|
||||
### 在 Linux 上交叉编译
|
||||
@@ -134,8 +150,16 @@ cd CST-agent
|
||||
scripts/bootstrap_windows.sh
|
||||
```
|
||||
|
||||
NixOS / 有 Nix 时自动进 `shell-win.nix`(`pkgsCross.ucrt64`);否则需要 UCRT 版的
|
||||
`x86_64-w64-mingw32-gcc`(带 winpthreads)、cmake、ninja、git、perl。
|
||||
NixOS / 有 Nix 时自动进 `shell-win.nix`(`pkgsCross.ucrt64`,带 NSIS);否则需要 UCRT 版的
|
||||
mingw-w64 gcc(带 winpthreads)、cmake、ninja、git、perl。工具前缀由 `MINGW_HOST` 指定,默认
|
||||
`x86_64-w64-mingw32`;Debian trixie 起的 `gcc-mingw-w64-ucrt64` 是 `x86_64-w64-mingw32ucrt`:
|
||||
|
||||
```bash
|
||||
sudo apt install gcc-mingw-w64-ucrt64 binutils-mingw-w64-ucrt64 nsis cmake ninja-build perl
|
||||
MINGW_HOST=x86_64-w64-mingw32ucrt scripts/bootstrap_windows.sh
|
||||
```
|
||||
|
||||
`CST_WIN_CFLAGS` 给 `cst-agent.exe` 追加编译选项(CI 用 `-Wall -Wextra -Werror`)。
|
||||
|
||||
### 在 Windows 上用 MSYS2 原生编译
|
||||
|
||||
@@ -159,17 +183,18 @@ scripts/bootstrap_msys2.sh
|
||||
|
||||
### 发布
|
||||
|
||||
CI:推 `main` 或 `v*` tag 且 `windows-cross` 成功后,自动把 zip / `.sha256` 发到
|
||||
CI:推 `main` 或 `v*` tag 且 `windows` 任务成功后,自动把 zip、安装包和各自的 `.sha256` 发到
|
||||
Gitea Release `vVERSION`(版本来自 `include/cst_version.h`;同名资源替换)。仓库 Secrets
|
||||
可设 `RELEASE_TOKEN`(`write:repository`),没有则用 Actions 自带 token。
|
||||
|
||||
本地:
|
||||
|
||||
```bash
|
||||
GITEA_TOKEN=... scripts/release_windows.sh --build
|
||||
scripts/bootstrap_windows.sh
|
||||
GITEA_TOKEN=... scripts/release.sh dist/cst-agent-*-windows-x86_64.zip dist/cst-agent-*-windows-x86_64-setup.exe
|
||||
```
|
||||
|
||||
创建(或复用)`vVERSION` Release,上传 zip 和 `.sha256`。token 只从环境变量读取,经 stdin
|
||||
创建(或复用)`vVERSION` Release,上传给出的文件和旁边的 `.sha256`。token 只从环境变量读取,经 stdin
|
||||
交给 curl,不会出现在命令行参数、磁盘或输出里。发版前先 bump `cst_version.h`;推
|
||||
`vX.Y.Z` tag 时必须与头文件一致。
|
||||
|
||||
|
||||
+5
-5
@@ -21,11 +21,11 @@ The Makefile picks `ncursesw`, then `ncurses`, through pkg-config. On macOS it
|
||||
adds Homebrew's keg-only `ncurses`/`curl` to `PKG_CONFIG_PATH`; without
|
||||
Homebrew it falls back to the system `-lncurses` (wide-character capable).
|
||||
|
||||
Verified so far: NixOS x86_64 with gcc and clang (`-Werror`, `make check`,
|
||||
`make asan`, ctest), and every source compiled `-fsyntax-only` with
|
||||
`x86_64-unknown-linux-musl-gcc` without warnings. Full musl, macOS and WSL
|
||||
builds run in CI (`.gitea/workflows/ci.yml`; the macOS job needs a runner and
|
||||
the `HAVE_MACOS_RUNNER` variable) or by hand with the checklist below.
|
||||
Verified so far: NixOS x86_64 with gcc, clang and TinyCC (`-Werror` except
|
||||
tcc, `make check`, `make asan`, ctest). CI (`.gitea/workflows/ci.yml`) checks
|
||||
with TinyCC on Debian and builds the static musl releases for x86_64, x86 and
|
||||
aarch64 with gcc `-Werror` (`make check` on both x86 targets, a qemu smoke
|
||||
test on aarch64). macOS and WSL are checked by hand with the list below.
|
||||
|
||||
## Files
|
||||
|
||||
|
||||
Reference in New Issue
Block a user