From de0447471febe1253b42a32fe9a1d6cdccc9d5b9 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Fri, 6 Nov 2026 05:18:01 -0300 Subject: kinds #8, image.so: addons/image/image.c (144 lines) is the image kind against ABI 2 over stb_image as zstbi vendors it (every format it decoded, HDR out, at most 1280 pixels a side, 64 Mpixels refused before decoding), its record the file's bytes, its decode a job, one placement fitted, its prefix img; stb's memory is the pane's arena at open and the job's on a worker, so pa_out's alloc may be called as often as a job needs (an arena a job, freed after its job_done, the last allocation the answer: what the header found wanting); the build makes it with -Wall -Wextra -Werror and installs it to /lib/pardes/addons/image.so (a bare build to ~/.local/lib/pardes/addons too); the compiled-in image kind is still there, so the start scan lists the library refused as a second image Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- build.zig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'build.zig') diff --git a/build.zig b/build.zig index d83b7139..132b3640 100644 --- a/build.zig +++ b/build.zig @@ -354,6 +354,13 @@ pub fn build(b: *std.Build) void { const zstbi_dep = b.dependency("zstbi", .{ .target = target, .optimize = c_optimize }); const zstbi_mod = zstbi_dep.module("root"); + // The image addon (addons/image/image.c over stb_image), installed where + // the start scan finds it (/lib/pardes/addons) and handed by + // path to every test that opens a picture. + const image_addon = b.addLibrary(.{ .name = "image", .linkage = .dynamic, .root_module = b.createModule(.{ .target = target, .optimize = c_optimize, .link_libc = true }) }); + image_addon.root_module.addIncludePath(b.path("src/kinds")); + image_addon.root_module.addIncludePath(zstbi_dep.path("libs/stbi")); + image_addon.root_module.addCSourceFile(.{ .file = b.path("addons/image/image.c"), .flags = &.{ "-std=c11", "-Wall", "-Wextra", "-Werror" } }); // mvzr backtracks with no bound on its work (its own test "do not make // this test any longer": `a?` n times is 2^n steps), and pardes searches @@ -1126,6 +1133,16 @@ pub fn build(b: *std.Build) void { .root_module = root_mod, }); installHome(b, exe, home_bin); + if (target.result.os.tag == .linux and !static) { + b.getInstallStep().dependOn(&b.addInstallFileWithDir(image_addon.getEmittedBin(), .lib, "pardes/addons/image.so").step); + if (home_bin) |dir| { + const copy = b.addSystemCommand(&.{ "install", "-Dm755" }); + copy.addFileArg(image_addon.getEmittedBin()); + copy.addArg(b.pathJoin(&.{ dir, "..", "lib", "pardes", "addons", "image.so" })); + copy.has_side_effects = true; + b.getInstallStep().dependOn(©.step); + } + } if (gui_mod) |gm| { var gui_name: []const u8 = "pardes-gui"; if (target.result.os.tag != .linux or target.result.cpu.arch != .x86_64) -- cgit v1.3