authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-02-23 12:45:35-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-02-23 12:45:35-08:00
loge47f340e23b44426c3d70ccbf1d2db5409ce6885
tree608feef86e2a580bf4d5a4e827bc6b5256f97522
parent86f35479d9e0e0501a55d360467bf82dd45c54f9

std.Build.Step.ConfigHeader: follow deprecation policy


1 files changed, 6 insertions(+), 3 deletions(-)

lib/std/Build/Step/ConfigHeader.zig+6-3
......@@ -7,6 +7,9 @@ pub const Style = union(enum) {
77 /// A configure format supported by autotools that uses `#undef foo` to
88 /// mark lines that can be substituted with different values.
99 autoconf_undef: std.Build.LazyPath,
10 /// Deprecated. Renamed to `autoconf_undef`.
11 /// To be removed after 0.14.0 is tagged.
12 autoconf: std.Build.LazyPath,
1013 /// A configure format supported by autotools that uses `@FOO@` output variables.
1114 autoconf_at: std.Build.LazyPath,
1215 /// The configure format supported by CMake. It uses `@FOO@`, `${}` and
......@@ -19,7 +22,7 @@ pub const Style = union(enum) {
1922
2023 pub fn getPath(style: Style) ?std.Build.LazyPath {
2124 switch (style) {
22 .autoconf_undef, .autoconf_at, .cmake => |s| return s,
25 .autoconf_undef, .autoconf, .autoconf_at, .cmake => |s| return s,
2326 .blank, .nasm => return null,
2427 }
2528 }
......@@ -193,7 +196,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
193196 const asm_generated_line = "; " ++ header_text ++ "\n";
194197
195198 switch (config_header.style) {
196 .autoconf_undef, .autoconf_at => |file_source| {
199 .autoconf_undef, .autoconf, .autoconf_at => |file_source| {
197200 try output.appendSlice(c_generated_line);
198201 const src_path = file_source.getPath2(b, step);
199202 const contents = std.fs.cwd().readFileAlloc(arena, src_path, config_header.max_bytes) catch |err| {
......@@ -202,7 +205,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
202205 });
203206 };
204207 switch (config_header.style) {
205 .autoconf_undef => try render_autoconf_undef(step, contents, &output, config_header.values, src_path),
208 .autoconf_undef, .autoconf => try render_autoconf_undef(step, contents, &output, config_header.values, src_path),
206209 .autoconf_at => try render_autoconf_at(step, contents, &output, config_header.values, src_path),
207210 else => unreachable,
208211 }