From 8856b7e9ebe841b3a32ca09d9bbe97b24fd0651a Mon Sep 17 00:00:00 2001 From: Mike Russo Date: Fri, 3 Jul 2026 13:40:34 -0600 Subject: [PATCH 01/11] Bump zemscripten to branch suporting latest zig 0.17 --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 07a1f7400ad0..edbe44521ac4 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -21,8 +21,8 @@ .hash = "N-V-__8AAJl1DwBezhYo_VE6f53mPVm00R-Fk28NPW7P14EQ", }, .zemscripten = .{ - .url = "git+https://github.com/zig-gamedev/zemscripten#3fa4b778852226c7346bdcc3c1486e875a9a6d02", - .hash = "zemscripten-0.2.0-dev-sRlDqApRAACspTbAZnuNKWIzfWzSYgYkb2nWAXZ-tqqt", + .url = "git+https://github.com/Yinameah/zemscripten#06d49243789d638ba10d4af004c46df4da83579c", + .hash = "zemscripten-0.2.0-dev-sRlDqKFRAAAXl8aICu541O6PiY70v4HIr3FTmCg--WqM", }, }, From 42c0fc59b42161b1be994e675d29d7a533273ba5 Mon Sep 17 00:00:00 2001 From: Mike Russo Date: Fri, 3 Jul 2026 13:51:35 -0600 Subject: [PATCH 02/11] zemscripten changes for build.zig --- build.zig | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index 8d8b2d3532e4..ddfcbbdeae00 100644 --- a/build.zig +++ b/build.zig @@ -69,7 +69,7 @@ pub const emsdk = struct { raylib.root_module.addIncludePath(emsdk_dep.path("upstream/emscripten/cache/sysroot/include")); wasm.root_module.addIncludePath(emsdk_dep.path("upstream/emscripten/cache/sysroot/include")); - const emcc_step = zemscripten.emccStep(b, wasm, options); + const emcc_step = zemscripten.emccStep(b, &.{}, &.{wasm}, options); emcc_step.dependOn(activate_emsdk_step); return emcc_step; @@ -77,7 +77,7 @@ pub const emsdk = struct { pub fn emrunStep( b: *std.Build, - html_path: []const u8, + html_path: std.Build.LazyPath, extra_args: []const []const u8, ) *std.Build.Step { return zemscripten.emrunStep(b, html_path, extra_args); @@ -718,13 +718,16 @@ fn addExamples( .preload_paths = emcc_examples_preloads_map.get(filename) orelse &.{}, .shell_file_path = b.path("src/shell.html"), .install_dir = install_dir, + .out_file_name = wasm.name, }); b.getInstallStep().dependOn(emcc_step); - const html_filename = try std.fmt.allocPrint(b.allocator, "{s}.html", .{wasm.name}); + const install_file = b.addInstallFile(.{ .cwd_relative = b.fmt("{s}/{s}/{s}.html", .{ module, filename, wasm.name }) }, "web"); + b.getInstallStep().dependOn(&install_file.step); + const emrun_step = emsdk.emrunStep( b, - b.getInstallPath(install_dir, html_filename), + install_file.source, &.{}, ); From c7dbfdf40d57b493955ab94c6b1c4ce77315c516 Mon Sep 17 00:00:00 2001 From: Mike Russo Date: Fri, 3 Jul 2026 13:51:50 -0600 Subject: [PATCH 03/11] general zig 0.17 changes for build.zig - update calls to `buildDir` and `findProgram` to their new interfaces/calling sites. - fix issue where you can't import zon anymore as slice (?) --- build.zig | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/build.zig b/build.zig index ddfcbbdeae00..3002e360546d 100644 --- a/build.zig +++ b/build.zig @@ -92,7 +92,7 @@ pub fn linkWindows(mod: *std.Build.Module, opengl: bool, comptime shcore: bool) } fn findWaylandScanner(b: *std.Build) void { - _ = b.findProgram(&.{"wayland-scanner"}, &.{}) catch { + _ = b.findProgram(.{ .names = &.{"wayland-scanner"} }) orelse { std.log.err( \\ `wayland-scanner` may not be installed on the system. \\ You can switch to X11 in your `build.zig` by changing `Options.linux_display_backend` @@ -648,7 +648,7 @@ fn addExamples( const all = b.step(module, "All " ++ module ++ " examples"); const module_subpath = b.pathJoin(&.{ "examples", module }); - var dir = try b.build_root.handle.openDir(b.graph.io, module_subpath, .{ .iterate = true }); + var dir = try b.root.openDir(b.graph.io, module_subpath, .{ .iterate = true }); defer dir.close(b.graph.io); var iter = dir.iterate(); @@ -706,9 +706,10 @@ fn addExamples( const emcc_flags = emsdk.emccDefaultFlags(b.allocator, .{ .optimize = optimize }); const emcc_settings = emsdk.emccDefaultSettings(b.allocator, .{ .optimize = optimize }); - const EmccExamplesPreloadMap = std.static_string_map.StaticStringMap([]const emsdk.zemscripten.EmccFilePath); - const EmccExamplesPreloadKV = struct { []const u8, []const emsdk.zemscripten.EmccFilePath }; - const emcc_examples_preloads: []const EmccExamplesPreloadKV = @import("examples/example_resources.zon"); + const EmccExamplesPreloadMap = std.static_string_map.StaticStringMap([]const emsdk.zemscripten.ResourceFile); + const EmccExamplesPreloadKV = struct { []const u8, []const emsdk.zemscripten.ResourceFile }; + const emcc_examples_preloads_ = @import("examples/example_resources.zon"); + const emcc_examples_preloads: []const EmccExamplesPreloadKV = @ptrCast(@alignCast(&emcc_examples_preloads_)); const emcc_examples_preloads_map = EmccExamplesPreloadMap.initComptime(emcc_examples_preloads); const emcc_step = emsdk.emccStep(b, raylib, wasm, .{ @@ -762,7 +763,7 @@ fn waylandGenerate( comptime waylandDir: []const u8, comptime source: bool, ) !void { - const dir = try b.build_root.handle.openDir(b.graph.io, waylandDir, .{ .iterate = true }); + const dir = try b.root.openDir(b.graph.io, waylandDir, .{ .iterate = true }); defer dir.close(b.graph.io); var iter = dir.iterate(); From 9ae3cdf2f6d4fabe40ff33b374e58aee66a7d2ef Mon Sep 17 00:00:00 2001 From: Mike Russo Date: Fri, 3 Jul 2026 13:57:45 -0600 Subject: [PATCH 04/11] Update minimum zig version --- build.zig.zon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig.zon b/build.zig.zon index edbe44521ac4..248b72313856 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,7 +1,7 @@ .{ .name = .raylib, .version = "6.0.0", - .minimum_zig_version = "0.16.0", + .minimum_zig_version = "0.17.0-dev.1158+1d1193aa7", .fingerprint = 0x13035e5cb8bc1ac2, // Changing this has security and trust implications. From 3472e60fbe7a40ea46b5c951f6772646cb979e5f Mon Sep 17 00:00:00 2001 From: Mike Russo Date: Fri, 3 Jul 2026 14:21:30 -0600 Subject: [PATCH 05/11] Remove redundant emsdk activations Examples depend on raylib anyway, and if using emsdk, it will be activated already. This activation was causing an error in zig nightly, so the change here. --- build.zig | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build.zig b/build.zig index 3002e360546d..9c9a91a12a4b 100644 --- a/build.zig +++ b/build.zig @@ -63,14 +63,11 @@ pub const emsdk = struct { } pub fn emccStep(b: *std.Build, raylib: *std.Build.Step.Compile, wasm: *std.Build.Step.Compile, options: zemscripten.StepOptions) *std.Build.Step { - const activate_emsdk_step = zemscripten.activateEmsdkStep(b); - const emsdk_dep = b.dependency("emsdk", .{}); raylib.root_module.addIncludePath(emsdk_dep.path("upstream/emscripten/cache/sysroot/include")); wasm.root_module.addIncludePath(emsdk_dep.path("upstream/emscripten/cache/sysroot/include")); const emcc_step = zemscripten.emccStep(b, &.{}, &.{wasm}, options); - emcc_step.dependOn(activate_emsdk_step); return emcc_step; } @@ -797,4 +794,3 @@ fn waylandGenerate( } } } - From 74c1b9fb6e2b25ce31c7eb4e990b06ff56931eee Mon Sep 17 00:00:00 2001 From: Mike Russo Date: Fri, 3 Jul 2026 14:36:44 -0600 Subject: [PATCH 06/11] better `getInstallPath` alternative --- build.zig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/build.zig b/build.zig index 9c9a91a12a4b..428efb2db7b7 100644 --- a/build.zig +++ b/build.zig @@ -720,12 +720,9 @@ fn addExamples( }); b.getInstallStep().dependOn(emcc_step); - const install_file = b.addInstallFile(.{ .cwd_relative = b.fmt("{s}/{s}/{s}.html", .{ module, filename, wasm.name }) }, "web"); - b.getInstallStep().dependOn(&install_file.step); - const emrun_step = emsdk.emrunStep( b, - install_file.source, + b.graph.path(.install_prefix, b.fmt("{s}/{s}.html", .{ filename, wasm.name })), &.{}, ); From 23e73da86b5e24258031e8b46a38cb448a3a86ea Mon Sep 17 00:00:00 2001 From: Mike Russo Date: Sun, 19 Jul 2026 19:06:55 -0600 Subject: [PATCH 07/11] Remove example install -> emcc dependency in graph --- build.zig | 1 - 1 file changed, 1 deletion(-) diff --git a/build.zig b/build.zig index 428efb2db7b7..05020a08b76c 100644 --- a/build.zig +++ b/build.zig @@ -718,7 +718,6 @@ fn addExamples( .install_dir = install_dir, .out_file_name = wasm.name, }); - b.getInstallStep().dependOn(emcc_step); const emrun_step = emsdk.emrunStep( b, From c028bf04fb893a062a91152c16427d3ae770c2ec Mon Sep 17 00:00:00 2001 From: Mike Russo Date: Sun, 19 Jul 2026 19:31:56 -0600 Subject: [PATCH 08/11] Fix emrun path --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 05020a08b76c..24f467a18409 100644 --- a/build.zig +++ b/build.zig @@ -721,7 +721,7 @@ fn addExamples( const emrun_step = emsdk.emrunStep( b, - b.graph.path(.install_prefix, b.fmt("{s}/{s}.html", .{ filename, wasm.name })), + b.graph.path(.install_prefix, b.fmt("web/{s}/{s}.html", .{ filename, wasm.name })), &.{}, ); From ff7153747d5efe9e9d5c0f26d837a1381d9ae7c4 Mon Sep 17 00:00:00 2001 From: Mike Russo Date: Sun, 19 Jul 2026 19:43:34 -0600 Subject: [PATCH 09/11] Fix file output issue --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 24f467a18409..a9ca46d059ea 100644 --- a/build.zig +++ b/build.zig @@ -695,7 +695,7 @@ fn addExamples( exe_mod.addCMacro("PLATFORM_WEB", ""); const wasm = b.addLibrary(.{ - .name = filename, + .name = b.fmt("{s}.html", .{filename}), .root_module = exe_mod, }); From eb2d1c0047b088075ae98e1f87137f3bb92eaae7 Mon Sep 17 00:00:00 2001 From: Mike Russo Date: Sun, 19 Jul 2026 19:43:43 -0600 Subject: [PATCH 10/11] Bump zig to latest nightly --- build.zig.zon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig.zon b/build.zig.zon index 248b72313856..4ac8303b8756 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,7 +1,7 @@ .{ .name = .raylib, .version = "6.0.0", - .minimum_zig_version = "0.17.0-dev.1158+1d1193aa7", + .minimum_zig_version = "0.17.0-dev.1426+58a94eaae", .fingerprint = 0x13035e5cb8bc1ac2, // Changing this has security and trust implications. From f1dc83603c5fd7e973a7550154b6122a1f35d53c Mon Sep 17 00:00:00 2001 From: Mike Russo Date: Sun, 19 Jul 2026 19:56:06 -0600 Subject: [PATCH 11/11] Get emrun step to work --- build.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build.zig b/build.zig index a9ca46d059ea..f681adb10669 100644 --- a/build.zig +++ b/build.zig @@ -721,7 +721,10 @@ fn addExamples( const emrun_step = emsdk.emrunStep( b, - b.graph.path(.install_prefix, b.fmt("web/{s}/{s}.html", .{ filename, wasm.name })), + b.graph.path(.install_prefix, b.fmt( + "web/{s}/{s}/{s}", + .{ module, filename, wasm.name }, + )), &.{}, );