@@ -321,6 +321,41 @@ pub fn build(b: *std.Build) void {
321321 run_cmd .addArgs (args );
322322 }
323323 }
324+
325+ {
326+ const screen_play = b .addExecutable (.{
327+ .name = "zscreen_play" ,
328+ .root_module = b .createModule (.{
329+ .root_source_file = b .path ("src/screen_play.zig" ),
330+ .target = target ,
331+ .optimize = optimize ,
332+ }),
333+ });
334+
335+ const sdl = b .dependency ("sdl" , .{
336+ .optimize = optimize ,
337+ .target = target ,
338+ });
339+
340+ screen_play .linkLibrary (sdl .artifact ("SDL3" ));
341+ screen_play .addIncludePath (b .path ("src" )); // XXX: temp
342+ b .installArtifact (screen_play );
343+
344+ var dep : std.Build.Dependency = .{ .builder = b };
345+ linkAndInstall (b , & dep , screen_play );
346+
347+ const run_step = b .step ("zscreen-play" , "Run the screen-play example" );
348+
349+ const run_cmd = b .addRunArtifact (screen_play );
350+ run_cmd .setCwd (.{ .cwd_relative = b .getInstallPath (.bin , "" ) });
351+ run_step .dependOn (& run_cmd .step );
352+
353+ run_cmd .step .dependOn (b .getInstallStep ());
354+
355+ if (b .args ) | args | {
356+ run_cmd .addArgs (args );
357+ }
358+ }
324359}
325360
326361/// You may call this externally to link to libpipewire and install its dependencies alongside the
@@ -349,6 +384,19 @@ const flags: []const []const u8 = &.{
349384 "-Wno-pedantic" ,
350385 "-D_GNU_SOURCE" ,
351386 "-DFASTPATH" ,
387+ // Translate C can't translate some of the variadic functions API so they get demoted to
388+ // externs. However, since they're present only in headers and marked as `SPA_API_IMPL` which
389+ // which defaults to `static inline`, the symbols end up being missing. We instead mark them as
390+ // weak so that we don't get duplicate symbols, but are still able to reference the C
391+ // implementations.
392+ "-DSPA_API_IMPL=__attribute__((weak))" ,
393+
394+ // XXX: better way to do this?
395+ "-Ddlopen=__wrap_dlopen" ,
396+ "-Ddlclose=__wrap_dlclose" ,
397+ "-Ddlsym=__wrap_dlsym" ,
398+ "-Ddlerror=__wrap_dlerror" ,
399+ "-Ddlinfo=__wrap_dlinfo" ,
352400};
353401
354402pub const PluginAndModuleCtx = struct {
0 commit comments