Index: build/build_nexe.py |
=================================================================== |
--- build/build_nexe.py (revision 12352) |
+++ build/build_nexe.py (working copy) |
@@ -98,18 +98,28 @@ |
return out_ts <= src_ts |
-def GetGomaPath(osname, arch, toolname): |
+def GetGomaConfig(gomadir, osname, arch, toolname): |
"""Returns full-path of gomacc if goma is available or None.""" |
# Start goma support from os/arch/toolname that have been tested. |
# Set NO_NACL_GOMA=true to force to avoid using goma. |
- if (osname != 'linux' or arch not in ['x86-32', 'x86-64'] |
+ if (osname not in ['linux'] |
bradn
2013/11/12 22:32:56
why this change?
Yoshisato Yanagisawa
2013/11/12 23:01:24
For ease of adding new OS but I understand one cha
|
+ or arch not in ['x86-32', 'x86-64'] |
or toolname not in ['newlib', 'glibc'] |
or os.environ.get('NO_NACL_GOMA', None)): |
- return None |
+ return {} |
+ goma_config = {} |
try: |
gomacc_base = 'gomacc.exe' if os.name == 'nt' else 'gomacc' |
- for directory in os.environ.get('PATH', '').split(os.path.pathsep): |
+ search_path = os.environ.get('PATH', '').split(os.path.pathsep) |
+ # Use GOMA_DIR environmental variable if exist. |
+ goma_dir_env = os.environ.get('GOMA_DIR', None) |
+ if goma_dir_env: |
+ search_path.insert(0, gomadir_env) |
+ # Use gomadir in the command argument. |
bradn
2013/11/12 22:32:56
Maybe make clear that the command line trumps the
Yoshisato Yanagisawa
2013/11/12 23:01:24
Done.
|
+ if gomadir: |
+ search_path.insert(0, gomadir) |
+ for directory in search_path: |
gomacc = os.path.join(directory, gomacc_base) |
if os.path.isfile(gomacc): |
port = subprocess.Popen( |
@@ -118,13 +128,19 @@ |
status = urllib2.urlopen( |
'http://127.0.0.1:%s/healthz' % port).read().strip() |
if status == 'ok': |
- return gomacc |
+ goma_config['gomacc'] = gomacc |
+ break |
except Exception: |
# Anyway, fallbacks to non-goma mode. |
pass |
- return None |
+ if goma_config: |
+ goma_config['burst'] = False |
+ if osname == 'linux' and not os.environ.get('NO_NACL_GOMA_BURST', None): |
+ goma_config['burst'] = True |
+ return goma_config |
+ |
class Builder(object): |
"""Builder object maintains options and generates build command-lines. |
@@ -223,7 +239,9 @@ |
self.strip_all = options.strip_all |
self.strip_debug = options.strip_debug |
self.finalize_pexe = options.finalize_pexe and arch == 'pnacl' |
- self.gomacc = GetGomaPath(self.osname, arch, toolname) |
+ goma_config = GetGomaConfig(options.gomadir, self.osname, arch, toolname) |
+ self.gomacc = goma_config.get('gomacc', '') |
+ self.goma_burst = goma_config.get('burst', False) |
# Use unoptimized native objects for debug IRT builds for faster compiles. |
if (self.is_pnacl_toolchain |
@@ -697,6 +715,8 @@ |
help='Set the path for of the toolchains.') |
parser.add_option('--config-name', dest='build_config', |
help='GYP build configuration name (Release/Debug)') |
+ parser.add_option('--gomadir', dest='gomadir', |
+ help='Path of the goma directory.') |
options, files = parser.parse_args(argv[1:]) |
if not argv: |
@@ -731,7 +751,7 @@ |
build.Translate(list(files)[0]) |
return 0 |
- if build.gomacc: # use goma build. |
+ if build.gomacc and build.goma_burst: # execute gomacc as many as possible. |
returns = Queue.Queue() |
def CompileThread(filename, queue): |
try: |