diff options
author | 2023-10-14 12:58:30 -0700 | |
---|---|---|
committer | 2023-10-14 12:58:30 -0700 | |
commit | f9add8b6bea4df3cdbd56a21f17e4cab1a854e4e (patch) | |
tree | 8e5306104d81c67b771181337bba02cd9ec39453 /build.zig | |
parent | 81a1a58d66c598ea35c42453d0ba4c6341a940fc (diff) | |
parent | 9b5e66453b0879ed77b71dcdbe50e4efa184261e (diff) | |
download | bun-f9add8b6bea4df3cdbd56a21f17e4cab1a854e4e.tar.gz bun-f9add8b6bea4df3cdbd56a21f17e4cab1a854e4e.tar.zst bun-f9add8b6bea4df3cdbd56a21f17e4cab1a854e4e.zip |
Merge branch 'main' into sdlsdl
Diffstat (limited to 'build.zig')
-rw-r--r-- | build.zig | 38 |
1 files changed, 27 insertions, 11 deletions
@@ -1,3 +1,5 @@ +const required_zig_version = "0.12.0-dev.888+130227491"; + const std = @import("std"); const pathRel = std.fs.path.relative; const Wyhash = @import("./src/wyhash.zig").Wyhash; @@ -147,6 +149,20 @@ pub fn build(b: *Build) !void { } pub fn build_(b: *Build) !void { + if (!std.mem.eql(u8, @import("builtin").zig_version_string, required_zig_version)) { + const colors = std.io.getStdErr().supportsAnsiEscapeCodes(); + std.debug.print( + "{s}WARNING:\nBun requires zig version '{s}', but found '{s}', build may fail...\nMake sure you installed the right version as per https://bun.sh/docs/project/development#install-zig\n{s}You can update to the right version using 'zigup {s}'\n\n", + .{ + if (colors) "\x1b[1;33m" else "", + required_zig_version, + @import("builtin").zig_version_string, + if (colors) "\x1b[0m" else "", + required_zig_version, + }, + ); + } + // Standard target options allows the person running `zig build` to choose // what target to build for. Here we do not override the defaults, which // means any target is allowed, and the default is native. Other options @@ -218,7 +234,7 @@ pub fn build_(b: *Build) !void { .root_source_file = FileSource.relative(root_src), .target = target, .optimize = optimize, - .main_pkg_path = .{ .cwd_relative = b.pathFromRoot(".") }, + .main_mod_path = .{ .cwd_relative = b.pathFromRoot(".") }, }); obj.addIncludePath(LazyPath.relative("./src/deps/SDL/include")); @@ -334,7 +350,7 @@ pub fn build_(b: *Build) !void { .root_source_file = FileSource.relative("src/bindgen.zig"), .target = target, .optimize = optimize, - .main_pkg_path = obj.main_pkg_path, + .main_mod_path = obj.main_mod_path, }); defer headers_step.dependOn(&headers_obj.step); try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target); @@ -351,7 +367,7 @@ pub fn build_(b: *Build) !void { .root_source_file = FileSource.relative("root_wasm.zig"), .target = target, .optimize = optimize, - .main_pkg_path = obj.main_pkg_path, + .main_mod_path = obj.main_mod_path, }); defer wasm_step.dependOn(&wasm.step); wasm.strip = false; @@ -370,7 +386,7 @@ pub fn build_(b: *Build) !void { .root_source_file = FileSource.relative("misctools/http_bench.zig"), .target = target, .optimize = optimize, - .main_pkg_path = obj.main_pkg_path, + .main_mod_path = obj.main_mod_path, }); defer headers_step.dependOn(&headers_obj.step); try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target); @@ -384,7 +400,7 @@ pub fn build_(b: *Build) !void { .root_source_file = FileSource.relative("misctools/machbench.zig"), .target = target, .optimize = optimize, - .main_pkg_path = obj.main_pkg_path, + .main_mod_path = obj.main_mod_path, }); defer headers_step.dependOn(&headers_obj.step); try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target); @@ -398,7 +414,7 @@ pub fn build_(b: *Build) !void { .root_source_file = FileSource.relative("misctools/fetch.zig"), .target = target, .optimize = optimize, - .main_pkg_path = obj.main_pkg_path, + .main_mod_path = obj.main_mod_path, }); defer headers_step.dependOn(&headers_obj.step); try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target); @@ -412,7 +428,7 @@ pub fn build_(b: *Build) !void { .root_source_file = FileSource.relative("src/bench/string-handling.zig"), .target = target, .optimize = optimize, - .main_pkg_path = obj.main_pkg_path, + .main_mod_path = obj.main_mod_path, }); defer headers_step.dependOn(&headers_obj.step); try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target); @@ -426,7 +442,7 @@ pub fn build_(b: *Build) !void { .root_source_file = FileSource.relative("src/sha.zig"), .target = target, .optimize = optimize, - .main_pkg_path = obj.main_pkg_path, + .main_mod_path = obj.main_mod_path, }); defer headers_step.dependOn(&headers_obj.step); try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target); @@ -440,7 +456,7 @@ pub fn build_(b: *Build) !void { .root_source_file = FileSource.relative("src/sourcemap/vlq_bench.zig"), .target = target, .optimize = optimize, - .main_pkg_path = obj.main_pkg_path, + .main_mod_path = obj.main_mod_path, }); defer headers_step.dependOn(&headers_obj.step); try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target); @@ -454,7 +470,7 @@ pub fn build_(b: *Build) !void { .root_source_file = FileSource.relative("misctools/tgz.zig"), .target = target, .optimize = optimize, - .main_pkg_path = obj.main_pkg_path, + .main_mod_path = obj.main_mod_path, }); defer headers_step.dependOn(&headers_obj.step); try configureObjectStep(b, headers_obj, headers_step, @TypeOf(target), target); @@ -471,7 +487,7 @@ pub fn build_(b: *Build) !void { var headers_obj: *CompileStep = b.addTest(.{ .root_source_file = FileSource.relative(test_file orelse "src/main.zig"), .target = target, - .main_pkg_path = obj.main_pkg_path, + .main_mod_path = obj.main_mod_path, }); headers_obj.filter = test_filter; if (test_bin_) |test_bin| { |