OLD | NEW |
1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import contextlib | 5 import contextlib |
6 import fnmatch | 6 import fnmatch |
7 import os | 7 import os |
8 import re | 8 import re |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 sys.stdout.write(log_file.read()) | 369 sys.stdout.write(log_file.read()) |
370 raise | 370 raise |
371 | 371 |
372 duration = FormatTimeDelta(time.time() - start) | 372 duration = FormatTimeDelta(time.time() - start) |
373 util.LogHeading('Build complete', ' [took %s]' % duration) | 373 util.LogHeading('Build complete', ' [took %s]' % duration) |
374 | 374 |
375 def RunBuildSh(self): | 375 def RunBuildSh(self): |
376 build_port = os.path.join(paths.TOOLS_DIR, 'build_port.sh') | 376 build_port = os.path.join(paths.TOOLS_DIR, 'build_port.sh') |
377 cmd = [build_port] | 377 cmd = [build_port] |
378 | 378 |
| 379 if self.config.toolchain == 'emscripten': |
| 380 util.SetupEmscripten() |
379 env = os.environ.copy() | 381 env = os.environ.copy() |
380 env['TOOLCHAIN'] = self.config.toolchain | 382 env['TOOLCHAIN'] = self.config.toolchain |
381 env['NACL_ARCH'] = self.config.arch | 383 env['NACL_ARCH'] = self.config.arch |
382 env['NACL_DEBUG'] = self.config.debug and '1' or '0' | 384 env['NACL_DEBUG'] = self.config.debug and '1' or '0' |
383 env['NACL_SDK_ROOT'] = util.GetSDKRoot() | 385 env['NACL_SDK_ROOT'] = util.GetSDKRoot() |
384 if self.config.toolchain == 'emscripten': | |
385 env['EMSCRIPTEN'] = util.GetEmscriptenRoot() | |
386 rtn = subprocess.call(cmd, | 386 rtn = subprocess.call(cmd, |
387 stdout=sys.stdout, | 387 stdout=sys.stdout, |
388 stderr=sys.stderr, | 388 stderr=sys.stderr, |
389 cwd=self.root, | 389 cwd=self.root, |
390 env=env) | 390 env=env) |
391 if rtn != 0: | 391 if rtn != 0: |
392 raise Error("Building %s: failed." % (self.NAME)) | 392 raise Error("Building %s: failed." % (self.NAME)) |
393 | 393 |
394 def Download(self, force_mirror=None): | 394 def Download(self, force_mirror=None): |
395 """Download upstream sources and verify integrity.""" | 395 """Download upstream sources and verify integrity.""" |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
786 if os.path.isdir(package_name): | 786 if os.path.isdir(package_name): |
787 return SourcePackage(package_name, config) | 787 return SourcePackage(package_name, config) |
788 | 788 |
789 for subdir in DEFAULT_LOCATIONS: | 789 for subdir in DEFAULT_LOCATIONS: |
790 pkg_root = os.path.join(paths.NACLPORTS_ROOT, subdir, package_name) | 790 pkg_root = os.path.join(paths.NACLPORTS_ROOT, subdir, package_name) |
791 info = os.path.join(pkg_root, 'pkg_info') | 791 info = os.path.join(pkg_root, 'pkg_info') |
792 if os.path.exists(info): | 792 if os.path.exists(info): |
793 return SourcePackage(pkg_root, config) | 793 return SourcePackage(pkg_root, config) |
794 | 794 |
795 raise Error("Package not found: %s" % package_name) | 795 raise Error("Package not found: %s" % package_name) |
OLD | NEW |