Index: build/build_nexe.py |
=================================================================== |
--- build/build_nexe.py (revision 12488) |
+++ build/build_nexe.py (working copy) |
@@ -98,18 +98,33 @@ |
return out_ts <= src_ts |
-def GetGomaPath(osname, arch, toolname): |
+def GetGomaPath(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'] |
or toolname not in ['newlib', 'glibc'] |
- or os.environ.get('NO_NACL_GOMA', None)): |
+ or os.environ.get('NO_NACL_GOMA'): |
return None |
try: |
gomacc_base = 'gomacc.exe' if os.name == 'nt' else 'gomacc' |
- for directory in os.environ.get('PATH', '').split(os.path.pathsep): |
+ # Search order of gomacc: |
+ # --gomadir command argument -> GOMA_DIR env. -> PATH env. |
+ search_path = [] |
+ # 1. --gomadir in the command argument. |
+ if gomadir: |
+ search_path.append(gomadir) |
+ # 2. Use GOMA_DIR environment variable if exist. |
+ goma_dir_env = os.environ.get('GOMA_DIR') |
+ if goma_dir_env: |
+ search_path.append(gomadir_env) |
+ # 3. Append PATH env. |
+ path_env = os.environ.get('PATH') |
+ if path_env: |
+ search_path.extend(path_env.split(os.path.pathsep)) |
+ |
+ for directory in search_path: |
gomacc = os.path.join(directory, gomacc_base) |
if os.path.isfile(gomacc): |
port = subprocess.Popen( |
@@ -223,7 +238,7 @@ |
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) |
+ self.gomacc = GetGomaPath(options.gomadir, self.osname, arch, toolname) |
# Use unoptimized native objects for debug IRT builds for faster compiles. |
if (self.is_pnacl_toolchain |
@@ -697,6 +712,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 +748,7 @@ |
build.Translate(list(files)[0]) |
return 0 |
- if build.gomacc: # use goma build. |
+ if build.gomacc: # execute gomacc as many as possible. |
returns = Queue.Queue() |
def CompileThread(filename, queue): |
try: |