Skip to content

[build] Zig master branch compatibility for build.zig. #5520

Merged
raysan5 merged 10 commits into
raysan5:masterfrom
dtasada:master
Feb 10, 2026
Merged

[build] Zig master branch compatibility for build.zig. #5520
raysan5 merged 10 commits into
raysan5:masterfrom
dtasada:master

Conversation

@dtasada

@dtasada dtasada commented Jan 29, 2026

Copy link
Copy Markdown
Contributor

Added compatibility for zig-master 0.16.0-dev.2349+204fa8959, while still maintaining 0.15 backwards compatibility. Doing so results in a bit more code.

@raysan5 raysan5 changed the title Zig master branch compatibility for build.zig. [build] Zig master branch compatibility for build.zig. Jan 29, 2026
@raysan5

raysan5 commented Feb 6, 2026

Copy link
Copy Markdown
Owner

@Not-Nik Please, could you review this PR before merging?

PavoReal added a commit to PavoReal/raylib-zig-0.16 that referenced this pull request Feb 7, 2026
Adapt to Zig 0.16 breaking API changes:
- std.fs.cwd() replaced with std.Io.Dir.cwd() with explicit io param
- std.process.getEnvVarOwned() replaced with b.graph.environ_map.get()
- Bump minimum version to 0.16.0-dev

Ref: raysan5#5487, raysan5#5520

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Not-Nik

Not-Nik commented Feb 8, 2026

Copy link
Copy Markdown
Contributor

I'm not up to date on all the changes in Zig's master, so I can't give a full review, but This looks to be a bit sketchy with checking the compiler version in the build script. Maybe @HaxSam has more insights.

@HaxSam

HaxSam commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

I'm going to look into it.
But I'm not sure if we want to keep backwards compatibility with Zig 0.15.x.
It just bloats up the build.zig, and in my opinion we should ditch the older Zig version if we update the build.zig for a newer Zig version. Especially because Zig isn't a stable language, it's okay to break compatibility.

we kinda had this discussion already: #4620

@dtasada

dtasada commented Feb 9, 2026

Copy link
Copy Markdown
Contributor Author

since 0.16 isn't actually out yet and it's the master branch i thought it'd be a good idea to maintain compatibilty with stable for now. if y'all wanna break it i could remove the backwards compatibility code simplifying it for 0.16 and breaking compatibility.

@HaxSam

HaxSam commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

I think breaking compatibility isnt that bad because if you wanna use raylib with 0.15.2 you could use a older commit of the master.

@HaxSam

HaxSam commented Feb 9, 2026

Copy link
Copy Markdown
Contributor

Can give a complete review in like ~8h

@maiconpintoabreu

Copy link
Copy Markdown
Contributor

Hi there, is it really needed to make it compatible with Master? how long this compatibility will survive?
The normal user will need to point to a specific commit when the compatibility breaks?

@raysan5

raysan5 commented Feb 9, 2026

Copy link
Copy Markdown
Owner

About compatibility, as per my understanding most Zig users should be using latest master, considering it is a project in development and introducing breaking changes along it. Personally I prefer to minimize code paths if not strictly necesary.

@HaxSam

HaxSam commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Looks good
Thanks for the commit where you minimized the diff made it a lot more easy to review

@raysan5

raysan5 commented Feb 10, 2026

Copy link
Copy Markdown
Owner

@HaxSam thanks for the further review! merging!

@raysan5 raysan5 merged commit 4b01c23 into raysan5:master Feb 10, 2026
2 checks passed
@vegerot

vegerot commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

I'm confused. The commit for 4b01c23 says

fixed build errors with zig. now compatible with zig master 0.16.0-dev.1593+c13857e50. still backwards compatible with 0.15.1

But when I just rebased raylib today my game using Zig 0.15.1 stopped building

cc @dtasada

@dtasada

dtasada commented Feb 11, 2026

Copy link
Copy Markdown
Contributor Author

yeah, if you read the thread you'll find raysan decided to break compatibility. you'll have to keep the commit before the update

@maiconpintoabreu

Copy link
Copy Markdown
Contributor

I'm confused. The commit for 4b01c23 says

fixed build errors with zig. now compatible with zig master 0.16.0-dev.1593+c13857e50. still backwards compatible with 0.15.1

But when I just rebased raylib today my game using Zig 0.15.1 stopped building

cc @dtasada

You can fork the raylib and add the build file on .gitignore and keep the remain of the project updated. (I will do it)

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.

6 participants