From 31706a1d1c13c26c69f67f107b72179019cbd255 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 13:39:00 -0300 Subject: kinds #26, one static pardes: `zig build static -Dplatform=tui -Dtarget=x86_64-linux-musl` (musl's, as glibc links only dynamically; never the default, and -Dstatic gone) links the terminal binary statically with both addons compiled in, image.zig as a module and pdf.c with MuPDF, its export renamed by a -D, which Addon.zig registers at start as if loaded (/addons says builtin, Addon reload refuses one, no library is scanned), and execveat and close_range go by their syscalls, which musl has no wrappers for; macOS's way to image and PDF panes too, say a comment, building.typ, shared-libs.md and the changelog Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/upgrade.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/upgrade.zig') diff --git a/src/upgrade.zig b/src/upgrade.zig index 7819f216..97d3be4f 100644 --- a/src/upgrade.zig +++ b/src/upgrade.zig @@ -322,13 +322,13 @@ pub fn exec(gpa: std.mem.Allocator, path: ?[:0]const u8, old: c_int, rec: *const for (given, argv[2..]) |a, *slot| slot.* = a.ptr; rec.closeOnExec(false); const envp: [*:null]const ?[*:0]const u8 = @ptrCast(libc.environ); - const r = if (path) |p| - libc.execve(p, argv.ptr, envp) + // execveat by its syscall: musl (a static pardes) has no wrapper. + const e = if (path) |p| + libc.errno(libc.execve(p, argv.ptr, envp)) else if (comptime builtin.os.tag == .linux) - libc.execveat(old, "", argv.ptr, envp, .{ .SYMLINK_NOFOLLOW = false, .EMPTY_PATH = true }) + std.os.linux.errno(std.os.linux.execveat(old, "", argv.ptr, envp, .{ .SYMLINK_NOFOLLOW = false, .EMPTY_PATH = true })) else - -1; - const e = libc.errno(r); + libc.errno(@as(c_int, -1)); rec.closeOnExec(true); return switch (e) { .NOENT => "it is not there", -- cgit v1.3