Files
ghostty/src/build/GhosttyWebdata.zig
Chris Marchesi e8525c0fd9 Update to Zig 0.16.0
This commit represents the majority of the work necessary to upgrade
Ghostty to use Zig 0.16.0.

Key parts:

* In addition to its previous responsibilities, the global state now
  houses state for global I/O implementations and the process
  environment. It is now also utilized in the main application along
  with the C library. Where necessary, global state is isolated from key
  parts of the implementation (e.g., in libghostty subsystems), and it's
  expected that this list will grow.

* We currently manage our own C translation layer where necessary. In
  these cases, cImport has been removed in favor of the new external
  translate-c package. Due to fixes that have needed be made to properly
  translate the dependencies that were swapped out, as mentioned, we
  have had to backport fixes from the current translate-c package (and
  the upstream Arocc dependency). We will host this ourselves until Zig
  0.17.0 is released with these fixes.

* Where necessary (only a small number of cases), some stdlib code from
  0.15.2 (and even from 0.17.0) has been taken, adopted, and vendored in
  lib/compat.

Co-authored-by: Leah Amelia Chen <hi@pluie.me>
2026-07-21 12:35:05 -07:00

120 lines
3.7 KiB
Zig

//! 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 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) = .empty;
errdefer steps.deinit(b.allocator);
{
const webgen_config = b.addExecutable(.{
.name = "webgen_config",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = b.graph.host,
.strip = false,
.omit_frame_pointer = false,
.unwind_tables = .sync,
}),
});
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.allocator, &b.addInstallFile(
webgen_config_out,
"share/ghostty/webdata/config.mdx",
).step);
}
{
const webgen_actions = b.addExecutable(.{
.name = "webgen_actions",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = b.graph.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.allocator, &b.addInstallFile(
webgen_actions_out,
"share/ghostty/webdata/actions.mdx",
).step);
}
{
const webgen_commands = b.addExecutable(.{
.name = "webgen_commands",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = b.graph.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.allocator, &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);
}