Skip to content

Commit da0bb6a

Browse files
committed
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`)
1 parent 9d9d781 commit da0bb6a

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

Diff for: src/build/Config.zig

+9-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,6 @@ pub fn init(b: *std.Build) !Config {
361361
"libpng",
362362
"zlib",
363363
"oniguruma",
364-
"gtk4-layer-shell",
365364
}) |dep| {
366365
_ = b.systemIntegrationOption(
367366
dep,
@@ -387,6 +386,15 @@ pub fn init(b: *std.Build) !Config {
387386
}) |dep| {
388387
_ = b.systemIntegrationOption(dep, .{ .default = false });
389388
}
389+
390+
// These are dynamic libraries we default to true, preferring
391+
// to use system packages over building and installing libs
392+
// as they require additional ldconfig of library paths or
393+
// patching the rpath of the program to discover the dynamic library
394+
// at runtime
395+
for (&[_][]const u8{"gtk4-layer-shell"}) |dep| {
396+
_ = b.systemIntegrationOption(dep, .{ .default = true });
397+
}
390398
}
391399

392400
return config;

Diff for: src/build/SharedDeps.zig

+4-5
Original file line numberDiff line numberDiff line change
@@ -647,14 +647,13 @@ fn addGTK(
647647
// IMPORTANT: gtk4-layer-shell must be linked BEFORE
648648
// wayland-client, as it relies on shimming libwayland's APIs.
649649
if (b.systemIntegrationOption("gtk4-layer-shell", .{})) {
650-
step.linkSystemLibrary2(
651-
"gtk4-layer-shell-0",
652-
dynamic_link_opts,
653-
);
650+
step.linkSystemLibrary2("gtk4-layer-shell-0", dynamic_link_opts);
654651
} else {
655652
// gtk4-layer-shell *must* be dynamically linked,
656653
// so we don't add it as a static library
657-
step.linkLibrary(gtk4_layer_shell.artifact("gtk4-layer-shell"));
654+
const shared_lib = gtk4_layer_shell.artifact("gtk4-layer-shell");
655+
b.installArtifact(shared_lib);
656+
step.linkLibrary(shared_lib);
658657
}
659658
}
660659

0 commit comments

Comments
 (0)