Skip to content

Commit e8c590e

Browse files
committed
Documents some of the tricky stuff going on to make easier to maintain
1 parent 91800db commit e8c590e

File tree

2 files changed

+184
-136
lines changed

2 files changed

+184
-136
lines changed

build.zig

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ pub fn linkAndInstall(
371371
});
372372
}
373373

374+
/// Flags uses for all pipewire libraries.
374375
const flags: []const []const u8 = &.{
375376
// Common build flags for libpipewire.
376377
"-fvisibility=hidden",
@@ -388,7 +389,8 @@ const flags: []const []const u8 = &.{
388389
// implementations.
389390
"-DSPA_API_IMPL=__attribute__((weak))",
390391

391-
// Wrap standard library functions we want to replace.
392+
// Wrap the standard library functions we want to replace with our own implementations to avoid
393+
// relying on a dynamic linker.
392394
"-Ddlopen=__wrap_dlopen",
393395
"-Ddlclose=__wrap_dlclose",
394396
"-Ddlsym=__wrap_dlsym",
@@ -407,6 +409,8 @@ pub const PluginAndModuleCtx = struct {
407409
libpipewire: *std.Build.Step.Compile,
408410
};
409411

412+
/// A pipewire module. These are typically opened with `dlopen`, but we're going to link to them
413+
/// statically.
410414
pub const PipewireModule = struct {
411415
name: []const u8,
412416
files: []const []const u8,
@@ -445,6 +449,8 @@ pub const PipewireModule = struct {
445449
}
446450
};
447451

452+
/// A pipewire plugin. These are typically opened with `dlopen`, but we're going to link to them
453+
/// statically.
448454
pub const PipewirePlugin = struct {
449455
name: []const u8,
450456
files: []const []const u8,
@@ -485,6 +491,7 @@ pub const PipewirePlugin = struct {
485491
}
486492
};
487493

494+
/// Namespaces a symbol using the preprocessor.
488495
pub fn namespace(library: *std.Build.Step.Compile, symbol: []const u8) void {
489496
const b = library.root_module.owner;
490497
library.root_module.addCMacro(
@@ -493,6 +500,7 @@ pub fn namespace(library: *std.Build.Step.Compile, symbol: []const u8) void {
493500
);
494501
}
495502

503+
/// A namespaced symbol.
496504
pub const Namespaced = struct {
497505
prefix: []const u8,
498506
symbol: []const u8,

0 commit comments

Comments
 (0)