summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig22
1 files changed, 13 insertions, 9 deletions
diff --git a/build.zig b/build.zig
index 4808d8e8..c5b7f73d 100644
--- a/build.zig
+++ b/build.zig
@@ -194,9 +194,12 @@ pub fn build(b: *std.Build) void {
.link_libc = true,
}) else null;
- // `zig build static`'s: the terminal's, the addons compiled in
- // (Addon.zig); musl's alone, as glibc links only dynamically.
- const static_mod: ?*std.Build.Module = if (platform == .tui and target.result.isMuslLibC()) b.createModule(.{
+ // `zig build static`'s: the addons compiled in (Addon.zig). Linked
+ // statically on musl alone, as glibc links only dynamically; the gui's
+ // is dynamic (SDL and the GPU need the display's libraries) with the
+ // addons in it all the same.
+ const static_linkage: ?std.builtin.LinkMode = if (target.result.isMuslLibC()) .static else null;
+ const static_mod: ?*std.Build.Module = if ((platform == .tui and static_linkage != null) or platform == .gui) b.createModule(.{
.target = target,
.optimize = optimize,
.root_source_file = b.path("src/main.zig"),
@@ -895,7 +898,9 @@ pub fn build(b: *std.Build) void {
const gui_shell_mod: ?*std.Build.Module = gui_mod orelse
if (platform == .gui) root_mod else null;
- if (gui_shell_mod) |gm| {
+ // The static step's gui module is a gui shell too.
+ const gui_shell_mods: [2]?*std.Build.Module = .{ gui_shell_mod, if (platform == .gui) static_mod else null };
+ for (gui_shell_mods) |gui_shell_entry| if (gui_shell_entry) |gm| {
const sdl_dep = b.lazyDependency("sdl", .{ .target = target, .optimize = optimize, .sanitize_c = .off, .preferred_linkage = .static });
if (sdl_dep) |dep| {
const sdl_lib = dep.artifact("SDL3");
@@ -972,7 +977,7 @@ pub fn build(b: *std.Build) void {
else
compileGlsl(b, name),
});
- }
+ };
if (platform == .macos) {
const header = b.addTranslateC(.{
@@ -1174,11 +1179,11 @@ pub fn build(b: *std.Build) void {
// addons compiled in and registered at start as if loaded. It is
// also how a build for macOS, whose loader has no memfd, could have
// image and PDF panes.
- const static_step = b.step("static", "a static pardes with the image and pdf addons in it (-Dplatform=tui -Dtarget=x86_64-linux-musl)");
+ const static_step = b.step("static", "a pardes with the image and pdf addons in it: the terminal's static (-Dplatform=tui -Dtarget=x86_64-linux-musl), the gui's dynamic (-Dplatform=gui)");
if (static_mod) |m|
- static_step.dependOn(&b.addInstallArtifact(b.addExecutable(.{ .name = "pardes", .linkage = .static, .root_module = m }), .{}).step)
+ static_step.dependOn(&b.addInstallArtifact(b.addExecutable(.{ .name = exe_name, .linkage = if (platform == .gui) null else static_linkage, .root_module = m }), .{}).step)
else
- static_step.dependOn(&b.addFail("static is the terminal's and musl's: -Dplatform=tui -Dtarget=x86_64-linux-musl").step);
+ static_step.dependOn(&b.addFail("static is the terminal's on musl (-Dplatform=tui -Dtarget=x86_64-linux-musl) or the gui's (-Dplatform=gui)").step);
const run = b.addRunArtifact(exe);
b.step("run", "descend to the pardes").dependOn(&run.step);
if (isolated_mod) |iso| {
@@ -1496,7 +1501,6 @@ pub fn build(b: *std.Build) void {
syntax_test_step.dependOn(&run_syntax_test.step);
if (testMatch(b, unit_profile, test_filters, syntax_test_step)) |check| check.addArtifactArg(syntax_test);
-
const history = b.addExecutable(.{
.name = "pardes-history",
.root_module = b.createModule(.{