mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-09 23:29:03 +00:00
std.Build.Step.ConfigHeader: follow deprecation policy
This commit is contained in:
parent
86f35479d9
commit
e47f340e23
1 changed files with 6 additions and 3 deletions
|
|
@ -7,6 +7,9 @@ pub const Style = union(enum) {
|
||||||
/// A configure format supported by autotools that uses `#undef foo` to
|
/// A configure format supported by autotools that uses `#undef foo` to
|
||||||
/// mark lines that can be substituted with different values.
|
/// mark lines that can be substituted with different values.
|
||||||
autoconf_undef: std.Build.LazyPath,
|
autoconf_undef: std.Build.LazyPath,
|
||||||
|
/// Deprecated. Renamed to `autoconf_undef`.
|
||||||
|
/// To be removed after 0.14.0 is tagged.
|
||||||
|
autoconf: std.Build.LazyPath,
|
||||||
/// A configure format supported by autotools that uses `@FOO@` output variables.
|
/// A configure format supported by autotools that uses `@FOO@` output variables.
|
||||||
autoconf_at: std.Build.LazyPath,
|
autoconf_at: std.Build.LazyPath,
|
||||||
/// The configure format supported by CMake. It uses `@FOO@`, `${}` and
|
/// The configure format supported by CMake. It uses `@FOO@`, `${}` and
|
||||||
|
|
@ -19,7 +22,7 @@ pub const Style = union(enum) {
|
||||||
|
|
||||||
pub fn getPath(style: Style) ?std.Build.LazyPath {
|
pub fn getPath(style: Style) ?std.Build.LazyPath {
|
||||||
switch (style) {
|
switch (style) {
|
||||||
.autoconf_undef, .autoconf_at, .cmake => |s| return s,
|
.autoconf_undef, .autoconf, .autoconf_at, .cmake => |s| return s,
|
||||||
.blank, .nasm => return null,
|
.blank, .nasm => return null,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -193,7 +196,7 @@ fn make(step: *Step, options: Step.MakeOptions) !void {
|
||||||
const asm_generated_line = "; " ++ header_text ++ "\n";
|
const asm_generated_line = "; " ++ header_text ++ "\n";
|
||||||
|
|
||||||
switch (config_header.style) {
|
switch (config_header.style) {
|
||||||
.autoconf_undef, .autoconf_at => |file_source| {
|
.autoconf_undef, .autoconf, .autoconf_at => |file_source| {
|
||||||
try output.appendSlice(c_generated_line);
|
try output.appendSlice(c_generated_line);
|
||||||
const src_path = file_source.getPath2(b, step);
|
const src_path = file_source.getPath2(b, step);
|
||||||
const contents = std.fs.cwd().readFileAlloc(arena, src_path, config_header.max_bytes) catch |err| {
|
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 {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
switch (config_header.style) {
|
switch (config_header.style) {
|
||||||
.autoconf_undef => try render_autoconf_undef(step, contents, &output, config_header.values, src_path),
|
.autoconf_undef, .autoconf => try render_autoconf_undef(step, contents, &output, config_header.values, src_path),
|
||||||
.autoconf_at => try render_autoconf_at(step, contents, &output, config_header.values, src_path),
|
.autoconf_at => try render_autoconf_at(step, contents, &output, config_header.values, src_path),
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue