Skip to content

Commit e53a023

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 27bc1af commit e53a023

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-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

+10-2
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,16 @@ fn addGTK(
657657
const sharedLib = gtk4_layer_shell.artifact("gtk4-layer-shell");
658658
const artifact: *std.Build.Step.InstallArtifact = b.addInstallArtifact(sharedLib, .{});
659659
b.getInstallStep().dependOn(&artifact.step);
660-
// Lookup dynamic libs from installed location
661-
step.root_module.addRPathSpecial(b.getInstallPath(artifact.dest_dir.?, ""));
660+
if (self.config.optimize == .Debug) {
661+
// Lookup dynamic libs from installed location
662+
const installPath = b.getInstallPath(artifact.dest_dir.?, "");
663+
if (!std.fs.path.isAbsolute(installPath)) {
664+
// Using a relative path as an rpath is almost useless
665+
return error.UndesirablePath;
666+
}
667+
// Lookup dynamic libs from installed location
668+
step.root_module.addRPathSpecial(b.getInstallPath(artifact.dest_dir.?, ""));
669+
}
662670
step.linkLibrary(sharedLib);
663671
}
664672
}

0 commit comments

Comments
 (0)