summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-08 20:58:56 -0300
committerGabriel Schneider <[email protected]>2026-11-08 21:48:19 -0300
commit97568ff864876098579f5510624ae92995404d75 (patch)
tree8d56d654039f6ef5ef859da1241c8506a52eb03a
parent9a7eb67ba60fed36a65db3d68ab22abf40807682 (diff)
downloadpardes-97568ff864876098579f5510624ae92995404d75.tar.gz
pardes-97568ff864876098579f5510624ae92995404d75.zip
fix: a build with the addons compiled in (any off Linux, the static step) and -Dpdf=false did not compile, Addon.zig importing a pdf_addon the build had not made: the builtin_addons options say whether the pdf addon is built, and without it the image addon is compiled in alone; an aarch64-macos -Dpdf=false compile no longer names pdf_addon (its one error left is daemon.zig's darwin CMSG_CLOEXEC, a break of its own)
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
-rw-r--r--build.zig2
-rw-r--r--src/Addon.zig8
2 files changed, 9 insertions, 1 deletions
diff --git a/build.zig b/build.zig
index 60020e85..35f4c55b 100644
--- a/build.zig
+++ b/build.zig
@@ -879,6 +879,8 @@ pub fn build(b: *std.Build) void {
builtin_off.addOption(bool, "on", false);
const builtin_on = b.addOptions();
builtin_on.addOption(bool, "on", true);
+ // ...the pdf one only when it is built (-Dpdf=false leaves it out).
+ builtin_on.addOption(bool, "pdf", pdf_addon != null);
for (core_mods, core_shells) |mod, shell| {
// config.zig's test checks the words and keys docs/typ names exist.
diff --git a/src/Addon.zig b/src/Addon.zig
index 67939f57..fa41f774 100644
--- a/src/Addon.zig
+++ b/src/Addon.zig
@@ -179,7 +179,13 @@ var nfound: usize = 0;
/// the image and pdf modules' `pardes_addon` declarations, which only a
/// library exports. A static binary cannot dlopen, and the loader below
/// is Linux's (a memfd): this is how either has image and PDF panes.
-const compiled_in: []const *const Kind.Ops = if (@import("builtin_addons").on) &.{ &@import("image_addon").pardes_addon, &@import("pdf_addon").pardes_addon } else &.{};
+/// A build with -Dpdf=false has the image addon alone.
+const compiled_in: []const *const Kind.Ops = if (!@import("builtin_addons").on)
+ &.{}
+else if (@import("builtin_addons").pdf)
+ &.{ &@import("image_addon").pardes_addon, &@import("pdf_addon").pardes_addon }
+else
+ &.{&@import("image_addon").pardes_addon};
/// The addons compiled in, as if loaded (`builtin` their path); else every
/// library of the two directories, in name order each, the user's first. A