Maker: lower -target arguments

This commit is contained in:
Andrew Kelley
2026-05-19 16:58:07 -07:00
parent 5c133c5765
commit ec65f129d8
2 changed files with 6 additions and 120 deletions
-114
View File
@@ -1,114 +0,0 @@
* Run step getting wrong path_directory values
* double check when targets get resolved (should be at configure time)
* finish migrating the rest of the build steps
* pass overridden pkg-dir to maker
* inspect b4ffb402c082605c4b324e88120306fc8fb3cf32 diff and apply changes as needed (merge conflict)
* make zig-pkg path root configurable in maker (make sure --system still works)
* eliminate calls to getPath, getPath2, getPath3
* test lazyImport
* get zig tests passing
* solve the TODOs added in this branch
* test a bunch of third party projects / help people migrate
* tetris
* [handle missing cache hits when chaining two run steps](https://codeberg.org/ziglang/zig/pulls/30762)
* [Absolute and cwd-relative paths in build cache](https://codeberg.org/ziglang/zig/issues/32097)
* implement {q} or delete {q} uses
* make the generated dependencies.zig be dependencies.zon and don't put absolute paths in there
- and adjust dependencyInner to not openDir()
* re-evaluate https://codeberg.org/ziglang/zig/pulls/35224
## Followup Issues
* make more stuff use IndexType
* make addExtra return Index using reflection
* refactor with DefaultingEnum
* get the target from the parent process instead
* stop leaking into global process arena
* reduce the size of Maker.Step.Extended (make Run smaller) probably by using an arena per make
* link_eh_frame_hdr should be DefaultingBool
* make --foo, --no-foo CLI args uniform (make them -f args instead)
* install steps should provide generated files for installed things, then delete the run step hack
- but artifact install steps also add paths for dyn libs on windows
* no more "artifact arg" to run step. if you want to run the post-install binary, get the lazy path
from the install step.
* fmt step: import zig fmt code directly rather than child proc
* UpdateSourceFiles: introduce Group
* WriteFiles: introduce Group
* re-examine the use case of adding file paths to Options steps
* extract the reusable Configure abstractions and reuse it for Zir etc
* add the ability to delete files to UpdateSourceFiles
## Already Filed Followup Issues
* build system fmt step with check=false does not acquire a write lock on source files #35204
* enhance CheckFile step output when there is not a match #35208
* missing truncate functionality #35353
## Release Notes
### Run Step: Passthru Args
In the Run step, passthru args are all together now, not observable in
configure phase whether run args are provided.
```zig
if (b.args) |args| {
run_cmd.addArgs(args);
}
```
⬇️
```zig
run_cmd.addPassthruArgs();
```
This removes a capability from build scripts since they can no longer observe
those arguments. In exchange, it means that when changing those arguments,
build scripts no longer must be rebuilt from source.
closes #31397
### Fmt Step: Options
`paths` and `exclude_paths` are now LazyPath lists. There is a convenience method to create them: `b.pathList`.
```diff
- const fmt_include_paths = &.{ "lib", "src", "test", "tools", "build.zig", "build.zig.zon" };
- const fmt_exclude_paths = &.{ "test/cases", "test/behavior/zon" };
+ const fmt_include_paths = b.pathList(&.{ "lib", "src", "test", "tools", "build.zig", "build.zig.zon" });
+ const fmt_exclude_paths = b.pathList(&.{ "test/cases", "test/behavior/zon" });
```
### std.Build API
* `b.build_root` (Directory) -> `b.root` (Path)
* `ConfigHeader.Options`: `include_guard_override` -> `include_guard`
* `LazyPath`: `getDisplayName` -> `format` or `fmt`
* `LazyPath.basename` no longer takes parameters. The returned basename might
be unknown until make phase in which case returned string is length zero.
### Perf Data Point: `zig build -h` (cached)
```
Benchmark 1 (34 runs): master/zig build -h
measurement mean ± σ min … max outliers delta
wall_time 150ms ± 5.52ms 145ms … 165ms 4 (12%) 0%
peak_rss 84.8MB ± 275KB 84.2MB … 85.1MB 0 ( 0%) 0%
cpu_cycles 593M ± 4.01M 588M … 608M 2 ( 6%) 0%
instructions 995M ± 52.5K 995M … 995M 0 ( 0%) 0%
cache_references 25.8M ± 165K 25.4M … 26.1M 0 ( 0%) 0%
cache_misses 651K ± 20.1K 619K … 697K 0 ( 0%) 0%
branch_misses 918K ± 7.44K 906K … 935K 0 ( 0%) 0%
Benchmark 2 (348 runs): branch/zig build -h
measurement mean ± σ min … max outliers delta
wall_time 14.3ms ± 744us 13.2ms … 23.3ms 8 ( 2%) ⚡- 90.4% ± 0.4%
peak_rss 78.5MB ± 562KB 77.1MB … 81.4MB 7 ( 2%) ⚡- 7.4% ± 0.2%
cpu_cycles 24.1M ± 821K 22.8M … 27.1M 3 ( 1%) ⚡- 95.9% ± 0.1%
instructions 43.7M ± 23.8K 43.7M … 43.8M 56 (16%) ⚡- 95.6% ± 0.0%
cache_references 1.46M ± 14.6K 1.40M … 1.50M 19 ( 5%) ⚡- 94.3% ± 0.1%
cache_misses 142K ± 4.87K 127K … 157K 2 ( 1%) ⚡- 78.1% ± 0.4%
branch_misses 126K ± 1.37K 120K … 129K 12 ( 3%) ⚡- 86.3% ± 0.1%
```
+6 -6
View File
@@ -1274,21 +1274,21 @@ fn appendModuleFlags(
if (m.resolved_target.get(conf)) |target| {
// Communicate the query via CLI since it's more compact.
if (target.query.get(conf)) |query| {
if (target.query.get(conf)) |compact_query| {
try zig_args.ensureUnusedCapacity(gpa, 6);
if (true) @panic("TODO appendModuleFlags");
const query = compact_query.unwrap(conf);
zig_args.appendAssumeCapacity("-target");
zig_args.appendAssumeCapacity(try query.zigTriple(arena));
zig_args.appendAssumeCapacity("-mcpu");
zig_args.appendAssumeCapacity(try query.serializeCpuAlloc(arena));
if (query.dynamic_linker) |dynamic_linker| {
const dynamic_linker_slice = dynamic_linker.slice(conf);
if (dynamic_linker_slice.len != 0) {
if (query.dynamic_linker) |*dynamic_linker| {
if (dynamic_linker.get()) |dynamic_linker_path| {
zig_args.appendAssumeCapacity("--dynamic-linker");
zig_args.appendAssumeCapacity(dynamic_linker_slice);
zig_args.appendAssumeCapacity(dynamic_linker_path);
} else {
zig_args.appendAssumeCapacity("--no-dynamic-linker");
}