diff options
author | Jukka Jylänki <jujjyl@gmail.com> | 2013-11-16 13:41:46 +0200 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-11-16 13:42:20 +0200 |
commit | 64bad3adcff869595041e7f51d05fa4b43e46b05 (patch) | |
tree | 626f2aafed7db9a6acde398bf14e15a459a6ba95 /emcc | |
parent | 59bb612978c61fcfc069803f2f0d89bb604e0e78 (diff) |
Relax emcc --compression cmdline parameter on Windows to autodetect encoder and decoder file suffix so same cmdline works on Windows and Linux. Fixes browser.test_compression on Windows.
Diffstat (limited to 'emcc')
-rwxr-xr-x | emcc | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -62,6 +62,8 @@ ASSEMBLY_SUFFIXES = ('.ll',) LIB_PREFIXES = ('', 'lib') JS_CONTAINING_SUFFIXES = ('js', 'html') +WINDOWS = sys.platform.startswith('win') + # Mapping of emcc opt levels to llvm opt levels. We use llvm opt level 3 in emcc opt # levels 2 and 3 (emcc 3 is unsafe opts, so unsuitable for the only level to get # llvm opt level 3, and speed-wise emcc level 2 is already the slowest/most optimizing @@ -887,8 +889,17 @@ try: check_bad_eq(newargs[i]) parts = newargs[i+1].split(',') assert len(parts) == 3, '--compression requires specifying native_encoder,js_decoder,js_name - see emcc --help. got: %s' % newargs[i+1] - Compression.encoder = parts[0] - Compression.decoder = parts[1] + def locate(tool): + if WINDOWS: + if os.path.exists(tool+'.exe'): + return tool+'.exe' + if os.path.exists(tool+'.bat'): + return tool+'.bat' + if os.path.exists(tool+'.cmd'): + return tool+'.cmd' + return tool + Compression.encoder = locate(parts[0]) + Compression.decoder = locate(parts[1]) Compression.js_name = parts[2] assert os.path.exists(Compression.encoder), 'native encoder %s does not exist' % Compression.encoder assert os.path.exists(Compression.decoder), 'js decoder %s does not exist' % Compression.decoder |