aboutsummaryrefslogtreecommitdiff
path: root/emscripten.py
diff options
context:
space:
mode:
Diffstat (limited to 'emscripten.py')
-rwxr-xr-xemscripten.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/emscripten.py b/emscripten.py
index e98775aa..a117a216 100755
--- a/emscripten.py
+++ b/emscripten.py
@@ -497,7 +497,7 @@ Runtime.stackRestore = function(top) { asm.stackRestore(top) };
outfile.close()
-def main(args, compiler_engine=None, jcache=None):
+def main(args, compiler_engine, jcache, relooper):
# Prepare settings for serialization to JSON.
settings = {}
for setting in args.settings:
@@ -571,7 +571,11 @@ def main(args, compiler_engine=None, jcache=None):
libraries = args.libraries[0].split(',') if len(args.libraries) > 0 else []
# Compile the assembly to Javascript.
- if settings.get('RELOOP'): shared.Building.ensure_relooper()
+ if settings.get('RELOOP'):
+ if not relooper:
+ relooper = shared.Cache.get_path('relooper.js')
+ settings.setdefault('RELOOPER', relooper)
+ shared.Building.ensure_relooper(relooper)
emscript(configuration, args.infile, settings, args.outfile, libraries,
compiler_engine=compiler_engine,
@@ -597,6 +601,9 @@ def _main(environ):
parser.add_option('-c', '--compiler',
default=shared.COMPILER_ENGINE,
help='Which JS engine to use to run the compiler; defaults to the one in ~/.emscripten.')
+ parser.add_option('--relooper',
+ default=None,
+ help='Which relooper file to use if RELOOP is enabled')
parser.add_option('-s', '--setting',
dest='settings',
default=[],
@@ -628,14 +635,17 @@ WARNING: You should normally never use this! Use emcc instead.
keywords.infile = os.path.abspath(positional[0])
if isinstance(keywords.outfile, basestring):
keywords.outfile = open(keywords.outfile, 'w')
+
if keywords.relooper:
- shared.RELOOPER = os.path.abspath(keywords.relooper)
- keywords.settings.append("RELOOPER=" + json.dumps(shared.RELOOPER))
+ relooper = os.path.abspath(keywords.relooper)
+ else:
+ relooper = None # use the cache
temp_files.run_and_clean(lambda: main(
keywords,
compiler_engine=os.path.abspath(keywords.compiler),
- jcache=shared.JCache if keywords.jcache else None))
+ jcache=shared.JCache if keywords.jcache else None,
+ relooper=relooper))
if __name__ == '__main__':
_main(environ=os.environ)