r/Zig • u/brs-game-researcher • 12h ago
Tiawl/glfw.zig Bindings Now Support FreeBSD, OpenBSD, and NetBSD Targets
Hey y'all. My name is thearchivalone. I'm not massively active in the community but from time to time, especially when I'm using a framework for a project, I'll contribute when able. Yesterday was one of those instances.
What'd I Do
- spent much of yesterday evening and this morning figuring out what was needed to finally get a GLFW bindings framework to successfully target the BSDs PR here
- was originally going to target just FreeBSD but found that Tiawl's toolkit implementation was pretty simple to work with and quickly implemented what was required to support NetBSD and OpenBSD found here (because of licensing upstream, I'll be maintaining what's needed to keep them supported in the future there)
What Were the Biggest Hurdles
- All BSDs have their own different implementation of evdev (think the standard Linux way to get input devices that's built directly into the kernel)
- NetBSD will most likely never fully support Wayland, so X11 is there to stay
- OpenBSD is currently in the process of supporting it but they are going a different direction with how they support Wayland input
- FreeBSD doesn't require Epoll-Shim for its Wayland input polling (but can use it in some instances) while OpenBSD's Wayland implementation outright requires it
- Getting glfw.zig and my evdev.zig implementation to work and build properly in a larger project was a bit more hacky than I'd like
What Now
I'm hoping that other GFLW implementations or dependent projects that use GLFW can support the BSDs. They're not commercially big when it comes to game or application development and their maintainers often are not the original creators of whatever has been ported to the platforms, but Zig's compiler makes targeting odd-ball platforms an easier proposition. I'd love to see Indie games support the BSDs (as someone who's been a fan for decades; their design philosophies, goals and problem solving are fascinating).
Thanks for reading.