diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-06 22:49:11 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-06 23:38:31 -0300 |
| commit | d03b727cddfcec41b464ddf6178f17d0e831e529 (patch) | |
| tree | dee59f1590466c1a7b343be5cf873f4d1a27a7e1 /src | |
| parent | 8704fa7662f40d70552daa917144987a46e14b51 (diff) | |
| download | pardes-d03b727cddfcec41b464ddf6178f17d0e831e529.tar.gz pardes-d03b727cddfcec41b464ddf6178f17d0e831e529.zip | |
kinds #50, macOS by pattern: off Linux every core module has the addons compiled in (Addon.zig's loader is a Linux memfd, now refused elsewhere at compile time), the native shell registers them at start as the tui and gui do, and `-Dmacos-sdk=<path>` hands SDL's build the SDK's paths, so `-Dplatform=gui -Dtarget=aarch64-macos` configures (and `zig build core-test -Dtarget=aarch64-macos` compiles its test binary, MuPDF and both kinds in, without running it)
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src')
| -rw-r--r-- | src/Addon.zig | 10 | ||||
| -rw-r--r-- | src/macos.zig | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/Addon.zig b/src/Addon.zig index d39a27f3..67939f57 100644 --- a/src/Addon.zig +++ b/src/Addon.zig @@ -112,7 +112,7 @@ fn read(data: []const u8, path: []const u8, words: *[64]LoadedWord, why: *Why) L /// (dlopen hands back the handle it has for a path it has), unless this /// process holds those very bytes already. fn hold(path: []const u8, hash: *[32]u8, why: *Why) ?*Lib { - if (comptime compiled_in.len > 0) return failNull(why, "not on this platform: its addons are compiled in", .{}); + if (comptime compiled_in.len > 0 or @import("builtin").os.tag != .linux) return failNull(why, "not on this platform: its addons are compiled in", .{}); var z: [4096]u8 = undefined; const path_z = std.fmt.bufPrintSentinel(&z, "{s}", .{path}, 0) catch return failNull(why, "the path is too long", .{}); const f = std.c.fopen(path_z, "r") orelse return failNull(why, "cannot read it", .{}); @@ -175,10 +175,10 @@ var found_words: [Kind.max_kinds][64]LoadedWord = undefined; var found_text: [Kind.max_kinds][2][4096]u8 = undefined; var nfound: usize = 0; -/// A static pardes's addons (`zig build static`), compiled in: the image -/// and pdf modules' `pardes_addon` declarations, which only a library -/// exports. A static binary cannot dlopen, and macOS's loader has no -/// memfd: this is how either has image and PDF panes. +/// The addons compiled in (`zig build static`, and any build off Linux): +/// 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 &.{}; /// The addons compiled in, as if loaded (`builtin` their path); else every diff --git a/src/macos.zig b/src/macos.zig index 7b996ca3..9a734bcc 100644 --- a/src/macos.zig +++ b/src/macos.zig @@ -512,6 +512,8 @@ fn initCore(runtime: ?*const Runtime, cols_arg: u16, rows_arg: u16) !void { pardes.TerminalImages.start(io, allocs.image); pardes.Kind.heap = allocs.addon; + // Its addons are compiled in (no loader runs here): image and PDF panes. + opts.addons = pardes.Addon.scan(); errdefer pardes.TerminalImages.stop(); pardes.syntax.start(allocs.tree_sitter); errdefer pardes.syntax.stop(); |
