Cross-compile groundwork: make the tree build for Windows (3.1)

`cargo check --target x86_64-pc-windows-gnu` is now green (only the
upstream egui f32:From<f64> warnings). The Linux-only desktop deps are
target-gated so the rest of the stack — which already cross-compiles —
can build off Linux:

- Cargo.toml: ksni and rfd's xdg-portal backend move to
  [target.'cfg(target_os = "linux")'.dependencies]; non-Linux gets rfd
  with its native Win32/AppKit backend (default features).
- tray.rs: cfg-split. The ksni/SNI implementation stays Linux-only; other
  OSes get a no-op `start() -> None`, i.e. windowed-only (identical to the
  Linux no-SNI-host path). TrayEvent/TrayHandle stay cross-platform.
- plex.rs: add a Windows `symlink_file` arm to make_symlink (also fixes an
  unused-variable warning on non-unix).

The rest was already portable (disk_space/statvfs, mpv IPC UnixStream,
chmod/PermissionsExt guards all cfg(unix)). macOS is Unix so those apply
there unchanged. Still not a *shipped* binary: needs a real per-OS tray
backend and a linking CI matrix. ROADMAP 3.1 + CLAUDE.md updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Luna 2026-06-10 04:22:18 -07:00
parent ec8cf6f934
commit d797f2a698
6 changed files with 80 additions and 18 deletions

View file

@ -162,6 +162,13 @@ both the transcript indexer and the transcript viewers.
desktop code goes in `app.rs`, web handlers in `web.rs`, shared logic in the
focused modules (`downloader`, `database`, `library`, `platform`, `fingerprint`,
`vtt`, …).
- Tray (`ksni`) and file dialogs (`rfd` xdg-portal) are Linux-only/no-GTK by
design; keep that posture (it's why packaging avoids a GTK dep). Windows/macOS
are not yet first-class — the tray would need a per-OS backend.
- Tray (`ksni`) and the `rfd` xdg-portal dialog backend are Linux-only/no-GTK
by design (it's why packaging avoids a GTK dep). They're now **target-gated**
in `Cargo.toml` (`cfg(target_os = "linux")`); off Linux `rfd` uses its native
backend and `tray::start` is a compiled-out no-op (`None`). The tree
cross-compiles — `cargo check --target x86_64-pc-windows-gnu` is green — so
keep new platform-specific code behind `cfg(unix)`/`cfg(windows)`/
`cfg(target_os = …)` with a fallback, the way `disk_space`, `plex`, the mpv
IPC, and the `chmod` guards already do. Windows/macOS still aren't *shipped*
(no tray backend, no link/CI yet), but don't reintroduce an unconditional
Linux-only dep.