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(...@@ -177,9 +177,6 @@ pub fn make(
177 man.hash.addListOfBytes(run_args);177 man.hash.addListOfBytes(run_args);
178 }178 }
179 },179 },
180 .cc_args => {
181 @panic("TODO Run make cc_args");
182 },
183 }180 }
184 }181 }
185182
lib/compiler/configurer.zig-45
...@@ -313,8 +313,6 @@ const Serialize = struct {...@@ -313,8 +313,6 @@ const Serialize = struct {
313 .producer = true,313 .producer = true,
314 .generated = false,314 .generated = false,
315 .dep_file = false,315 .dep_file = false,
316 .target_query = false,
317 .link_libc = false,
318 },316 },
319 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },317 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
320 .suffix = .{ .value = null },318 .suffix = .{ .value = null },
...@@ -322,7 +320,6 @@ const Serialize = struct {...@@ -322,7 +320,6 @@ const Serialize = struct {
322 .path = .{ .value = null },320 .path = .{ .value = null },
323 .producer = .{ .value = stepIndex(s, &a.artifact.step) },321 .producer = .{ .value = stepIndex(s, &a.artifact.step) },
324 .generated = .{ .value = null },322 .generated = .{ .value = null },
325 .target_query = .{ .value = null },
326 },323 },
327 .lazy_path => |a| .{324 .lazy_path => |a| .{
328 .flags = .{325 .flags = .{
...@@ -334,8 +331,6 @@ const Serialize = struct {...@@ -334,8 +331,6 @@ const Serialize = struct {
334 .producer = false,331 .producer = false,
335 .generated = false,332 .generated = false,
336 .dep_file = false,333 .dep_file = false,
337 .target_query = false,
338 .link_libc = false,
339 },334 },
340 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },335 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
341 .suffix = .{ .value = null },336 .suffix = .{ .value = null },
...@@ -343,7 +338,6 @@ const Serialize = struct {...@@ -343,7 +338,6 @@ const Serialize = struct {
343 .path = .{ .value = try addLazyPath(s, a.lazy_path) },338 .path = .{ .value = try addLazyPath(s, a.lazy_path) },
344 .producer = .{ .value = null },339 .producer = .{ .value = null },
345 .generated = .{ .value = null },340 .generated = .{ .value = null },
346 .target_query = .{ .value = null },
347 },341 },
348 .decorated_directory => |a| .{342 .decorated_directory => |a| .{
349 .flags = .{343 .flags = .{
...@@ -355,8 +349,6 @@ const Serialize = struct {...@@ -355,8 +349,6 @@ const Serialize = struct {
355 .producer = false,349 .producer = false,
356 .generated = false,350 .generated = false,
357 .dep_file = false,351 .dep_file = false,
358 .target_query = false,
359 .link_libc = false,
360 },352 },
361 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },353 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
362 .suffix = .{ .value = if (a.suffix.len != 0) try wc.addString(a.suffix) else null },354 .suffix = .{ .value = if (a.suffix.len != 0) try wc.addString(a.suffix) else null },
...@@ -364,7 +356,6 @@ const Serialize = struct {...@@ -364,7 +356,6 @@ const Serialize = struct {
364 .path = .{ .value = try addLazyPath(s, a.lazy_path) },356 .path = .{ .value = try addLazyPath(s, a.lazy_path) },
365 .producer = .{ .value = null },357 .producer = .{ .value = null },
366 .generated = .{ .value = null },358 .generated = .{ .value = null },
367 .target_query = .{ .value = null },
368 },359 },
369 .file_content => |a| .{360 .file_content => |a| .{
370 .flags = .{361 .flags = .{
...@@ -376,8 +367,6 @@ const Serialize = struct {...@@ -376,8 +367,6 @@ const Serialize = struct {
376 .producer = false,367 .producer = false,
377 .generated = false,368 .generated = false,
378 .dep_file = false,369 .dep_file = false,
379 .target_query = false,
380 .link_libc = false,
381 },370 },
382 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },371 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
383 .suffix = .{ .value = null },372 .suffix = .{ .value = null },
...@@ -385,7 +374,6 @@ const Serialize = struct {...@@ -385,7 +374,6 @@ const Serialize = struct {
385 .path = .{ .value = try addLazyPath(s, a.lazy_path) },374 .path = .{ .value = try addLazyPath(s, a.lazy_path) },
386 .producer = .{ .value = null },375 .producer = .{ .value = null },
387 .generated = .{ .value = null },376 .generated = .{ .value = null },
388 .target_query = .{ .value = null },
389 },377 },
390 .bytes => |a| .{378 .bytes => |a| .{
391 .flags = .{379 .flags = .{
...@@ -397,8 +385,6 @@ const Serialize = struct {...@@ -397,8 +385,6 @@ const Serialize = struct {
397 .producer = false,385 .producer = false,
398 .generated = false,386 .generated = false,
399 .dep_file = false,387 .dep_file = false,
400 .target_query = false,
401 .link_libc = false,
402 },388 },
403 .prefix = .{ .value = try wc.addString(a) },389 .prefix = .{ .value = try wc.addString(a) },
404 .suffix = .{ .value = null },390 .suffix = .{ .value = null },
...@@ -406,7 +392,6 @@ const Serialize = struct {...@@ -406,7 +392,6 @@ const Serialize = struct {
406 .path = .{ .value = null },392 .path = .{ .value = null },
407 .producer = .{ .value = null },393 .producer = .{ .value = null },
408 .generated = .{ .value = null },394 .generated = .{ .value = null },
409 .target_query = .{ .value = null },
410 },395 },
411 .output_file, .output_file_dep => |a, tag| .{396 .output_file, .output_file_dep => |a, tag| .{
412 .flags = .{397 .flags = .{
...@@ -418,8 +403,6 @@ const Serialize = struct {...@@ -418,8 +403,6 @@ const Serialize = struct {
418 .producer = false,403 .producer = false,
419 .generated = true,404 .generated = true,
420 .dep_file = tag == .output_file_dep,405 .dep_file = tag == .output_file_dep,
421 .target_query = false,
422 .link_libc = false,
423 },406 },
424 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },407 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
425 .suffix = .{ .value = null },408 .suffix = .{ .value = null },
...@@ -427,7 +410,6 @@ const Serialize = struct {...@@ -427,7 +410,6 @@ const Serialize = struct {
427 .path = .{ .value = null },410 .path = .{ .value = null },
428 .producer = .{ .value = null },411 .producer = .{ .value = null },
429 .generated = .{ .value = a.generated_file },412 .generated = .{ .value = a.generated_file },
430 .target_query = .{ .value = null },
431 },413 },
432 .output_directory => |a| .{414 .output_directory => |a| .{
433 .flags = .{415 .flags = .{
...@@ -439,8 +421,6 @@ const Serialize = struct {...@@ -439,8 +421,6 @@ const Serialize = struct {
439 .producer = false,421 .producer = false,
440 .generated = true,422 .generated = true,
441 .dep_file = false,423 .dep_file = false,
442 .target_query = false,
443 .link_libc = false,
444 },424 },
445 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },425 .prefix = .{ .value = if (a.prefix.len != 0) try wc.addString(a.prefix) else null },
446 .suffix = .{ .value = null },426 .suffix = .{ .value = null },
...@@ -448,7 +428,6 @@ const Serialize = struct {...@@ -448,7 +428,6 @@ const Serialize = struct {
448 .path = .{ .value = null },428 .path = .{ .value = null },
449 .producer = .{ .value = null },429 .producer = .{ .value = null },
450 .generated = .{ .value = a.generated_file },430 .generated = .{ .value = a.generated_file },
451 .target_query = .{ .value = null },
452 },431 },
453 .passthru => .{432 .passthru => .{
454 .flags = .{433 .flags = .{
...@@ -460,8 +439,6 @@ const Serialize = struct {...@@ -460,8 +439,6 @@ const Serialize = struct {
460 .producer = false,439 .producer = false,
461 .generated = false,440 .generated = false,
462 .dep_file = false,441 .dep_file = false,
463 .target_query = false,
464 .link_libc = false,
465 },442 },
466 .prefix = .{ .value = null },443 .prefix = .{ .value = null },
467 .suffix = .{ .value = null },444 .suffix = .{ .value = null },
...@@ -469,28 +446,6 @@ const Serialize = struct {...@@ -469,28 +446,6 @@ const Serialize = struct {
469 .path = .{ .value = null },446 .path = .{ .value = null },
470 .producer = .{ .value = null },447 .producer = .{ .value = null },
471 .generated = .{ .value = null },448 .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() },
494 },449 },
495 });450 });
496 }451 }
lib/std/Build/Configuration.zig+1-5
...@@ -586,7 +586,6 @@ pub const Step = extern struct {...@@ -586,7 +586,6 @@ pub const Step = extern struct {
586 /// Always a compile step.586 /// Always a compile step.
587 producer: Storage.FlagOptional(.flags, .producer, Step.Index),587 producer: Storage.FlagOptional(.flags, .producer, Step.Index),
588 generated: Storage.FlagOptional(.flags, .generated, GeneratedFileIndex),588 generated: Storage.FlagOptional(.flags, .generated, GeneratedFileIndex),
589 target_query: Storage.FlagOptional(.flags, .target_query, TargetQuery.Index),
590589
591 pub const Flags = packed struct(u32) {590 pub const Flags = packed struct(u32) {
592 tag: Arg.Tag,591 tag: Arg.Tag,
...@@ -597,9 +596,7 @@ pub const Step = extern struct {...@@ -597,9 +596,7 @@ pub const Step = extern struct {
597 producer: bool,596 producer: bool,
598 generated: bool,597 generated: bool,
599 dep_file: bool,598 dep_file: bool,
600 target_query: bool,599 _: u21 = 0,
601 link_libc: bool,
602 _: u19 = 0,
603 };600 };
604601
605 pub const Tag = enum(u4) {602 pub const Tag = enum(u4) {
...@@ -613,7 +610,6 @@ pub const Step = extern struct {...@@ -613,7 +610,6 @@ pub const Step = extern struct {
613 output_file,610 output_file,
614 output_directory,611 output_directory,
615 passthru,612 passthru,
616 cc_args,
617 };613 };
618614
619 pub const Index = IndexType(@This());615 pub const Index = IndexType(@This());
lib/std/Build/Step/Run.zig-23
...@@ -143,13 +143,6 @@ pub const Arg = union(enum) {...@@ -143,13 +143,6 @@ pub const Arg = union(enum) {
143 output_directory: *Output,143 output_directory: *Output,
144 /// The arguments passed after "--" on the "zig build" CLI.144 /// The arguments passed after "--" on the "zig build" CLI.
145 passthru,145 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,
153};146};
154147
155pub const PrefixedArtifact = struct {148pub const PrefixedArtifact = struct {
...@@ -536,22 +529,6 @@ pub fn addPassthruArgs(run: *Run) void {...@@ -536,22 +529,6 @@ pub fn addPassthruArgs(run: *Run) void {
536 run.argv.append(arena, .passthru) catch @panic("OOM");529 run.argv.append(arena, .passthru) catch @panic("OOM");
537}530}
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
555pub fn setStdIn(run: *Run, stdin: StdIn) void {532pub fn setStdIn(run: *Run, stdin: StdIn) void {
556 switch (stdin) {533 switch (stdin) {
557 .lazy_path => |lazy_path| lazy_path.addStepDependencies(&run.step),534 .lazy_path => |lazy_path| lazy_path.addStepDependencies(&run.step),