From 91874f0df86bd619aab0637fc12f85e9d11349a1 Mon Sep 17 00:00:00 2001 From: Minsoo Choo Date: Tue, 14 Jan 2025 23:31:54 -0500 Subject: [PATCH] Fix windows build --- build.zig | 6 ++++++ src/install/windows-shim/bun_shim_impl.zig | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/build.zig b/build.zig index abcefc752bd6d5..e8a888e64aaf96 100644 --- a/build.zig +++ b/build.zig @@ -628,6 +628,12 @@ const WindowsShim = struct { .link_libc = false, }); + const options = b.addOptions(); + options.addOption(bool, "is_standalone", true); + + exe.root_module.addOptions("windows_shim", options); + dbg.root_module.addOptions("windows_shim", options); + return .{ .exe = exe, .dbg = dbg }; } }; diff --git a/src/install/windows-shim/bun_shim_impl.zig b/src/install/windows-shim/bun_shim_impl.zig index c8cf07e09db1b2..78e86275eeefa2 100644 --- a/src/install/windows-shim/bun_shim_impl.zig +++ b/src/install/windows-shim/bun_shim_impl.zig @@ -46,7 +46,7 @@ const w = std.os.windows; const assert = std.debug.assert; const fmt16 = std.unicode.fmtUtf16le; -const is_standalone = !@hasDecl(@import("root"), "JavaScriptCore"); +const is_standalone = !@hasDecl(@import("windows_shim"), "is_standalone"); const bun = if (!is_standalone) @import("root").bun else @compileError("cannot use 'bun' in standalone build of bun_shim_impl"); const bunDebugMessage = bun.Output.scoped(.bun_shim_impl, true); const callmod_inline = if (is_standalone) std.builtin.CallModifier.always_inline else bun.callmod_inline;