build(lite): enable Windows lite-backend cross-compile (.exe verified)

`build.sh --lite-backend --win-release` now cross-compiles a working
ObsidianDragonLite.exe with the real SDXL backend:

- Artifact platform follows the cross target: when only --win-release is
  requested, auto-select build/lite-backend/windows/ (previously always the host
  artifact, which would link a Linux .a into a Windows .exe).
- Link the Win32 system libs a Rust x86_64-pc-windows-gnu staticlib pulls in
  (rustls/schannel, ring, dirs, std) via DRAGONX_LITE_BACKEND_EXTRA_LIBS. The set
  is rustc's `--print native-static-libs` for the backend (winapi_* shims mapped
  to real mingw import libs); all 21 exist in mingw-w64.

Verified end to end on Linux:
- scripts/build-lite-backend-artifact.sh --platform windows cross-builds the
  backend to x86_64-pc-windows-gnu (~105 MB .a); rustls/ring cross-compile clean
  (no openssl blocker); all required litelib_* symbols present.
- build.sh --lite-backend --win-release -> release/windows/ObsidianDragonLite-
  <ver>.exe (PE32+ GUI x86-64, INCBIN-embedded, ~170 MB) + zip, with the same
  full-node-asset exclusion as Linux.

Not yet done: running the .exe on real Windows (cross-compiled only). Plan
updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-05 15:45:48 -05:00
parent 70608fcb7a
commit 9d7054b245
2 changed files with 17 additions and 3 deletions

View File

@@ -147,7 +147,7 @@ Each milestone is independently demoable and gated by a fake-backend test. Order
- Runtime kill-switch / feature flag / staged rollout.
- **Exit demo / test:** A downloadable `ObsidianDragonLite` that creates, syncs, sends, and persists against a real backend.
**Status (2026-06-05): M5a (durability) DONE; Linux release packaging VERIFIED; rest of M5b (CI/signing/macOS/rollout) pending.**
**Status (2026-06-05): M5a (durability) DONE; Linux + Windows release packaging VERIFIED; rest of M5b (CI/signing/macOS/rollout) pending.**
Verified against the SDXL Rust source that the backend auto-saves only on new-address / import / rescan — it does **NOT** save after `sync`, `send`, or `shield`, and `litelib_shutdown` only sets a flag (no save). So without intervention a first sync (~30 min) and any sent tx are lost on restart. The controller now triggers `save` at exactly those points:
- after the detached `sync` completes (before `syncDone_` is set, so a `syncComplete()` observer sees a persisted wallet);
- after a successful `send` / `shield` (skipped on failure);
@@ -156,7 +156,11 @@ Verified against the SDXL Rust source that the backend auto-saves only on new-ad
Crash/recovery of the wallet *file* (the `.dat`/`.dat.bak` rotation) is already handled inside the backend. Tests: `testLiteWalletControllerM5Persistence` proves saves fire after sync/send/shield and `saveWallet()`, and do NOT fire on a failed send or with no wallet open (fake tracks a save counter).
**Linux release packaging VERIFIED (2026-06-05).** `./build.sh --lite-backend --linux-release` produces `release/linux/ObsidianDragonLite-<ver>-Linux-x64.zip` + `.AppImage` with the SDXL backend linked statically into the binary. Confirmed the lite bundle correctly **excludes** all full-node assets (no `dragonxd`, `dragonx-cli`, `sapling-spend.params`, `sapling-output.params`, `asmap.dat`) and includes `res/` + `xmrig` (pool mining, which works in lite — xmrig connects to `pool.dragonx.is`, no local daemon needed). `release/` is gitignored. (CMake falls back to FetchContent SDL3 when system SDL3 is absent, so no system-SDL3 prerequisite for the build to succeed.)
- **Pending (M5b):** Windows/macOS release packaging, CI backend-artifact build + signing (per `lite-wallet-backend-signing-policy`), dynamic-loader sublane, runtime kill-switch/staged rollout, and end-to-end error/retry UX. Mostly build/CI/infra + GUI, not unit-verifiable here.
**Windows release packaging VERIFIED (2026-06-05).** Cross-compiled end to end on Linux:
1. `./scripts/build-lite-backend-artifact.sh --platform windows` cross-builds the SDXL backend to `x86_64-pc-windows-gnu` (`build/lite-backend/windows/libsilentdragonxlite.a`, ~105 MB). The rustls/ring TLS stack cross-compiles cleanly — no openssl blocker.
2. `./build.sh --lite-backend --win-release` now auto-selects the Windows artifact and links the Win32 system libs the Rust staticlib needs (derived from `rustc --print native-static-libs`: advapi32, ws2_32, kernel32, bcrypt, cfgmgr32, credui, crypt32, cryptnet, fwpuclnt, gdi32, msimg32, ncrypt, ntdll, ole32, opengl32, secur32, shell32, synchronization, user32, winspool, userenv — all present in mingw-w64). Produces `release/windows/ObsidianDragonLite-<ver>.exe` (standalone, INCBIN-embedded resources, ~170 MB) + `…-Windows-x64.zip`, verified `PE32+ executable (GUI) x86-64` with the same full-node-asset exclusion as Linux. **Runtime smoke on real Windows is still untested (cross-compiled on Linux; no Wine/Windows run yet).**
- **Pending (M5b):** runtime test of the Windows `.exe` on real Windows; macOS release packaging; CI backend-artifact build + signing (per `lite-wallet-backend-signing-policy`); dynamic-loader sublane; runtime kill-switch/staged rollout; end-to-end error/retry UX. Mostly build/CI/infra + GUI, not unit-verifiable here.
## What we explicitly drop from the v1 plan