authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-08-01 18:42:37-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-08-03 09:52:14-07:00
log89c605d140bf295e052cdded4e2c453f7a143d6f
tree70d8e402129b7925a7bfe3c6bbd0125cfec52506
parenta1e21ceec8ecb475f96c5e83ee9f8d59ceecc82d

CLI: add --ambiguous-static-library

I hate this, gonna revert it in the next commit

1 files changed, 15 insertions(+), 2 deletions(-)

src/main.zig+15-2
......@@ -477,9 +477,15 @@ const usage_build_generic =
477477 \\ -l[lib], --library [lib] Link against system library (only if actually used)
478478 \\ -needed-l[lib], Link against system library (even if unused)
479479 \\ --needed-library [lib]
480 \\ --ambiguous-static-library [l] Link against system library, checking for a
481 \\ static lib in each search path, then checking
482 \\ for a dynamic lib in each search path. Use of
483 \\ this CLI option is a code smell.
480484 \\ -L[d], --library-directory [d] Add a directory to the library search path
481 \\ -search_paths_first Search each library search path for dynamic libs then static libs
482 \\ -search_dylibs_first Search for dynamic libs in each library search path, then static libs.
485 \\ -search_paths_first For each library search path, check for dynamic
486 \\ lib then static lib before proceeding to next path.
487 \\ -search_dylibs_first Search for dynamic libs in all library search
488 \\ paths, then static libs.
483489 \\ -T[script], --script [script] Use a custom linker script
484490 \\ --version-script [path] Provide a version .map file
485491 \\ --dynamic-linker [path] Set the dynamic interpreter path (usually ld.so)
......@@ -1155,6 +1161,13 @@ fn buildOutputType(
11551161 .preferred_mode = lib_preferred_mode orelse .Dynamic,
11561162 .search_strategy = lib_search_strategy orelse .no_fallback,
11571163 });
1164 } else if (mem.eql(u8, arg, "--ambiguous-static-library")) {
1165 try system_libs.put(args_iter.nextOrFatal(), .{
1166 .needed = false,
1167 .weak = false,
1168 .preferred_mode = lib_preferred_mode orelse .Static,
1169 .search_strategy = lib_search_strategy orelse .mode_first,
1170 });
11581171 } else if (mem.eql(u8, arg, "-D")) {
11591172 try clang_argv.append(arg);
11601173 try clang_argv.append(args_iter.nextOrFatal());