Skip to content

Commit b360b6a

Browse files
committed
std.Build: make system library integrations more general
Before it was named "library" inconsistently. Now the CLI args are -fsys=[name] and -fno-sys=[name] and it is a more general-purpose "system integration" which could be a library name or perhaps a project name such as "ffmpeg" or a binary such as "nasm".
1 parent 7e67553 commit b360b6a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

lib/build_runner.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,11 @@ pub fn main() !void {
125125
install_prefix = nextArgOrFatal(args, &arg_idx);
126126
} else if (mem.eql(u8, arg, "-l") or mem.eql(u8, arg, "--list-steps")) {
127127
steps_menu = true;
128-
} else if (mem.eql(u8, arg, "--system-lib")) {
129-
const name = nextArgOrFatal(args, &arg_idx);
128+
} else if (mem.startsWith(u8, arg, "-fsys=")) {
129+
const name = arg["-fsys=".len..];
130130
graph.system_library_options.put(arena, name, .user_enabled) catch @panic("OOM");
131-
} else if (mem.eql(u8, arg, "--no-system-lib")) {
132-
const name = nextArgOrFatal(args, &arg_idx);
131+
} else if (mem.startsWith(u8, arg, "-fno-sys=")) {
132+
const name = arg["-fno-sys=".len..];
133133
graph.system_library_options.put(arena, name, .user_disabled) catch @panic("OOM");
134134
} else if (mem.eql(u8, arg, "--host-target")) {
135135
graph.host_query_options.arch_os_abi = nextArgOrFatal(args, &arg_idx);
@@ -1111,13 +1111,13 @@ fn usage(b: *std.Build, out_stream: anytype) !void {
11111111
\\
11121112
\\System Integration Options:
11131113
\\ --system [dir] System Package Mode. Disable fetching; prefer system libs
1114+
\\ -fsys=[name] Enable a system integration
1115+
\\ -fno-sys=[name] Disable a system integration
11141116
\\ --host-target [triple] Use the provided target as the host
11151117
\\ --host-cpu [cpu] Use the provided CPU as the host
11161118
\\ --host-dynamic-linker [path] Use the provided dynamic linker as the host
1117-
\\ --system-lib [name] Use the system-provided library
1118-
\\ --no-system-lib [name] Do not use the system-provided library
11191119
\\
1120-
\\ Available System Library Integrations: Enabled:
1120+
\\ Available System Integrations: Enabled:
11211121
\\
11221122
);
11231123
if (b.graph.system_library_options.entries.len == 0) {

lib/std/Build.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2324,7 +2324,7 @@ pub fn wantSharedLibSymLinks(target: Target) bool {
23242324
return target.os.tag != .windows;
23252325
}
23262326

2327-
pub fn systemLibraryOption(b: *Build, name: []const u8) bool {
2327+
pub fn systemIntegrationOption(b: *Build, name: []const u8) bool {
23282328
const gop = b.graph.system_library_options.getOrPut(b.allocator, name) catch @panic("OOM");
23292329
if (gop.found_existing) switch (gop.value_ptr.*) {
23302330
.user_disabled => {

0 commit comments

Comments
 (0)