deps: Default gtk4-layer-shell system integration to true

We default system-integration to true as this is a shared library that
must be installed on a library path and it is recommended to use the
system package.

If the system does not package gtk4-layer-shell then doing `zig build
-fno-sys` will now correctly build and install the shared library under
a lib/ subdirectory of the output prefix.

The output prefix should be a default library path (`/lib`, `/usr/lib`,
or a lib64 variant) otherwise a custom library path can be configured
using ldconfig (see `man ld.so 8`)
This commit is contained in:
azhn
2025-04-14 19:56:22 +10:00
parent 206d41844e
commit 33e07c87c9
2 changed files with 13 additions and 6 deletions

View File

@ -361,7 +361,6 @@ pub fn init(b: *std.Build) !Config {
"libpng", "libpng",
"zlib", "zlib",
"oniguruma", "oniguruma",
"gtk4-layer-shell",
}) |dep| { }) |dep| {
_ = b.systemIntegrationOption( _ = b.systemIntegrationOption(
dep, dep,
@ -387,6 +386,15 @@ pub fn init(b: *std.Build) !Config {
}) |dep| { }) |dep| {
_ = b.systemIntegrationOption(dep, .{ .default = false }); _ = b.systemIntegrationOption(dep, .{ .default = false });
} }
// These are dynamic libraries we default to true, preferring
// to use system packages over building and installing libs
// as they require additional ldconfig of library paths or
// patching the rpath of the program to discover the dynamic library
// at runtime
for (&[_][]const u8{"gtk4-layer-shell"}) |dep| {
_ = b.systemIntegrationOption(dep, .{ .default = true });
}
} }
return config; return config;

View File

@ -652,14 +652,13 @@ fn addGTK(
// IMPORTANT: gtk4-layer-shell must be linked BEFORE // IMPORTANT: gtk4-layer-shell must be linked BEFORE
// wayland-client, as it relies on shimming libwayland's APIs. // wayland-client, as it relies on shimming libwayland's APIs.
if (b.systemIntegrationOption("gtk4-layer-shell", .{})) { if (b.systemIntegrationOption("gtk4-layer-shell", .{})) {
step.linkSystemLibrary2( step.linkSystemLibrary2("gtk4-layer-shell-0", dynamic_link_opts);
"gtk4-layer-shell-0",
dynamic_link_opts,
);
} else { } else {
// gtk4-layer-shell *must* be dynamically linked, // gtk4-layer-shell *must* be dynamically linked,
// so we don't add it as a static library // so we don't add it as a static library
step.linkLibrary(gtk4_layer_shell.artifact("gtk4-layer-shell")); const shared_lib = gtk4_layer_shell.artifact("gtk4-layer-shell");
b.installArtifact(shared_lib);
step.linkLibrary(shared_lib);
} }
} }