-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
173 lines (154 loc) · 5.56 KB
/
build.zig
File metadata and controls
173 lines (154 loc) · 5.56 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
// Get ghostty-vt module from dependency
const ghostty_vt_mod = if (b.lazyDependency("ghostty", .{
.target = target,
.optimize = optimize,
})) |ghostty_dep| ghostty_dep.module("ghostty-vt") else null;
// Get yazap module from dependency
const yazap_mod = if (b.lazyDependency("yazap", .{})) |yazap_dep| yazap_dep.module("yazap") else null;
// Get ziglua dependency for embedded Lua
const ziglua_dep = b.lazyDependency("ziglua", .{
.target = target,
.optimize = optimize,
});
// Get libvoid dependency for sandboxing
const libvoid_mod = if (b.lazyDependency("libvoid", .{
.target = target,
.optimize = optimize,
})) |libvoid_dep| libvoid_dep.module("libvoid") else null;
// Get libxev dependency (required event loop backend)
const xev_mod = b.dependency("libxev", .{
.target = target,
.optimize = optimize,
}).module("xev");
// Get libvaxis dependency (required TUI rendering library)
const vaxis_mod = b.dependency("libvaxis", .{
.target = target,
.optimize = optimize,
}).module("vaxis");
// Get liblink dependency
const liblink_mod = if (b.lazyDependency("liblink", .{
.target = target,
.optimize = optimize,
})) |liblink_dep| liblink_dep.module("liblink") else null;
// Create core module
const core_module = b.createModule(.{
.root_source_file = b.path("src/core/mod.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
if (ghostty_vt_mod) |vt| {
core_module.addImport("ghostty-vt", vt);
}
if (ziglua_dep) |dep| {
const zlua_mod = dep.module("zlua");
core_module.addImport("zlua", zlua_mod);
}
if (libvoid_mod) |vb| {
core_module.addImport("libvoid", vb);
}
core_module.addImport("vaxis", vaxis_mod);
core_module.addImport("xev", xev_mod);
if (liblink_mod) |ll| {
core_module.addImport("liblink", ll);
}
// Create shell module (shell prompt/status bar segments)
const shp_module = b.createModule(.{
.root_source_file = b.path("src/modules/shell/mod.zig"),
.target = target,
.optimize = optimize,
});
shp_module.addImport("core", core_module);
// Create popup module (popup/overlay system)
const pop_module = b.createModule(.{
.root_source_file = b.path("src/modules/popup/mod.zig"),
.target = target,
.optimize = optimize,
});
pop_module.addImport("core", core_module);
// Create multiplexer module for unified CLI
const mux_module = b.createModule(.{
.root_source_file = b.path("src/modules/multiplexer/main.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
mux_module.addImport("core", core_module);
mux_module.addImport("xev", xev_mod);
mux_module.addImport("shp", shp_module);
mux_module.addImport("pop", pop_module);
if (ghostty_vt_mod) |vt| {
mux_module.addImport("ghostty-vt", vt);
}
mux_module.addImport("vaxis", vaxis_mod);
// Create session module for unified CLI
const ses_module = b.createModule(.{
.root_source_file = b.path("src/modules/session/main.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
ses_module.addImport("core", core_module);
ses_module.addImport("xev", xev_mod);
if (libvoid_mod) |vb| {
ses_module.addImport("libvoid", vb);
}
// Create pod module (per-pane PTY + scrollback; launched via `hexe pod daemon`)
const pod_module = b.createModule(.{
.root_source_file = b.path("src/modules/pod/mod.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
pod_module.addImport("core", core_module);
pod_module.addImport("xev", xev_mod);
if (libvoid_mod) |vb| {
pod_module.addImport("libvoid", vb);
}
// Build unified hexe CLI executable
const cli_root = b.createModule(.{
.root_source_file = b.path("src/cli/app.zig"),
.target = target,
.optimize = optimize,
.link_libc = true,
});
cli_root.addImport("core", core_module);
cli_root.addImport("mux", mux_module);
cli_root.addImport("ses", ses_module);
cli_root.addImport("pod", pod_module);
cli_root.addImport("shp", shp_module);
cli_root.addImport("xev", xev_mod);
if (yazap_mod) |yazap| {
cli_root.addImport("yazap", yazap);
}
const cli_exe = b.addExecutable(.{
.name = "hexe",
.root_module = cli_root,
});
b.installArtifact(cli_exe);
// Run hexe step
const run_hexe = b.addRunArtifact(cli_exe);
run_hexe.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_hexe.addArgs(args);
}
const run_step = b.step("run", "Run hexe");
run_step.dependOn(&run_hexe.step);
// Test step for session module error handling tests
const ses_test_module = b.createModule(.{
.root_source_file = b.path("src/modules/session/state_test.zig"),
.target = target,
.optimize = optimize,
});
ses_test_module.addImport("core", core_module);
const ses_tests = b.addTest(.{
.root_module = ses_test_module,
});
const run_ses_tests = b.addRunArtifact(ses_tests);
const test_step = b.step("test", "Run SES error handling tests");
test_step.dependOn(&run_ses_tests.step);
}