-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
40 lines (36 loc) · 1.66 KB
/
Copy pathbuild.zig
File metadata and controls
40 lines (36 loc) · 1.66 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
//! Standalone build for the ghostty plugin — the canonical third-party shape.
//! `zig build` produces `ghostty.<dylib|dll|so>`. Install with
//! `--prefix <plugins-dir>` so the host finds `ghostty.dylib`.
const std = @import("std");
const fizzy = @import("fizzy");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = fizzy.plugin.create(b, .{
.name = "ghostty",
.version = @import("build.zig.zon").version,
.target = target,
.optimize = optimize,
.root_source_file = b.path("root.zig"),
});
// libghostty-vt: VT parser + terminal state machine. Built with Zig 0.15.x in
// fizzyedit/ghostty_vt and consumed here as a normal package dependency (see
// build.zig.zon). Pick the static lib for the current target.
const ghostty_vt = b.dependency("ghostty_vt", .{});
const ghostty_vt_lib = switch (target.result.os.tag) {
.macos => "lib/macos-universal/libghostty-vt.a",
.windows => switch (target.result.cpu.arch) {
.aarch64 => "lib/windows-aarch64/ghostty-vt-static.lib",
else => "lib/windows-x86_64/ghostty-vt-static.lib",
},
.linux => switch (target.result.cpu.arch) {
.aarch64 => "lib/linux-aarch64/libghostty-vt.a",
else => "lib/linux-x86_64/libghostty-vt.a",
},
else => @panic("unsupported target for ghostty_vt"),
};
lib.root_module.addIncludePath(ghostty_vt.path("include"));
lib.root_module.addObjectFile(ghostty_vt.path(ghostty_vt_lib));
lib.root_module.link_libc = true;
fizzy.plugin.install(b, lib, .{});
}