Skip to content

Update for Zig 0.15#8

Open
djmattyg007 wants to merge 2 commits intosoftprops:mainfrom
djmattyg007:update-for-zig-0.15
Open

Update for Zig 0.15#8
djmattyg007 wants to merge 2 commits intosoftprops:mainfrom
djmattyg007:update-for-zig-0.15

Conversation

@djmattyg007
Copy link

  • Update code, docs and build config for zig 0.15.1+
    • Updated all references to std.io.getStdOut() to use std.fs.File.stdout() instead
    • Removed an unused import alias
    • Updated various references to zig in the readme, including version numbers and example commands
    • Updated build config to use module objects everywhere
  • Update CI
    • Switch to supported Github Action for installing Zig
    • Test with multiple supported zig versions
    • Ensure the setup-zig cache key for installing zig includes the zig version, to avoid conflicts
    • Compile the demo example, to make sure that also works as expected, so that our users can have confidence in it

The changes are honestly quite straightforward, mostly just updating
where things are imported from or how they're specified. No real logic
changes, except removing an unnecessary line under the list of imports.
- Switch to supported Github Action for installing Zig
- Test with multiple supported zig versions
- Ensure the setup-zig cache key for installing zig includes the zig
  version, to avoid conflicts
- Compile the demo example, to make sure that also works as expected, so
  that our users can have confidence in it
djmattyg007 added a commit to djmattyg007/hr-zig that referenced this pull request Nov 3, 2025
This move has some pros and cons. The most obvious con is that the use
of 'zig build-exe' has become extraordinarily more complicated, to the
point where I wasn't able to work it out in a sensible amount of time.
The sheer lack of documentation about this command with regards to
linking dependencies is honestly quite shocking. I think the entire
community just assumes that you're already a gcc flag wizard, and will
magically understand how everything is supposed to translate over.

There are more upsides than downsides though. For starters, we can avoid
linking libc. The termsize package uses only native zig code, which is
nice. It also has Windows support! As I use Windows + WSL + Powershell
more and more, this is only going to become more and more important for
me.

The hr project has always been a simple and straightforward way for me
to play around with new programming languages, and one of the most
important things in any modern programming environment is dependency
management. This exercise has helped me learn and understand more about
how Zig's dependency management system worked, which has been
fascinating (spoiler alert, I really do think it could be more
ergonomic - why do I need to manually specify dependencies in the build
system when they're in my build.zig.zon file and I'm requiring them from
my code??).

I'm also going to use this as an excuse to learn more about publishing
multi-arch releases to Github, and distributing a package through winget
for ease of installation. I can't do any of that sensibly until the
software actually runs on Windows though, which this update is all
about. The future is bright.

It's worth noting quickly that this currently relies on a (hopefully
temporary) fork of termsize that supports Zig 0.15.1. There's a PR open
here to get my improvements merged upstream:

softprops/zig-termsize#8
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.

1 participant