@@ -1037,12 +1037,13 @@ def WriteLinkForArch(self, ninja_file, spec, config_name, config,
10371037 self .GypPathToNinja , arch )
10381038 ldflags = env_ldflags + ldflags
10391039 elif self .flavor == 'win' :
1040- manifest_name = self .GypPathToUniqueOutput (
1040+ manifest_base_name = self .GypPathToUniqueOutput (
10411041 self .ComputeOutputFileName (spec ))
10421042 ldflags , intermediate_manifest , manifest_files = \
10431043 self .msvs_settings .GetLdflags (config_name , self .GypPathToNinja ,
1044- self .ExpandSpecial , manifest_name ,
1045- is_executable , self .toplevel_build )
1044+ self .ExpandSpecial , manifest_base_name ,
1045+ output , is_executable ,
1046+ self .toplevel_build )
10461047 ldflags = env_ldflags + ldflags
10471048 self .WriteVariableList (ninja_file , 'manifests' , manifest_files )
10481049 implicit_deps = implicit_deps .union (manifest_files )
@@ -1095,16 +1096,27 @@ def WriteLinkForArch(self, ninja_file, spec, config_name, config,
10951096 extra_bindings .append (('lib' ,
10961097 gyp .common .EncodePOSIXShellArgument (output )))
10971098 if self .flavor == 'win' :
1098- extra_bindings .append (('dll ' , output ))
1099+ extra_bindings .append (('binary ' , output ))
10991100 if '/NOENTRY' not in ldflags :
11001101 self .target .import_lib = output + '.lib'
11011102 extra_bindings .append (('implibflag' ,
11021103 '/IMPLIB:%s' % self .target .import_lib ))
1104+ pdbname = self .msvs_settings .GetPDBName (
1105+ config_name , self .ExpandSpecial , output + '.pdb' )
11031106 output = [output , self .target .import_lib ]
1107+ if pdbname :
1108+ output .append (pdbname )
11041109 elif not self .is_mac_bundle :
11051110 output = [output , output + '.TOC' ]
11061111 else :
11071112 command = command + '_notoc'
1113+ elif self .flavor == 'win' :
1114+ extra_bindings .append (('binary' , output ))
1115+ pdbname = self .msvs_settings .GetPDBName (
1116+ config_name , self .ExpandSpecial , output + '.pdb' )
1117+ if pdbname :
1118+ output = [output , pdbname ]
1119+
11081120
11091121 if len (solibs ):
11101122 extra_bindings .append (('solibs' , gyp .common .EncodePOSIXShellList (solibs )))
@@ -1545,7 +1557,10 @@ class MEMORYSTATUSEX(ctypes.Structure):
15451557
15461558 mem_limit = max (1 , stat .ullTotalPhys / (4 * (2 ** 30 ))) # total / 4GB
15471559 hard_cap = max (1 , int (os .getenv ('GYP_LINK_CONCURRENCY_MAX' , 2 ** 32 )))
1548- return min (mem_limit , hard_cap )
1560+ # return min(mem_limit, hard_cap)
1561+ # TODO(scottmg): Temporary speculative fix for OOM on builders
1562+ # See http://crbug.com/333000.
1563+ return 2
15491564 elif sys .platform .startswith ('linux' ):
15501565 with open ("/proc/meminfo" ) as meminfo :
15511566 memtotal_re = re .compile (r'^MemTotal:\s*(\d*)\s*kB' )
@@ -1591,33 +1606,35 @@ def FullLinkCommand(ldcmd, out, binary_type):
15911606 'resname' : resource_name ,
15921607 'embed' : embed_manifest }
15931608 rule_name_suffix = _GetWinLinkRuleNameSuffix (embed_manifest )
1594- dlldesc = 'LINK%s(DLL) $dll' % rule_name_suffix .upper ()
1595- dllcmd = ('%s gyp-win-tool link-wrapper $arch '
1596- '$ld /nologo $implibflag /DLL /OUT:$dll '
1597- '/PDB:$dll.pdb @$dll.rsp' % sys .executable )
1598- dllcmd = FullLinkCommand (dllcmd , '$dll' , 'dll' )
1609+ use_separate_mspdbsrv = (
1610+ int (os .environ .get ('GYP_USE_SEPARATE_MSPDBSRV' , '0' )) != 0 )
1611+ dlldesc = 'LINK%s(DLL) $binary' % rule_name_suffix .upper ()
1612+ dllcmd = ('%s gyp-win-tool link-wrapper $arch %s '
1613+ '$ld /nologo $implibflag /DLL /OUT:$binary '
1614+ '@$binary.rsp' % (sys .executable , use_separate_mspdbsrv ))
1615+ dllcmd = FullLinkCommand (dllcmd , '$binary' , 'dll' )
15991616 master_ninja .rule ('solink' + rule_name_suffix ,
16001617 description = dlldesc , command = dllcmd ,
1601- rspfile = '$dll .rsp' ,
1618+ rspfile = '$binary .rsp' ,
16021619 rspfile_content = '$libs $in_newline $ldflags' ,
16031620 restat = True ,
16041621 pool = 'link_pool' )
16051622 master_ninja .rule ('solink_module' + rule_name_suffix ,
16061623 description = dlldesc , command = dllcmd ,
1607- rspfile = '$dll .rsp' ,
1624+ rspfile = '$binary .rsp' ,
16081625 rspfile_content = '$libs $in_newline $ldflags' ,
16091626 restat = True ,
16101627 pool = 'link_pool' )
16111628 # Note that ldflags goes at the end so that it has the option of
16121629 # overriding default settings earlier in the command line.
1613- exe_cmd = ('%s gyp-win-tool link-wrapper $arch '
1614- '$ld /nologo /OUT:$out /PDB:$out.pdb @$out .rsp' %
1615- sys .executable )
1616- exe_cmd = FullLinkCommand (exe_cmd , '$out ' , 'exe' )
1630+ exe_cmd = ('%s gyp-win-tool link-wrapper $arch %s '
1631+ '$ld /nologo /OUT:$binary @$binary .rsp' %
1632+ ( sys .executable , use_separate_mspdbsrv ) )
1633+ exe_cmd = FullLinkCommand (exe_cmd , '$binary ' , 'exe' )
16171634 master_ninja .rule ('link' + rule_name_suffix ,
1618- description = 'LINK%s $out ' % rule_name_suffix .upper (),
1635+ description = 'LINK%s $binary ' % rule_name_suffix .upper (),
16191636 command = exe_cmd ,
1620- rspfile = '$out .rsp' ,
1637+ rspfile = '$binary .rsp' ,
16211638 rspfile_content = '$in_newline $libs $ldflags' ,
16221639 pool = 'link_pool' )
16231640
@@ -1877,7 +1894,7 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
18771894 master_ninja .rule (
18781895 'alink' ,
18791896 description = 'LIB $out' ,
1880- command = ('%s gyp-win-tool link-wrapper $arch '
1897+ command = ('%s gyp-win-tool link-wrapper $arch False '
18811898 '$ar /nologo /ignore:4221 /OUT:$out @$out.rsp' %
18821899 sys .executable ),
18831900 rspfile = '$out.rsp' ,
@@ -2027,7 +2044,8 @@ def GenerateOutputForConfig(target_list, target_dicts, data, params,
20272044
20282045 this_make_global_settings = data [build_file ].get ('make_global_settings' , [])
20292046 assert make_global_settings == this_make_global_settings , (
2030- "make_global_settings needs to be the same for all targets." )
2047+ "make_global_settings needs to be the same for all targets. %s vs. %s" %
2048+ (this_make_global_settings , make_global_settings ))
20312049
20322050 spec = target_dicts [qualified_target ]
20332051 if flavor == 'mac' :
0 commit comments