OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # This script is wrapper for Chromium that adds some support for how GYP | 7 # This script is wrapper for Chromium that adds some support for how GYP |
8 # is invoked by Chromium beyond what can be done in the gclient hooks. | 8 # is invoked by Chromium beyond what can be done in the gclient hooks. |
9 | 9 |
10 import glob | 10 import glob |
(...skipping 21 matching lines...) Expand all Loading... |
32 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) | 32 sys.path.insert(1, os.path.join(chrome_src, 'tools', 'grit')) |
33 sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build')) | 33 sys.path.insert(1, os.path.join(chrome_src, 'chrome', 'tools', 'build')) |
34 sys.path.insert(1, os.path.join(chrome_src, 'native_client', 'build')) | 34 sys.path.insert(1, os.path.join(chrome_src, 'native_client', 'build')) |
35 sys.path.insert(1, os.path.join(chrome_src, 'native_client_sdk', 'src', | 35 sys.path.insert(1, os.path.join(chrome_src, 'native_client_sdk', 'src', |
36 'build_tools')) | 36 'build_tools')) |
37 sys.path.insert(1, os.path.join(chrome_src, 'remoting', 'tools', 'build')) | 37 sys.path.insert(1, os.path.join(chrome_src, 'remoting', 'tools', 'build')) |
38 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'liblouis')) | 38 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'liblouis')) |
39 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit', | 39 sys.path.insert(1, os.path.join(chrome_src, 'third_party', 'WebKit', |
40 'Source', 'build', 'scripts')) | 40 'Source', 'build', 'scripts')) |
41 | 41 |
42 import find_depot_tools | |
43 | |
44 # On Windows, Psyco shortens warm runs of build/gyp_chromium by about | 42 # On Windows, Psyco shortens warm runs of build/gyp_chromium by about |
45 # 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70 | 43 # 20 seconds on a z600 machine with 12 GB of RAM, from 90 down to 70 |
46 # seconds. Conversely, memory usage of build/gyp_chromium with Psyco | 44 # seconds. Conversely, memory usage of build/gyp_chromium with Psyco |
47 # maxes out at about 158 MB vs. 132 MB without it. | 45 # maxes out at about 158 MB vs. 132 MB without it. |
48 # | 46 # |
49 # Psyco uses native libraries, so we need to load a different | 47 # Psyco uses native libraries, so we need to load a different |
50 # installation depending on which OS we are running under. It has not | 48 # installation depending on which OS we are running under. It has not |
51 # been tested whether using Psyco on our Mac and Linux builds is worth | 49 # been tested whether using Psyco on our Mac and Linux builds is worth |
52 # it (the GYP running time is a lot shorter, so the JIT startup cost | 50 # it (the GYP running time is a lot shorter, so the JIT startup cost |
53 # may not be worth it). | 51 # may not be worth it). |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 | 372 |
375 # Use the Psyco JIT if available. | 373 # Use the Psyco JIT if available. |
376 if psyco: | 374 if psyco: |
377 psyco.profile() | 375 psyco.profile() |
378 print "Enabled Psyco JIT." | 376 print "Enabled Psyco JIT." |
379 | 377 |
380 # Fall back on hermetic python if we happen to get run under cygwin. | 378 # Fall back on hermetic python if we happen to get run under cygwin. |
381 # TODO(bradnelson): take this out once this issue is fixed: | 379 # TODO(bradnelson): take this out once this issue is fixed: |
382 # http://code.google.com/p/gyp/issues/detail?id=177 | 380 # http://code.google.com/p/gyp/issues/detail?id=177 |
383 if sys.platform == 'cygwin': | 381 if sys.platform == 'cygwin': |
| 382 import find_depot_tools |
384 depot_tools_path = find_depot_tools.add_depot_tools_to_path() | 383 depot_tools_path = find_depot_tools.add_depot_tools_to_path() |
385 python_dir = sorted(glob.glob(os.path.join(depot_tools_path, | 384 python_dir = sorted(glob.glob(os.path.join(depot_tools_path, |
386 'python2*_bin')))[-1] | 385 'python2*_bin')))[-1] |
387 env = os.environ.copy() | 386 env = os.environ.copy() |
388 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') | 387 env['PATH'] = python_dir + os.pathsep + env.get('PATH', '') |
389 p = subprocess.Popen( | 388 p = subprocess.Popen( |
390 [os.path.join(python_dir, 'python.exe')] + sys.argv, | 389 [os.path.join(python_dir, 'python.exe')] + sys.argv, |
391 env=env, shell=False) | 390 env=env, shell=False) |
392 p.communicate() | 391 p.communicate() |
393 sys.exit(p.returncode) | 392 sys.exit(p.returncode) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 if sys.platform.startswith('win') and not os.environ.get('GYP_GENERATORS'): | 435 if sys.platform.startswith('win') and not os.environ.get('GYP_GENERATORS'): |
437 os.environ['GYP_GENERATORS'] = 'ninja' | 436 os.environ['GYP_GENERATORS'] = 'ninja' |
438 elif sys.platform == 'darwin' and not os.environ.get('GYP_GENERATORS') and \ | 437 elif sys.platform == 'darwin' and not os.environ.get('GYP_GENERATORS') and \ |
439 not 'OS=ios' in os.environ.get('GYP_DEFINES', []): | 438 not 'OS=ios' in os.environ.get('GYP_DEFINES', []): |
440 os.environ['GYP_GENERATORS'] = 'ninja' | 439 os.environ['GYP_GENERATORS'] = 'ninja' |
441 | 440 |
442 # If on windows, and the automatic toolchain has been installed by | 441 # If on windows, and the automatic toolchain has been installed by |
443 # depot_tools, then use it. | 442 # depot_tools, then use it. |
444 vs2013_runtime_dll_dirs = None | 443 vs2013_runtime_dll_dirs = None |
445 if sys.platform in ('win32', 'cygwin'): | 444 if sys.platform in ('win32', 'cygwin'): |
| 445 import find_depot_tools |
446 depot_tools_path = find_depot_tools.add_depot_tools_to_path() | 446 depot_tools_path = find_depot_tools.add_depot_tools_to_path() |
447 toolchain = os.path.normpath(os.path.join( | 447 toolchain = os.path.normpath(os.path.join( |
448 depot_tools_path, 'win_toolchain', 'vs2013_files')) | 448 depot_tools_path, 'win_toolchain', 'vs2013_files')) |
449 version_file = os.path.join(toolchain, '.version') | 449 version_file = os.path.join(toolchain, '.version') |
450 if os.path.isdir(toolchain) and os.path.isfile(version_file): | 450 if os.path.isdir(toolchain) and os.path.isfile(version_file): |
451 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain | 451 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain |
452 with open(version_file, 'r') as f: | 452 with open(version_file, 'r') as f: |
453 version_is_pro = f.read().strip() == 'pro' | 453 version_is_pro = f.read().strip() == 'pro' |
454 vs2013_runtime_dll_dirs = (os.path.join(toolchain, 'sys32'), | 454 vs2013_runtime_dll_dirs = (os.path.join(toolchain, 'sys32'), |
455 os.path.join(toolchain, 'sys64')) | 455 os.path.join(toolchain, 'sys64')) |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 # rather than a separate runhooks step so that any environment modifications | 496 # rather than a separate runhooks step so that any environment modifications |
497 # from above are picked up. | 497 # from above are picked up. |
498 print 'Running build/landmines.py...' | 498 print 'Running build/landmines.py...' |
499 subprocess.check_call( | 499 subprocess.check_call( |
500 [sys.executable, os.path.join(script_dir, 'landmines.py')]) | 500 [sys.executable, os.path.join(script_dir, 'landmines.py')]) |
501 | 501 |
502 if vs2013_runtime_dll_dirs: | 502 if vs2013_runtime_dll_dirs: |
503 CopyVsRuntimeDlls(GetOutputDirectory(), vs2013_runtime_dll_dirs) | 503 CopyVsRuntimeDlls(GetOutputDirectory(), vs2013_runtime_dll_dirs) |
504 | 504 |
505 sys.exit(gyp_rc) | 505 sys.exit(gyp_rc) |
OLD | NEW |