From 5915584cd6cd8120429b70e224d6e80c8c1abadf Mon Sep 17 00:00:00 2001 From: Mr Josh Date: Sun, 29 Mar 2026 10:38:45 +1100 Subject: [PATCH] Fix zig build and minor improvements (#5702) - Added zig-pkg directory to gitignore - Brought min zig version to recent nightly release these improvements were completed on - For linux build, only add rglfw.c if the platform is glfw - Add a None option to the LinuxDisplayBackend - Fixed xcode-frameworks dependency and update to using most recent commit hash --- .gitignore | 1 + build.zig | 8 ++++++-- build.zig.zon | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 00a751a73..a0fa8db1c 100644 --- a/.gitignore +++ b/.gitignore @@ -118,6 +118,7 @@ GTAGS # Zig programming language .zig-cache/ zig-cache/ +zig-pkg/ zig-out/ build/ build-*/ diff --git a/build.zig b/build.zig index 3dc95bc83..ec254debf 100644 --- a/build.zig +++ b/build.zig @@ -2,7 +2,7 @@ const std = @import("std"); const builtin = @import("builtin"); /// Minimum supported version of Zig -const min_ver = "0.16.0-dev.2349+204fa8959"; +const min_ver = "0.16.0-dev.3013+abd131e33"; const emccOutputDir = "zig-out" ++ std.fs.path.sep_str ++ "htmlout" ++ std.fs.path.sep_str; const emccOutputFile = "index.html"; @@ -264,7 +264,10 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. setDesktopPlatform(raylib, .android); } else { - try c_source_files.append(b.allocator, "src/rglfw.c"); + switch (options.platform) { + .glfw => try c_source_files.append(b.allocator, "src/rglfw.c"), + .rgfw, .sdl, .drm, .android => {}, + } if (options.linux_display_backend == .X11 or options.linux_display_backend == .Both) { raylib.root_module.addCMacro("_GLFW_X11", ""); @@ -434,6 +437,7 @@ pub const OpenglVersion = enum { }; pub const LinuxDisplayBackend = enum { + None, X11, Wayland, Both, diff --git a/build.zig.zon b/build.zig.zon index 247386fb1..ee5a84c68 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -7,8 +7,8 @@ .dependencies = .{ .xcode_frameworks = .{ - .url = "https://pkg.machengine.org/xcode-frameworks/9a45f3ac977fd25dff77e58c6de1870b6808c4a7.tar.gz", - .hash = "122098b9174895f9708bc824b0f9e550c401892c40a900006459acf2cbf78acd99bb", + .url = "https://pkg.machengine.org/xcode-frameworks/8a1cfb373587ea4c9bb1468b7c986462d8d4e10e.tar.gz", + .hash = "N-V-__8AALShqgXkvqYU6f__FrA22SMWmi2TXCJjNTO1m8XJ", .lazy = true, }, .emsdk = .{