Skip to content

Commit 382abeb

Browse files
committed
Default systemIntegrationOption for gtk4-layer-shell to true
- Add an absolute rpath entry in Debug mode only to test gtk4-layer-shell when not using the system package * Prefer using ldconfig to discover installed libs in custom prefixes
1 parent dd6aa84 commit 382abeb

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

src/build/Config.zig

+11-3
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,8 @@ pub fn init(b: *std.Build) !Config {
337337
target.result.os.tag == .macos and
338338
config.app_runtime == .none and
339339
(!config.emit_bench and
340-
!config.emit_test_exe and
341-
!config.emit_helpgen);
340+
!config.emit_test_exe and
341+
!config.emit_helpgen);
342342

343343
//---------------------------------------------------------------
344344
// System Packages
@@ -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;

src/build/SharedDeps.zig

+9-2
Original file line numberDiff line numberDiff line change
@@ -519,9 +519,16 @@ pub fn add(
519519
const sharedLib = gtk4_layer_shell.artifact("gtk4-layer-shell");
520520
const artifact: *std.Build.Step.InstallArtifact = b.addInstallArtifact(sharedLib, .{});
521521
b.getInstallStep().dependOn(&artifact.step);
522-
// Lookup dynamic libs from installed location
523-
step.root_module.addRPathSpecial(b.getInstallPath(artifact.dest_dir.?, ""));
524522
step.linkLibrary(sharedLib);
523+
if (self.config.optimize == .Debug) {
524+
// Lookup dynamic libs from installed location
525+
const installPath = b.getInstallPath(artifact.dest_dir.?, "");
526+
if (!std.fs.path.isAbsolute(installPath)) {
527+
// Using a relative path as an rpath is almost useless
528+
return error.UndesirableRelativePath;
529+
}
530+
step.root_module.addRPathSpecial(b.getInstallPath(artifact.dest_dir.?, ""));
531+
}
525532
}
526533

527534
step.linkSystemLibrary2("wayland-client", dynamic_link_opts);

0 commit comments

Comments
 (0)