Skip to content

Zig 0.17, and Velopack 1.2.161 - #9

Merged
MichaelBelousov merged 4 commits into
mainfrom
zig-0.17
Oct 24, 2026
Merged

MichaelBelousov merged 4 commits into
mainfrom
zig-0.17

Conversation

@foxnne

@foxnne foxnne commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Brings velopack-zig up to Zig 0.17 and to current Velopack. Both the runtime library and the vpk packager move to 1.2.161; until now they were 0.0.1589 and 0.0.1298.

Supersedes #1 (the 0.16 port, which zig-0.16.0-v2 carried on). This starts from that branch, main plus the 0.16 port, so it keeps the two-call API from #7 and the version-scoped vpk installs from #8.

Zig 0.17

  • minimum_zig_version = "0.17.0" here, in squashfs/ and in the sample. CI runs 0.17.0, and macos-latest again now that Zig links against the macOS 26 SDK.
  • Velopack.h as a module. @cImport is gone, so linkVelopack now also gives the compile's root module a velopack_c import (the header through translate-c). The new velopackCModule(b, target, optimize) returns the same module for any other module that calls the C API. The sample uses it.
  • No global --libc. windows_msvc_libc is the only override now; b.libc_file no longer exists. The managed .velopack-msvc toolchain is unchanged.
  • Environment changes happen when commands run. In 0.17, Run.setEnvironmentVariable copies the whole environment while the build is configured, and that copy is cached with the configuration. A variable set later never reaches the command: a DOTNET_ROOT exported after the first build was ignored here until a forced reconfigure. vpk (DOTNET_ROLL_FORWARD=Major) and the MSVC setup script now run through tools/run_env.zig, which applies their changes at run time on top of the live environment.
  • mksquashfs on PATH. Run.addPathDir is gone. MksquashfsBuild.bin_dir is now a LazyPath (the artifact's own directory, no install step), and run_env --path puts it on vpk's PATH. attachMksquashfsToVpkRun is removed; addVelopackStep does it.
  • Configure-time existence checks are declared (dependOnFileMetadata), so the build reconfigures when an MSVC zig-libc-*.ini appears or goes. pathFromRoot/getPath3 are replaced by b.root.joinString, and optimize modes use their 0.17 names.

Velopack 1.2.161

  • The runtime zip is velopack_libc_1.2.161.zip, with the same 18 files and layout as before. vpk installs at 1.2.161 (velopack_version).
  • Velopack.h only gained declarations: vpkc_new_source_http_url_with_options (custom headers and a timeout) and vpkc_new_update_manager_flow, with their option structs. Nothing was removed or changed, so existing callers need no change.
  • vpk 1.2 targets .NET 10. CI installs 10.0.x.

What the jump brings for an app shipping through this:

  • macOS: the version file moved to Resources/ so an update no longer breaks the app's code signature (velopack#705); updates apply with an atomic rename (velopack#972).
  • Linux: the locator no longer uses the wrong root path (velopack#921).
  • Deltas: applying one that adds a directory is fixed (velopack#749). zstd is now the only delta format (velopack#1010).
  • Windows: 64-bit bootstrappers (velopack#944); the OS architecture check works without IsWow64Process2 (velopack#1072).

For an app already shipped on the old runtime: its users must still be able to update to a release packed with 1.2.161. Velopack added a fallback for old versions updating on a Mac (velopack#924), but test an update from your current release before shipping one built with this.

Tested

  • macOS (arm64, Zig 0.17.0, .NET 10.0.107): ./test/package.sh from a clean state packs the sample with vpk 1.2.161 (velosample-osx-Setup.pkg, -Portable.zip, -1.0.0-osx-full.nupkg, RELEASES-osx). zig build run runs the sample linked against the 1.2.161 runtime through velopack_c.
  • The environment fix: with the configuration cached and no DOTNET_ROOT, packing fails as it should; with DOTNET_ROOT exported, the next build packs. Before the fix it kept failing until a forced reconfigure.
  • Linux: squashfs/ cross-compiles for x86_64-linux-gnu. The AppImage path (mksquashfs through run_env --path) is left to CI's ubuntu-latest.
  • Windows: not run. CI's windows-latest covers the MSVC path, including translating Velopack.h for *-windows-msvc.
  • Not yet: an update round trip from a 0.0.1589 install to a 1.2.161 release, which waits for fizzy (fizzyedit/fizzy) to pack a release with this.

🤖 Generated with Claude Code

MichaelBelousov and others added 3 commits October 1, 2026 22:31
Thread std.Io through the tools' fs and process calls, switch their
entry points to std.process.Init, and pass b.graph.io in build.zig.

allyourcodebase/squashfs-tools has no 0.16-compatible revision, so its
build.zig is vendored under squashfs/ with the link calls moved to
root_module.
Zig 0.17: no global --libc, pathFromRoot or getPath3; Run.addPathDir is
gone; generated files are indexed; @cImport is removed. Velopack.h is
now a translate-c module (`velopack_c`, `velopackCModule`). Commands
that need environment changes run through tools/run_env.zig, because
0.17's setEnvironmentVariable snapshots the configure-time environment
into the cached configuration.

Velopack: runtime and vpk both 1.2.161 (were 0.0.1589 and 0.0.1298).
vpk 1.2 targets .NET 10.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Zig 0.17's maker cannot load a configuration that depends on a path
inside a directory that does not exist ("configuration failed:
FileSystemFailure"), which every *-windows-msvc build without a
.velopack-msvc/ directory hit. When the manifest is missing, declare
the nearest directory that exists; making the manifest changes it, so
the build still reconfigures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Zig 0.17's LibCInstallation renamed gcc_dir to cc_dir and added
darwin_sdk_dir, and refuses a file missing any field ("missing field:
darwin_sdk_dir"): every *-windows-msvc compile against the generated
zig-libc-*.ini failed. Found by fizzy's release workflow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
foxnne added a commit to fizzyedit/fizzy that referenced this pull request Oct 16, 2026
Part of fizzyedit/plans#5 (`plans/ZIG_0_17_PLAN.md`, step 2: the build
system). **Stacked on #438** (and #437): based on `zig/017-build-steps`,
so this diff is only release packaging.

## What changes

**Velopack 1.2.161.** `velopack_zig` moves to graphl-tech/velopack-zig#9
(`a80b037`, its Zig 0.17 port), and with it Velopack's runtime goes from
0.0.1589 to 1.2.161. `vpk` in `.config/dotnet-tools.json` goes from
0.0.1298 to 1.2.161; `vpk` 1.2 targets .NET 10, so `release.yml`
installs 10.0, not 8.0. What users gain is in velopack-zig#9: a code
signature that survives updates on macOS, atomic macOS updates, the
Linux locator fix, delta fixes, and 64-bit Windows bootstrappers.
`Velopack.h` only gained declarations; fizzy's updater is unchanged.

**The rest of the build system's 0.17 stand-ins:**
- **`Velopack.h` as a module.** `@cImport` is gone.
`velopack.linkVelopack(.c_modules = …)` gives each module that calls the
C API a `velopack_c` import (translate-c), once per module: the
integration, demo and bench tests share one `app` module. The updater
imports it only when Velopack is enabled.
- **`vpk pack` runs through velopack-zig's `tools/run_env.zig`**
(`velopack.addVpkRun`), which sets `DOTNET_ROLL_FORWARD` and puts the
bundled `mksquashfs` on `PATH` when vpk runs. So does the MSVC setup
script. In 0.17, `Run.setEnvironmentVariable` freezes the configure-time
environment into the cached configuration, and `Run.addPathDir` is gone.
`MksquashfsBuild.bin_dir` is now `mksquashfs`'s own output directory,
with no install step.
- **Signing and the macOS SDK are options only.** `-Dmacos-sign-app`,
`-Dmacos-sign-installer` and `-Dmacos-notary-profile` lose their
`FIZZY_MACOS_*` environment fallbacks, and `SDKROOT` becomes
`-Dmacos-sdk`: 0.17 caches the configuration without regard to the
environment. `scripts/release.sh` and `release.yml`'s macOS job turn the
same variables into the options, and `packageall` forwards them to its
macOS children.
- **No global `--libc`:** `-Dwindows-msvc-libc` or the managed
`.velopack-msvc/` only. The managed manifest's existence and an explicit
manifest's contents are declared to the configure cache.
- **The MSVC translate-c shim works again.** It finds each module's
translate-c step through the generated-file index and `Step.cast`, as
`std.Build` does, in place of the removed `Step.id`.
- **`docs/PITFALLS.md`, "The build (Zig 0.17)":** the four traps
(environment reads, `setEnvironmentVariable`, undeclared configure-time
reads, declared paths in missing directories), each with what fizzy does
instead.

After this, 36 `ZIG017` markers remain on the branch, none in the build
system: the zon stand-ins, the `@typeInfo` helpers, the example-branch
switch.

## SDK impact

- [x] None: no `sdk/` file changes here.
- [ ] Core-only or additive: reaches plugins at the next SDK release
- [ ] Fingerprint moved
- [ ] SDK release

## Verified

- [x] macOS (arm64, 0.17.0):
- `zig build package` packs a release with vpk 1.2.161:
`fizzy-arm64-macos-Setup.pkg`, `-Portable.zip`,
`fizzy-0.2.0-arm64-macos-full.nupkg`. The bundle carries
`Contents/Resources/sq.version`, 1.x's signature-preserving layout.
Unsigned: no identities on this machine.
- `zig build -Dvelopack=true` links Velopack (36 `vpkc_` symbols); `zig
build test-integration -Dvelopack=true` (79/79 steps).
- `scripts/check-fmt.sh`, `zig build`, `zig build test`, `zig build
test-integration` (77/77 steps), `zig build check-web`, `zig build
test-sdk-version`.
- `scripts/check-examples.sh` against the examples' `zig-0.17` branches:
all 8 builds pass.
- `zig build -Dtarget=x86_64-windows-msvc` configures;
`-Dtarget=x86_64-windows-gnu -Dno-emit` builds.
- [ ] Windows: not run. The MSVC path (`.velopack-msvc/`, the shim)
needs a packaging run.
- [ ] Linux: not run. The AppImage path is velopack-zig#9's `run_env
--path`, which its CI passes on `ubuntu-latest`.
- [ ] **A test release.** `release.yml` packaging all six targets,
signed, is the real check for this PR. It has no dry-run mode: it
releases an existing tag and stops at a *draft* GitHub release, which
nothing auto-updates to until it is published. So the check is a test
tag on this branch (e.g. `v0.2.0-zig017.1`), the workflow's draft
release, then deleting both. Tagging is the maintainer's call.
- [ ] An update round trip, from an installed 0.0.1589-runtime release
to one packed with this, per OS. It waits for that dry run's artifacts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@foxnne

foxnne commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator Author

Leaving this unmerged on purpose. main stays on its current Zig for the projects that track it, and 0.17 lives on the zig-0.17 branch, the way 0.16 lives on zig-0.16.0 / zig-0.16.0-v2.

fizzy pins by commit, and both of its pins now have tags so they stay reachable:

  • fizzy-zig0.16 → 0c2f206 (fizzy main, Zig 0.16)
  • fizzy-zig0.17 → 3d553b7 (fizzy zig/0.17, Zig 0.17 + Velopack 1.2.161)

Please don't delete the zig-0.17 branch or those tags.

🤖 Generated with Claude Code

@MichaelBelousov
MichaelBelousov merged commit 3d553b7 into main Oct 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants