tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

0005.patch (4344B)


      1 From: Michael Froman <mfroman@mozilla.com>
      2 Date: Mon, 20 Jun 2022 22:34:00 +0000
      3 Subject: Bug 1775143 - pt7 - (mirror) a62f6186e9d6 r=ng
      4 
      5 (skip-generation)
      6 
      7 Depends on D149820
      8 
      9 Differential Revision: https://phabricator.services.mozilla.com/D149821
     10 Mercurial Revision: https://hg.mozilla.org/mozilla-central/rev/243ea5e6411dc1b769419c07045e78d61f406541
     11 ---
     12 toolchain/win/setup_toolchain.py | 58 +++++++++++++++++---------------
     13 1 file changed, 30 insertions(+), 28 deletions(-)
     14 
     15 diff --git a/toolchain/win/setup_toolchain.py b/toolchain/win/setup_toolchain.py
     16 index d6598893c..db0b07eb2 100644
     17 --- a/toolchain/win/setup_toolchain.py
     18 +++ b/toolchain/win/setup_toolchain.py
     19 @@ -251,7 +251,7 @@ def main():
     20 
     21   cpus = ('x86', 'x64', 'arm', 'arm64')
     22   assert target_cpu in cpus
     23 -  vc_bin_dir = ''
     24 +  vc_bin_dir = 'fake_path/cl.exe'
     25   include = ''
     26   lib = ''
     27 
     28 @@ -264,30 +264,30 @@ def main():
     29   def q(s):  # Quote s if it contains spaces or other weird characters.
     30     return s if re.match(r'^[a-zA-Z0-9._/\\:-]*$', s) else '"' + s + '"'
     31 
     32 -  for cpu in cpus:
     33 -    if cpu == target_cpu:
     34 -      # Extract environment variables for subprocesses.
     35 -      env = _LoadToolchainEnv(cpu, toolchain_root, win_sdk_path, target_store)
     36 -      env['PATH'] = runtime_dirs + os.pathsep + env['PATH']
     37 -
     38 -      vc_bin_dir = FindFileInEnvList(env, 'PATH', os.pathsep, 'cl.exe')
     39 -
     40 -      # The separator for INCLUDE here must match the one used in
     41 -      # _LoadToolchainEnv() above.
     42 -      include = [p.replace('"', r'\"') for p in env['INCLUDE'].split(';') if p]
     43 -      include = list(map(relflag, include))
     44 -
     45 -      lib = [p.replace('"', r'\"') for p in env['LIB'].split(';') if p]
     46 -      lib = list(map(relflag, lib))
     47 -
     48 -      include_I = ['/I' + i for i in include]
     49 -      include_imsvc = ['-imsvc' + i for i in include]
     50 -      libpath_flags = ['-libpath:' + i for i in lib]
     51 -
     52 -      if (environment_block_name != ''):
     53 -        env_block = _FormatAsEnvironmentBlock(env)
     54 -        with open(environment_block_name, 'w', encoding='utf8') as f:
     55 -          f.write(env_block)
     56 +#   for cpu in cpus:
     57 +#     if cpu == target_cpu:
     58 +#       # Extract environment variables for subprocesses.
     59 +#       env = _LoadToolchainEnv(cpu, toolchain_root, win_sdk_path, target_store)
     60 +#       env['PATH'] = runtime_dirs + os.pathsep + env['PATH']
     61 +# 
     62 +#       vc_bin_dir = FindFileInEnvList(env, 'PATH', os.pathsep, 'cl.exe')
     63 +# 
     64 +#       # The separator for INCLUDE here must match the one used in
     65 +#       # _LoadToolchainEnv() above.
     66 +#       include = [p.replace('"', r'\"') for p in env['INCLUDE'].split(';') if p]
     67 +#       include = list(map(relflag, include))
     68 +# 
     69 +#       lib = [p.replace('"', r'\"') for p in env['LIB'].split(';') if p]
     70 +#       lib = list(map(relflag, lib))
     71 +# 
     72 +#       include_I = ['/I' + i for i in include]
     73 +#       include_imsvc = ['-imsvc' + i for i in include]
     74 +#       libpath_flags = ['-libpath:' + i for i in lib]
     75 +# 
     76 +#       if (environment_block_name != ''):
     77 +#         env_block = _FormatAsEnvironmentBlock(env)
     78 +#         with open(environment_block_name, 'w', encoding='utf8') as f:
     79 +#           f.write(env_block)
     80 
     81   def ListToArgString(x):
     82     return gn_helpers.ToGNString(' '.join(q(i) for i in x))
     83 @@ -295,11 +295,14 @@ def main():
     84   def ListToArgList(x):
     85     return f'[{", ".join(gn_helpers.ToGNString(i) for i in x)}]'
     86 
     87 +  env = {}
     88 +  env['PATH'] = ''
     89 +  include_I = include
     90 +  include_imsvc = include
     91 +  libpath_flags = ''
     92   print('vc_bin_dir = ' + gn_helpers.ToGNString(vc_bin_dir))
     93 -  assert include_I
     94   print(f'include_flags_I = {ListToArgString(include_I)}')
     95   print(f'include_flags_I_list = {ListToArgList(include_I)}')
     96 -  assert include_imsvc
     97   if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', 1))) and win_sdk_path:
     98     flags = ['/winsysroot' + relflag(toolchain_root)]
     99     print(f'include_flags_imsvc = {ListToArgString(flags)}')
    100 @@ -308,7 +311,6 @@ def main():
    101     print(f'include_flags_imsvc = {ListToArgString(include_imsvc)}')
    102     print(f'include_flags_imsvc_list = {ListToArgList(include_imsvc)}')
    103   print('paths = ' + gn_helpers.ToGNString(env['PATH']))
    104 -  assert libpath_flags
    105   print(f'libpath_flags = {ListToArgString(libpath_flags)}')
    106   print(f'libpath_flags_list = {ListToArgList(libpath_flags)}')
    107   if bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', 1))) and win_sdk_path: