summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 05:18:01 -0300
committerGabriel Schneider <[email protected]>2026-11-06 05:55:49 -0300
commitde0447471febe1253b42a32fe9a1d6cdccc9d5b9 (patch)
treecacff70a9b976f621832e7b9d41bf24ee3e5c5ed /build.zig
parent3f4df1363d3051bf8c4665fdf4898d59ab365b27 (diff)
downloadpardes-de0447471febe1253b42a32fe9a1d6cdccc9d5b9.tar.gz
pardes-de0447471febe1253b42a32fe9a1d6cdccc9d5b9.zip
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 <prefix>/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 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig17
1 files changed, 17 insertions, 0 deletions
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 (<prefix>/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(&copy.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)