From 1d54a3d3220706acfe704a0c1d6cda47cc0df43d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 15:14:31 -0300 Subject: build: the pass and the agent to preload are named lazy paths; canim uses them A package that depends on ztrace no longer repeats the plugin's recipe or searches the install step for the shared agent. --- build/agent.zig | 3 +++ build/llvm.zig | 2 ++ 2 files changed, 5 insertions(+) (limited to 'build') diff --git a/build/agent.zig b/build/agent.zig index d02880a..507171f 100644 --- a/build/agent.zig +++ b/build/agent.zig @@ -32,6 +32,9 @@ pub fn add(ctx: Ctx) *Compile { b.installArtifact(lib.*); } b.getInstallStep().dependOn(&b.addInstallHeaderFile(b.path("include/ztrace.h"), "ztrace.h").step); + // For a package that depends on this one: the library to preload, by a + // name of its own (two artifacts are called ztrace-agent). + b.addNamedLazyPath("ztrace-agent", libs[0].getEmittedBin()); const t: Tests = .{ .ctx = ctx, diff --git a/build/llvm.zig b/build/llvm.zig index b346f13..94b7501 100644 --- a/build/llvm.zig +++ b/build/llvm.zig @@ -24,6 +24,8 @@ pub fn add(ctx: Ctx) std.Build.LazyPath { cxx.addFileArg(b.path("llvm/pass.cpp")); const plugin = cxx.addOutputFileArg("ztrace-pass.so"); b.getInstallStep().dependOn(&b.addInstallLibFile(plugin, "ztrace-pass.so").step); + // For a package that depends on this one: `dependency.namedLazyPath("ztrace-pass")`. + b.addNamedLazyPath("ztrace-pass", plugin); // For whoever draws values: the parser of type descriptions. const types = b.addModule("ztrace-types", .{ .root_source_file = b.path("src/instr/types.zig"), .target = ctx.target, .optimize = ctx.optimize }); -- cgit v1.3