zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit c9352ef9d6d9f1bca94c25710e11de0ae171605f (tree)
parent 078a7ff198c46aea98b8837ae9fab52626dd01a0
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 24 Nov 2021 23:09:27 -0700

stage2: fix logic for default -femit-implib path

Previously when using `--enable-cache` and creating a Windows DLL,
without overriding the `-femit-implib` option, Zig would incorrectly
dump the .lib file to the current working directory, rather than
outputting it into the artifact directory, next to the .dll file.

Fixed.

Diffstat:
Msrc/main.zig | 24+++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/main.zig b/src/main.zig @@ -2130,18 +2130,20 @@ fn buildOutputType( } } const default_implib_basename = try std.fmt.allocPrint(arena, "{s}.lib", .{root_name}); - var emit_implib_resolved = emit_implib.resolve(default_implib_basename) catch |err| { - switch (emit_implib) { - .yes => |p| { - fatal("unable to open directory from argument '-femit-implib', '{s}': {s}", .{ - p, @errorName(err), - }); - }, - .yes_default_path => { - fatal("unable to open directory 'docs': {s}", .{@errorName(err)}); + var emit_implib_resolved = switch (emit_implib) { + .no => Emit.Resolved{ .data = null, .dir = null }, + .yes => |p| emit_implib.resolve(default_implib_basename) catch |err| { + fatal("unable to open directory from argument '-femit-implib', '{s}': {s}", .{ + p, @errorName(err), + }); + }, + .yes_default_path => Emit.Resolved{ + .data = Compilation.EmitLoc{ + .directory = emit_bin_loc.?.directory, + .basename = default_implib_basename, }, - .no => unreachable, - } + .dir = null, + }, }; defer emit_implib_resolved.deinit();