@@ -636,6 +636,20 @@ pub const Builder = struct {
636636 pub fn fmt (self : & Builder , comptime format : []const u8 , args : ... ) - > []u8 {
637637 return %% fmt_lib .allocPrint (self .allocator , format , args );
638638 }
639+
640+ fn getCCExe (self : & Builder ) - > []const u8 {
641+ if (builtin .environ == builtin .Environ .msvc ) {
642+ return "cl.exe" ;
643+ } else {
644+ return os .getEnvVarOwned (self .builder .allocator , "CC" ) %% | err | {
645+ if (err == error .EnvironmentVariableNotFound ) {
646+ ([]const u8 )("cc" )
647+ } else {
648+ return err
649+ }
650+ };
651+ }
652+ }
639653};
640654
641655const Version = struct {
@@ -685,6 +699,17 @@ const Target = enum {
685699 else = > false ,
686700 };
687701 }
702+
703+ pub fn isWindows (self : & const Target ) - > bool {
704+ return switch (self .getOs ()) {
705+ builtin .Os .windows = > true ,
706+ else = > false ,
707+ };
708+ }
709+
710+ pub fn wantSharedLibSymLinks (self : & const Target ) - > bool {
711+ return ! self .isWindows ();
712+ }
688713};
689714
690715pub const LibExeObjStep = struct {
@@ -885,7 +910,7 @@ pub const LibExeObjStep = struct {
885910 self .name_only_filename = self .builder .fmt ("lib{}.dylib" , self .name );
886911 },
887912 builtin .Os .windows = > {
888- self .out_filename = self .builder .fmt ("lib {}.dll" , self .name );
913+ self .out_filename = self .builder .fmt ("{}.dll" , self .name );
889914 },
890915 else = > {
891916 self .out_filename = self .builder .fmt ("lib{}.so.{d}.{d}.{d}" ,
@@ -1200,7 +1225,7 @@ pub const LibExeObjStep = struct {
12001225
12011226 % return builder .spawnChild (zig_args .toSliceConst ());
12021227
1203- if (self .kind == Kind .Lib and ! self .static ) {
1228+ if (self .kind == Kind .Lib and ! self .static and self . target . wantSharedLibSymLinks () ) {
12041229 % return doAtomicSymLinks (builder .allocator , output_path , self .major_only_filename ,
12051230 self .name_only_filename );
12061231 }
@@ -1252,15 +1277,10 @@ pub const LibExeObjStep = struct {
12521277 }
12531278
12541279 fn makeC (self : & LibExeObjStep ) - > % void {
1255- const cc = os .getEnvVarOwned (self .builder .allocator , "CC" ) %% | err | {
1256- if (err == error .EnvironmentVariableNotFound ) {
1257- ([]const u8 )("cc" )
1258- } else {
1259- return err
1260- }
1261- };
12621280 const builder = self .builder ;
12631281
1282+ const cc = builder .getCCExe ();
1283+
12641284 assert (! self .is_zig );
12651285
12661286 var cc_args = ArrayList ([]const u8 ).init (builder .allocator );
@@ -1390,8 +1410,10 @@ pub const LibExeObjStep = struct {
13901410
13911411 % return builder .spawnChild (cc_args .toSliceConst ());
13921412
1393- % return doAtomicSymLinks (builder .allocator , output_path , self .major_only_filename ,
1394- self .name_only_filename );
1413+ if (self .target .wantSharedLibSymLinks ()) {
1414+ % return doAtomicSymLinks (builder .allocator , output_path , self .major_only_filename ,
1415+ self .name_only_filename );
1416+ }
13951417 }
13961418 },
13971419 Kind .Exe = > {
0 commit comments