aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorJukka Jylänki <jujjyl@gmail.com>2013-11-16 13:41:46 +0200
committerJukka Jylänki <jujjyl@gmail.com>2013-11-16 13:42:20 +0200
commit64bad3adcff869595041e7f51d05fa4b43e46b05 (patch)
tree626f2aafed7db9a6acde398bf14e15a459a6ba95 /emcc
parent59bb612978c61fcfc069803f2f0d89bb604e0e78 (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-xemcc15
1 files changed, 13 insertions, 2 deletions
diff --git a/emcc b/emcc
index c3f9d862..a5d86fc8 100755
--- a/emcc
+++ b/emcc
@@ -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