aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-28 06:09:14 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-28 06:09:14 -0800
commitef3c9b7c6d6557f7cf50210f4a54187351d47ca8 (patch)
tree05d0a0851b158ecc33abc0657774871222476207
parent6260aaac5fc5be7296be1414bc06977df168ec07 (diff)
downloadbun-ef3c9b7c6d6557f7cf50210f4a54187351d47ca8.tar.gz
bun-ef3c9b7c6d6557f7cf50210f4a54187351d47ca8.tar.zst
bun-ef3c9b7c6d6557f7cf50210f4a54187351d47ca8.zip
Workaround https://github.com/ziglang/zig/issues/14099
-rw-r--r--build.zig14
-rw-r--r--src/main.zig4
2 files changed, 15 insertions, 3 deletions
diff --git a/build.zig b/build.zig
index 04ba78c2a..2848ce9e6 100644
--- a/build.zig
+++ b/build.zig
@@ -43,7 +43,7 @@ const color_map = std.ComptimeStringMap([]const u8, .{
&.{ "yellow", "33m" },
});
-fn addInternalPackages(step: *std.build.LibExeObjStep, _: std.mem.Allocator, target: anytype) !void {
+fn addInternalPackages(step: *std.build.LibExeObjStep, allocator: std.mem.Allocator, zig_exe: []const u8, target: anytype) !void {
var bun = std.build.Pkg{
.name = "bun",
.source = pkgPath("src/bun_redirect.zig"),
@@ -86,6 +86,13 @@ fn addInternalPackages(step: *std.build.LibExeObjStep, _: std.mem.Allocator, tar
javascript_core.dependencies = &[_]std.build.Pkg{};
step.addPackage(io);
step.addPackage(bun);
+
+ // workaround for https://github.com/ziglang/zig/issues/14099
+ const compiler_rt: std.build.Pkg = .{
+ .name = "compiler_rt",
+ .source = .{ .path = try std.fmt.allocPrint(allocator, "{s}/lib/compiler_rt.zig", .{std.fs.path.dirname(zig_exe).?}) },
+ };
+ step.addPackage(compiler_rt);
}
const BunBuildOptions = struct {
@@ -279,6 +286,7 @@ pub fn build(b: *std.build.Builder) !void {
try addInternalPackages(
obj,
b.allocator,
+ b.zig_exe,
target,
);
@@ -527,11 +535,11 @@ pub fn linkObjectFiles(b: *std.build.Builder, obj: *std.build.LibExeObjStep, tar
}
}
-pub fn configureObjectStep(_: *std.build.Builder, obj: *std.build.LibExeObjStep, comptime Target: type, target: Target, main_pkg_path: []const u8) !void {
+pub fn configureObjectStep(b: *std.build.Builder, obj: *std.build.LibExeObjStep, comptime Target: type, target: Target, main_pkg_path: []const u8) !void {
obj.setMainPkgPath(main_pkg_path);
obj.setTarget(target);
- try addInternalPackages(obj, std.heap.page_allocator, target);
+ try addInternalPackages(obj, std.heap.page_allocator, b.zig_exe, target);
if (target.getOsTag() != .freestanding)
addPicoHTTP(obj, false);
diff --git a/src/main.zig b/src/main.zig
index ba3fd97d9..9b7c5eb08 100644
--- a/src/main.zig
+++ b/src/main.zig
@@ -43,3 +43,7 @@ test "panic" {
pub const build_options = @import("build_options");
pub const bun = @import("./bun.zig");
+
+comptime {
+ _ = @import("compiler_rt");
+}