CLI: rename --override-lib-dir to --zig-lib-dir

This breaking change disambiguates between overriding the lib dir when
performing an installation with the Zig Build System, and overriding the
lib dir that the Zig installation itself uses.
This commit is contained in:
Andrew Kelley 2021-06-14 11:33:27 -07:00
parent 5a4249fa25
commit 193c529b8c
10 changed files with 17 additions and 17 deletions

View File

@ -782,7 +782,7 @@ set(BUILD_ZIG1_ARGS
-target "${ZIG_TARGET_TRIPLE}" -target "${ZIG_TARGET_TRIPLE}"
"-mcpu=${ZIG_TARGET_MCPU}" "-mcpu=${ZIG_TARGET_MCPU}"
--name zig1 --name zig1
--override-lib-dir "${CMAKE_SOURCE_DIR}/lib" --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
"-femit-bin=${ZIG1_OBJECT}" "-femit-bin=${ZIG1_OBJECT}"
"${ZIG1_RELEASE_ARG}" "${ZIG1_RELEASE_ARG}"
"${ZIG1_SINGLE_THREADED_ARG}" "${ZIG1_SINGLE_THREADED_ARG}"
@ -836,7 +836,7 @@ set(ZIG_SKIP_INSTALL_LIB_FILES off CACHE BOOL
if(NOT ZIG_SKIP_INSTALL_LIB_FILES) if(NOT ZIG_SKIP_INSTALL_LIB_FILES)
set(ZIG_INSTALL_ARGS "build" set(ZIG_INSTALL_ARGS "build"
--override-lib-dir "${CMAKE_SOURCE_DIR}/lib" --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
"-Dlib-files-only" "-Dlib-files-only"
--prefix "${CMAKE_INSTALL_PREFIX}" --prefix "${CMAKE_INSTALL_PREFIX}"
"-Dconfig_h=${ZIG_CONFIG_H_OUT}" "-Dconfig_h=${ZIG_CONFIG_H_OUT}"

View File

@ -79,7 +79,7 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then
# Produce the experimental std lib documentation. # Produce the experimental std lib documentation.
mkdir -p release/docs/std mkdir -p release/docs/std
release/bin/zig test ../lib/std/std.zig \ release/bin/zig test ../lib/std/std.zig \
--override-lib-dir ../lib \ --zig-lib-dir ../lib \
-femit-docs=release/docs/std \ -femit-docs=release/docs/std \
-fno-emit-bin -fno-emit-bin

View File

@ -94,7 +94,7 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then
# Produce the experimental std lib documentation. # Produce the experimental std lib documentation.
mkdir -p release/docs/std mkdir -p release/docs/std
$ZIG test ../lib/std/std.zig \ $ZIG test ../lib/std/std.zig \
--override-lib-dir ../lib \ --zig-lib-dir ../lib \
-femit-docs=release/docs/std \ -femit-docs=release/docs/std \
-fno-emit-bin -fno-emit-bin

View File

@ -2716,10 +2716,10 @@ pub const LibExeObjStep = struct {
} }
if (self.override_lib_dir) |dir| { if (self.override_lib_dir) |dir| {
try zig_args.append("--override-lib-dir"); try zig_args.append("--zig-lib-dir");
try zig_args.append(builder.pathFromRoot(dir)); try zig_args.append(builder.pathFromRoot(dir));
} else if (self.builder.override_lib_dir) |dir| { } else if (self.builder.override_lib_dir) |dir| {
try zig_args.append("--override-lib-dir"); try zig_args.append("--zig-lib-dir");
try zig_args.append(builder.pathFromRoot(dir)); try zig_args.append(builder.pathFromRoot(dir));
} }

View File

@ -3,7 +3,7 @@
// This file is part of [zig](https://ziglang.org/), which is MIT licensed. // This file is part of [zig](https://ziglang.org/), which is MIT licensed.
// The MIT license requires this copyright notice to be included in all copies // The MIT license requires this copyright notice to be included in all copies
// and substantial portions of the software. // and substantial portions of the software.
// zig run benchmark.zig --release-fast --override-lib-dir .. // zig run benchmark.zig --release-fast --zig-lib-dir ..
const std = @import("../std.zig"); const std = @import("../std.zig");
const builtin = std.builtin; const builtin = std.builtin;

View File

@ -3,7 +3,7 @@
// This file is part of [zig](https://ziglang.org/), which is MIT licensed. // This file is part of [zig](https://ziglang.org/), which is MIT licensed.
// The MIT license requires this copyright notice to be included in all copies // The MIT license requires this copyright notice to be included in all copies
// and substantial portions of the software. // and substantial portions of the software.
// zig run benchmark.zig --release-fast --override-lib-dir .. // zig run benchmark.zig --release-fast --zig-lib-dir ..
const builtin = std.builtin; const builtin = std.builtin;
const std = @import("std"); const std = @import("std");

View File

@ -41,7 +41,7 @@ pub const wasi = @import("os/wasi.zig");
pub const windows = @import("os/windows.zig"); pub const windows = @import("os/windows.zig");
comptime { comptime {
assert(@import("std") == std); // std lib tests require --override-lib-dir assert(@import("std") == std); // std lib tests require --zig-lib-dir
} }
test { test {

View File

@ -119,9 +119,9 @@ pub fn main() !void {
warn("expected [auto|on|off] after --color, found '{s}'", .{next_arg}); warn("expected [auto|on|off] after --color, found '{s}'", .{next_arg});
return usageAndErr(builder, false, stderr_stream); return usageAndErr(builder, false, stderr_stream);
}; };
} else if (mem.eql(u8, arg, "--override-lib-dir")) { } else if (mem.eql(u8, arg, "--zig-lib-dir")) {
builder.override_lib_dir = nextArg(args, &arg_idx) orelse { builder.override_lib_dir = nextArg(args, &arg_idx) orelse {
warn("Expected argument after --override-lib-dir\n\n", .{}); warn("Expected argument after --zig-lib-dir\n\n", .{});
return usageAndErr(builder, false, stderr_stream); return usageAndErr(builder, false, stderr_stream);
}; };
} else if (mem.eql(u8, arg, "--verbose-tokenize")) { } else if (mem.eql(u8, arg, "--verbose-tokenize")) {
@ -234,7 +234,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
\\Advanced Options: \\Advanced Options:
\\ --build-file [file] Override path to build.zig \\ --build-file [file] Override path to build.zig
\\ --cache-dir [path] Override path to zig cache directory \\ --cache-dir [path] Override path to zig cache directory
\\ --override-lib-dir [arg] Override path to Zig lib directory \\ --zig-lib-dir [arg] Override path to Zig lib directory
\\ --verbose-tokenize Enable compiler debug output for tokenization \\ --verbose-tokenize Enable compiler debug output for tokenization
\\ --verbose-ast Enable compiler debug output for parsing into an AST \\ --verbose-ast Enable compiler debug output for parsing into an AST
\\ --verbose-link Enable compiler debug output for linking \\ --verbose-link Enable compiler debug output for linking

View File

@ -310,7 +310,7 @@ const usage_build_generic =
\\ --show-builtin Output the source of @import("builtin") then exit \\ --show-builtin Output the source of @import("builtin") then exit
\\ --cache-dir [path] Override the local cache directory \\ --cache-dir [path] Override the local cache directory
\\ --global-cache-dir [path] Override the global cache directory \\ --global-cache-dir [path] Override the global cache directory
\\ --override-lib-dir [path] Override path to Zig installation lib directory \\ --zig-lib-dir [path] Override path to Zig installation lib directory
\\ --enable-cache Output to cache directory; print path to stdout \\ --enable-cache Output to cache directory; print path to stdout
\\ \\
\\Compile Options: \\Compile Options:
@ -888,7 +888,7 @@ fn buildOutputType(
if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg}); if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
i += 1; i += 1;
override_global_cache_dir = args[i]; override_global_cache_dir = args[i];
} else if (mem.eql(u8, arg, "--override-lib-dir")) { } else if (mem.eql(u8, arg, "--zig-lib-dir")) {
if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg}); if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
i += 1; i += 1;
override_lib_dir = args[i]; override_lib_dir = args[i];
@ -2664,7 +2664,7 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
i += 1; i += 1;
build_file = args[i]; build_file = args[i];
continue; continue;
} else if (mem.eql(u8, arg, "--override-lib-dir")) { } else if (mem.eql(u8, arg, "--zig-lib-dir")) {
if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg}); if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
i += 1; i += 1;
override_lib_dir = args[i]; override_lib_dir = args[i];

View File

@ -351,7 +351,7 @@ int main(int argc, char **argv) {
out_name = argv[i]; out_name = argv[i];
} else if (strcmp(arg, "--dynamic-linker") == 0) { } else if (strcmp(arg, "--dynamic-linker") == 0) {
dynamic_linker = argv[i]; dynamic_linker = argv[i];
} else if (strcmp(arg, "--override-lib-dir") == 0) { } else if (strcmp(arg, "--zig-lib-dir") == 0) {
override_lib_dir = argv[i]; override_lib_dir = argv[i];
} else if (strcmp(arg, "--library") == 0 || strcmp(arg, "-l") == 0) { } else if (strcmp(arg, "--library") == 0 || strcmp(arg, "-l") == 0) {
if (strcmp(argv[i], "c") == 0) { if (strcmp(argv[i], "c") == 0) {
@ -433,7 +433,7 @@ int main(int argc, char **argv) {
} }
if (override_lib_dir == nullptr) { if (override_lib_dir == nullptr) {
fprintf(stderr, "missing --override-lib-dir\n"); fprintf(stderr, "missing --zig-lib-dir\n");
return print_error_usage(arg0); return print_error_usage(arg0);
} }