forked from ghostty-org/ghostty
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGhosttyWebdata.zig
More file actions
111 lines (91 loc) · 3.35 KB
/
GhosttyWebdata.zig
File metadata and controls
111 lines (91 loc) · 3.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//! GhosttyWebdata generates all the Ghostty website data that is
//! merged with the website for things like config references.
const GhosttyWebdata = @This();
const std = @import("std");
const Config = @import("Config.zig");
const SharedDeps = @import("SharedDeps.zig");
steps: []*std.Build.Step,
pub fn init(
b: *std.Build,
deps: *const SharedDeps,
) !GhosttyWebdata {
var steps = std.ArrayList(*std.Build.Step).init(b.allocator);
errdefer steps.deinit();
{
const webgen_config = b.addExecutable(.{
.name = "webgen_config",
.root_source_file = b.path("src/main.zig"),
.target = b.host,
});
deps.help_strings.addImport(webgen_config);
{
const buildconfig = config: {
var copy = deps.config.*;
copy.exe_entrypoint = .webgen_config;
break :config copy;
};
const options = b.addOptions();
try buildconfig.addOptions(options);
webgen_config.root_module.addOptions("build_options", options);
}
const webgen_config_step = b.addRunArtifact(webgen_config);
const webgen_config_out = webgen_config_step.captureStdOut();
try steps.append(&b.addInstallFile(
webgen_config_out,
"share/ghostty/webdata/config.mdx",
).step);
}
{
const webgen_actions = b.addExecutable(.{
.name = "webgen_actions",
.root_source_file = b.path("src/main.zig"),
.target = b.host,
});
deps.help_strings.addImport(webgen_actions);
{
const buildconfig = config: {
var copy = deps.config.*;
copy.exe_entrypoint = .webgen_actions;
break :config copy;
};
const options = b.addOptions();
try buildconfig.addOptions(options);
webgen_actions.root_module.addOptions("build_options", options);
}
const webgen_actions_step = b.addRunArtifact(webgen_actions);
const webgen_actions_out = webgen_actions_step.captureStdOut();
try steps.append(&b.addInstallFile(
webgen_actions_out,
"share/ghostty/webdata/actions.mdx",
).step);
}
{
const webgen_commands = b.addExecutable(.{
.name = "webgen_commands",
.root_source_file = b.path("src/main.zig"),
.target = b.host,
});
deps.help_strings.addImport(webgen_commands);
{
const buildconfig = config: {
var copy = deps.config.*;
copy.exe_entrypoint = .webgen_commands;
break :config copy;
};
const options = b.addOptions();
try buildconfig.addOptions(options);
webgen_commands.root_module.addOptions("build_options", options);
}
const webgen_commands_step = b.addRunArtifact(webgen_commands);
const webgen_commands_out = webgen_commands_step.captureStdOut();
try steps.append(&b.addInstallFile(
webgen_commands_out,
"share/ghostty/webdata/commands.mdx",
).step);
}
return .{ .steps = steps.items };
}
pub fn install(self: *const GhosttyWebdata) void {
const b = self.steps[0].owner;
for (self.steps) |step| b.getInstallStep().dependOn(step);
}