Skip to content

Commit a2347c7

Browse files
committed
std.Build: make systemIntegrationOption take a default
1 parent b66b7c5 commit a2347c7

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/std/Build.zig

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2356,7 +2356,16 @@ pub fn wantSharedLibSymLinks(target: Target) bool {
23562356
return target.os.tag != .windows;
23572357
}
23582358

2359-
pub fn systemIntegrationOption(b: *Build, name: []const u8) bool {
2359+
pub const SystemIntegrationOptionConfig = struct {
2360+
/// If left as null, then the default will depend on system_package_mode.
2361+
default: ?bool = null,
2362+
};
2363+
2364+
pub fn systemIntegrationOption(
2365+
b: *Build,
2366+
name: []const u8,
2367+
config: SystemIntegrationOptionConfig,
2368+
) bool {
23602369
const gop = b.graph.system_library_options.getOrPut(b.allocator, name) catch @panic("OOM");
23612370
if (gop.found_existing) switch (gop.value_ptr.*) {
23622371
.user_disabled => {
@@ -2371,7 +2380,7 @@ pub fn systemIntegrationOption(b: *Build, name: []const u8) bool {
23712380
.declared_enabled => return true,
23722381
} else {
23732382
gop.key_ptr.* = b.dupe(name);
2374-
if (b.graph.system_package_mode) {
2383+
if (config.default orelse b.graph.system_package_mode) {
23752384
gop.value_ptr.* = .declared_enabled;
23762385
return true;
23772386
} else {

0 commit comments

Comments
 (0)