authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2022-10-31 22:30:34-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2022-11-01 20:38:37-04:00
log757db665a79d7885d1c8f83df65a25adc7af9a69
tree402a2b41204af488a1b68e97123452ac881531bb
parent93d60d0de76e5dca666682e51589c0819eed2507

build: remove `ofmt` from `LibExeObjStep` which is redundant with `target.ofmt`


3 files changed, 9 insertions(+), 8 deletions(-)

build.zig+5-5
......@@ -17,7 +17,7 @@ pub fn build(b: *Builder) !void {
1717 b.setPreferredReleaseMode(.ReleaseFast);
1818 const test_step = b.step("test", "Run all the tests");
1919 const mode = b.standardReleaseOptions();
20 const target = b.standardTargetOptions(.{});
20 var target = b.standardTargetOptions(.{});
2121 const single_threaded = b.option(bool, "single-threaded", "Build artifacts that run in single threaded mode");
2222 const use_zig_libcxx = b.option(bool, "use-zig-libcxx", "If libc++ is needed, use zig's bundled version, don't try to integrate with the system") orelse false;
2323
......@@ -141,6 +141,10 @@ pub fn build(b: *Builder) !void {
141141 break :blk 4;
142142 };
143143
144 if (only_c) {
145 target.ofmt = .c;
146 }
147
144148 const main_file: ?[]const u8 = mf: {
145149 if (!have_stage1) break :mf "src/main.zig";
146150 if (use_zig0) break :mf null;
......@@ -172,10 +176,6 @@ pub fn build(b: *Builder) !void {
172176 test_cases.want_lto = false;
173177 }
174178
175 if (only_c) {
176 exe.ofmt = .c;
177 }
178
179179 const exe_options = b.addOptions();
180180 exe.addOptions("build_options", exe_options);
181181
lib/std/build.zig+1-2
......@@ -1622,7 +1622,6 @@ pub const LibExeObjStep = struct {
16221622 use_stage1: ?bool = null,
16231623 use_llvm: ?bool = null,
16241624 use_lld: ?bool = null,
1625 ofmt: ?std.Target.ObjectFormat = null,
16261625
16271626 output_path_source: GeneratedFile,
16281627 output_lib_path_source: GeneratedFile,
......@@ -2490,7 +2489,7 @@ pub const LibExeObjStep = struct {
24902489 }
24912490 }
24922491
2493 if (self.ofmt) |ofmt| {
2492 if (self.target.ofmt) |ofmt| {
24942493 try zig_args.append(try std.fmt.allocPrint(builder.allocator, "-ofmt={s}", .{@tagName(ofmt)}));
24952494 }
24962495
test/tests.zig+3-1
......@@ -52,6 +52,9 @@ const test_targets = blk: {
5252 },
5353
5454 .{
55 .target = .{
56 .ofmt = .c,
57 },
5558 .link_libc = true,
5659 .backend = .stage2_c,
5760 },
......@@ -720,7 +723,6 @@ pub fn addPkgTests(
720723 .stage2_c => {
721724 these_tests.use_stage1 = false;
722725 these_tests.use_llvm = false;
723 these_tests.ofmt = .c;
724726 },
725727 else => {
726728 these_tests.use_stage1 = false;