Commit c434a9a573

Andrew Kelley <andrew@ziglang.org>
2021-06-14 20:33:27
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.
1 parent 5df5937
ci/azure/linux_script
@@ -79,7 +79,7 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then
   # Produce the experimental std lib documentation.
   mkdir -p release/docs/std
   release/bin/zig test ../lib/std/std.zig \
-    --override-lib-dir ../lib \
+    --zig-lib-dir ../lib \
     -femit-docs=release/docs/std \
     -fno-emit-bin
 
ci/azure/macos_arm64_script
@@ -94,7 +94,7 @@ if [ "${BUILD_REASON}" != "PullRequest" ]; then
   # Produce the experimental std lib documentation.
   mkdir -p release/docs/std
   $ZIG test ../lib/std/std.zig \
-    --override-lib-dir ../lib \
+    --zig-lib-dir ../lib \
     -femit-docs=release/docs/std \
     -fno-emit-bin
 
lib/std/crypto/benchmark.zig
@@ -3,7 +3,7 @@
 // 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
 // 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 builtin = std.builtin;
lib/std/hash/benchmark.zig
@@ -3,7 +3,7 @@
 // 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
 // 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 std = @import("std");
lib/std/special/build_runner.zig
@@ -119,9 +119,9 @@ pub fn main() !void {
                     warn("expected [auto|on|off] after --color, found '{s}'", .{next_arg});
                     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 {
-                    warn("Expected argument after --override-lib-dir\n\n", .{});
+                    warn("Expected argument after --zig-lib-dir\n\n", .{});
                     return usageAndErr(builder, false, stderr_stream);
                 };
             } 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:
         \\  --build-file [file]         Override path to build.zig
         \\  --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-ast               Enable compiler debug output for parsing into an AST
         \\  --verbose-link              Enable compiler debug output for linking
lib/std/build.zig
@@ -2716,10 +2716,10 @@ pub const LibExeObjStep = struct {
         }
 
         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));
         } 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));
         }
 
lib/std/os.zig
@@ -41,7 +41,7 @@ pub const wasi = @import("os/wasi.zig");
 pub const windows = @import("os/windows.zig");
 
 comptime {
-    assert(@import("std") == std); // std lib tests require --override-lib-dir
+    assert(@import("std") == std); // std lib tests require --zig-lib-dir
 }
 
 test {
src/stage1/zig0.cpp
@@ -351,7 +351,7 @@ int main(int argc, char **argv) {
                     out_name = argv[i];
                 } else if (strcmp(arg, "--dynamic-linker") == 0) {
                     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];
                 } else if (strcmp(arg, "--library") == 0 || strcmp(arg, "-l") == 0) {
                     if (strcmp(argv[i], "c") == 0) {
@@ -433,7 +433,7 @@ int main(int argc, char **argv) {
     }
 
     if (override_lib_dir == nullptr) {
-        fprintf(stderr, "missing --override-lib-dir\n");
+        fprintf(stderr, "missing --zig-lib-dir\n");
         return print_error_usage(arg0);
     }
 
src/main.zig
@@ -310,7 +310,7 @@ const usage_build_generic =
     \\  --show-builtin            Output the source of @import("builtin") then exit
     \\  --cache-dir [path]        Override the local 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
     \\
     \\Compile Options:
@@ -888,7 +888,7 @@ fn buildOutputType(
                         if (i + 1 >= args.len) fatal("expected parameter after {s}", .{arg});
                         i += 1;
                         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});
                         i += 1;
                         override_lib_dir = args[i];
@@ -2664,7 +2664,7 @@ pub fn cmdBuild(gpa: *Allocator, arena: *Allocator, args: []const []const u8) !v
                         i += 1;
                         build_file = args[i];
                         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});
                         i += 1;
                         override_lib_dir = args[i];
CMakeLists.txt
@@ -782,7 +782,7 @@ set(BUILD_ZIG1_ARGS
     -target "${ZIG_TARGET_TRIPLE}"
     "-mcpu=${ZIG_TARGET_MCPU}"
     --name zig1
-    --override-lib-dir "${CMAKE_SOURCE_DIR}/lib"
+    --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
     "-femit-bin=${ZIG1_OBJECT}"
     "${ZIG1_RELEASE_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)
     set(ZIG_INSTALL_ARGS "build"
-        --override-lib-dir "${CMAKE_SOURCE_DIR}/lib"
+        --zig-lib-dir "${CMAKE_SOURCE_DIR}/lib"
         "-Dlib-files-only"
         --prefix "${CMAKE_INSTALL_PREFIX}"
         "-Dconfig_h=${ZIG_CONFIG_H_OUT}"