emcc: Fix build (#155)

This commit is contained in:
Not-Nik 2024-09-28 19:43:57 +02:00
parent c94e68d872
commit 1224eb2290
No known key found for this signature in database
GPG Key ID: E95F679E3CDD9784

View File

@ -11,11 +11,15 @@ pub fn emscriptenRunStep(b: *std.Build) !*std.Build.Step.Run {
.windows => "emrun.bat",
else => "emrun",
};
const emrun_run_arg = try b.allocator.alloc(u8, b.sysroot.?.len + emrunExe.len + 1);
var emrun_run_arg = try b.allocator.alloc(u8, b.sysroot.?.len + emrunExe.len + 1);
defer b.allocator.free(emrun_run_arg);
if (b.sysroot == null) {
emrun_run_arg = emrunExe;
emrun_run_arg = try std.fmt.bufPrint(
emrun_run_arg,
"{s}",
.{ emrunExe }
);
} else {
emrun_run_arg = try std.fmt.bufPrint(
emrun_run_arg,
@ -74,7 +78,11 @@ pub fn linkWithEmscripten(
defer b.allocator.free(emcc_run_arg);
if (b.sysroot == null) {
emcc_run_arg = emccExe;
emcc_run_arg = try std.fmt.bufPrint(
emcc_run_arg,
"{s}",
.{ emccExe }
);
} else {
emcc_run_arg = try std.fmt.bufPrint(
emcc_run_arg,