authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-20 21:12:01-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-25 18:54:36-07:00
loga874e729df771c23576e8fcab9d58e45a20dc1bd
treefc0f9399d225e78c9089833f72d694bc9510a31f
parent996b4118097c747e65ef1127091f7e48a54bfafc

zig build: remove "cc args" from Run steps

Not sure what I was thinking. This is silly, translate-c package simply needs to pass this data (link_libc and target) to the CLI application, which can then do the appropriate behavior.

4 files changed, 1 insertions(+), 76 deletions(-)

lib/compiler/Maker/Step/Run.zig-3
......@@ -177,9 +177,6 @@ pub fn make(
177177 man.hash.addListOfBytes(run_args);
178178 }
179179 },
180 .cc_args => {
181 @panic("TODO Run make cc_args");
182 },
183180 }
184181 }
185182
lib/compiler/configurer.zig-45
......@@ -313,8 +313,6 @@ const Serialize = struct {
313313 .producer = true,
314314 .generated = false,
315315 .dep_file = false,
316 .target_query = false,
317 .link_libc = false,
318316 },
319317 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
320318 .suffix = .{ .value = null },
......@@ -322,7 +320,6 @@ const Serialize = struct {
322320 .path = .{ .value = null },
323321 .producer = .{ .value = stepIndex(s, &a.artifact.step) },
324322 .generated = .{ .value = null },
325 .target_query = .{ .value = null },
326323 },
327324 .lazy_path => |a| .{
328325 .flags = .{
......@@ -334,8 +331,6 @@ const Serialize = struct {
334331 .producer = false,
335332 .generated = false,
336333 .dep_file = false,
337 .target_query = false,
338 .link_libc = false,
339334 },
340335 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
341336 .suffix = .{ .value = null },
......@@ -343,7 +338,6 @@ const Serialize = struct {
343338 .path = .{ .value = try addLazyPath(s, a.lazy_path) },
344339 .producer = .{ .value = null },
345340 .generated = .{ .value = null },
346 .target_query = .{ .value = null },
347341 },
348342 .decorated_directory => |a| .{
349343 .flags = .{
......@@ -355,8 +349,6 @@ const Serialize = struct {
355349 .producer = false,
356350 .generated = false,
357351 .dep_file = false,
358 .target_query = false,
359 .link_libc = false,
360352 },
361353 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
362354 .suffix = .{ .value = if (a.suffix.len != 0) try wc.addString(a.suffix) else null },
......@@ -364,7 +356,6 @@ const Serialize = struct {
364356 .path = .{ .value = try addLazyPath(s, a.lazy_path) },
365357 .producer = .{ .value = null },
366358 .generated = .{ .value = null },
367 .target_query = .{ .value = null },
368359 },
369360 .file_content => |a| .{
370361 .flags = .{
......@@ -376,8 +367,6 @@ const Serialize = struct {
376367 .producer = false,
377368 .generated = false,
378369 .dep_file = false,
379 .target_query = false,
380 .link_libc = false,
381370 },
382371 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
383372 .suffix = .{ .value = null },
......@@ -385,7 +374,6 @@ const Serialize = struct {
385374 .path = .{ .value = try addLazyPath(s, a.lazy_path) },
386375 .producer = .{ .value = null },
387376 .generated = .{ .value = null },
388 .target_query = .{ .value = null },
389377 },
390378 .bytes => |a| .{
391379 .flags = .{
......@@ -397,8 +385,6 @@ const Serialize = struct {
397385 .producer = false,
398386 .generated = false,
399387 .dep_file = false,
400 .target_query = false,
401 .link_libc = false,
402388 },
403389 .prefix = .{ .value = try wc.addString(a) },
404390 .suffix = .{ .value = null },
......@@ -406,7 +392,6 @@ const Serialize = struct {
406392 .path = .{ .value = null },
407393 .producer = .{ .value = null },
408394 .generated = .{ .value = null },
409 .target_query = .{ .value = null },
410395 },
411396 .output_file, .output_file_dep => |a, tag| .{
412397 .flags = .{
......@@ -418,8 +403,6 @@ const Serialize = struct {
418403 .producer = false,
419404 .generated = true,
420405 .dep_file = tag == .output_file_dep,
421 .target_query = false,
422 .link_libc = false,
423406 },
424407 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
425408 .suffix = .{ .value = null },
......@@ -427,7 +410,6 @@ const Serialize = struct {
427410 .path = .{ .value = null },
428411 .producer = .{ .value = null },
429412 .generated = .{ .value = a.generated_file },
430 .target_query = .{ .value = null },
431413 },
432414 .output_directory => |a| .{
433415 .flags = .{
......@@ -439,8 +421,6 @@ const Serialize = struct {
439421 .producer = false,
440422 .generated = true,
441423 .dep_file = false,
442 .target_query = false,
443 .link_libc = false,
444424 },
445425 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
446426 .suffix = .{ .value = null },
......@@ -448,7 +428,6 @@ const Serialize = struct {
448428 .path = .{ .value = null },
449429 .producer = .{ .value = null },
450430 .generated = .{ .value = a.generated_file },
451 .target_query = .{ .value = null },
452431 },
453432 .passthru => .{
454433 .flags = .{
......@@ -460,8 +439,6 @@ const Serialize = struct {
460439 .producer = false,
461440 .generated = false,
462441 .dep_file = false,
463 .target_query = false,
464 .link_libc = false,
465442 },
466443 .prefix = .{ .value = null },
467444 .suffix = .{ .value = null },
......@@ -469,28 +446,6 @@ const Serialize = struct {
469446 .path = .{ .value = null },
470447 .producer = .{ .value = null },
471448 .generated = .{ .value = null },
472 .target_query = .{ .value = null },
473 },
474 .cc_args => |a| .{
475 .flags = .{
476 .tag = .cc_args,
477 .prefix = false,
478 .suffix = false,
479 .basename = false,
480 .path = false,
481 .producer = false,
482 .generated = false,
483 .dep_file = false,
484 .target_query = a.target_query != .none,
485 .link_libc = a.link_libc,
486 },
487 .prefix = .{ .value = null },
488 .suffix = .{ .value = null },
489 .basename = .{ .value = null },
490 .path = .{ .value = null },
491 .producer = .{ .value = null },
492 .generated = .{ .value = null },
493 .target_query = .{ .value = a.target_query.unwrap() },
494449 },
495450 });
496451 }
lib/std/Build/Configuration.zig+1-5
......@@ -586,7 +586,6 @@ pub const Step = extern struct {
586586 /// Always a compile step.
587587 producer: Storage.FlagOptional(.flags, .producer, Step.Index),
588588 generated: Storage.FlagOptional(.flags, .generated, GeneratedFileIndex),
589 target_query: Storage.FlagOptional(.flags, .target_query, TargetQuery.Index),
590589
591590 pub const Flags = packed struct(u32) {
592591 tag: Arg.Tag,
......@@ -597,9 +596,7 @@ pub const Step = extern struct {
597596 producer: bool,
598597 generated: bool,
599598 dep_file: bool,
600 target_query: bool,
601 link_libc: bool,
602 _: u19 = 0,
599 _: u21 = 0,
603600 };
604601
605602 pub const Tag = enum(u4) {
......@@ -613,7 +610,6 @@ pub const Step = extern struct {
613610 output_file,
614611 output_directory,
615612 passthru,
616 cc_args,
617613 };
618614
619615 pub const Index = IndexType(@This());
lib/std/Build/Step/Run.zig-23
......@@ -143,13 +143,6 @@ pub const Arg = union(enum) {
143143 output_directory: *Output,
144144 /// The arguments passed after "--" on the "zig build" CLI.
145145 passthru,
146 /// Adds standard "-isystem" and "-iframework" arguments corresponding to the libc of the target.
147 cc_args: CcArgs,
148};
149
150pub const CcArgs = struct {
151 link_libc: bool,
152 target_query: Configuration.TargetQuery.OptionalIndex,
153146};
154147
155148pub const PrefixedArtifact = struct {
......@@ -536,22 +529,6 @@ pub fn addPassthruArgs(run: *Run) void {
536529 run.argv.append(arena, .passthru) catch @panic("OOM");
537530}
538531
539pub const AddCcArgs = struct {
540 link_libc: bool = false,
541 target_query: ?*const std.Target.Query = null,
542};
543
544/// Appends C compiler flags for the target and for including libc.
545pub fn addCcArgs(run: *Run, options: AddCcArgs) void {
546 const graph = run.step.owner.graph;
547 const arena = graph.arena;
548 const wc = &graph.wip_configuration;
549 run.argv.append(arena, .{ .cc_args = .{
550 .link_libc = options.link_libc,
551 .target_query = if (options.target_query) |q| wc.addTargetQuery(q) catch @panic("OOM") else .none,
552 } }) catch @panic("OOM");
553}
554
555532pub fn setStdIn(run: *Run, stdin: StdIn) void {
556533 switch (stdin) {
557534 .lazy_path => |lazy_path| lazy_path.addStepDependencies(&run.step),