aboutsummaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2012-01-27 16:32:46 -0500
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2012-01-27 16:32:46 -0500
commit86e53100067d5f0f6f87c389ca2a4743e0e777fd (patch)
tree8736ae935de8cc26bce682f84db564333852f2bf /emcc
parent01e21e541251d271d28e92b2c6b28a8290994470 (diff)
Add support for using a shell file except than the built-in one
This adds a --shell-file compiler option which allows users to use a custom shell file.
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc15
1 files changed, 14 insertions, 1 deletions
diff --git a/emcc b/emcc
index b1feeb59..cb8e41ae 100755
--- a/emcc
+++ b/emcc
@@ -164,6 +164,13 @@ Options that are modified or new in %s include:
will be run). Note that this by itself
will not minify the code (closure does
that)
+ --shell-path <path> The path name to a skeleton HTML file used
+ when generating HTML output. The shell file
+ used needs to have this token inside it:
+ {{{ SCRIPT_CODE }}}
+ Note that this argument is ignored if a
+ target other than HTML is specified using
+ the -o option.
The target file, if specified (-o <target>), defines what will
be generated:
@@ -282,6 +289,7 @@ try:
closure = None
js_transform = None
compress_whitespace = None
+ shell_path = shared.path_from_root('src', 'shell.html')
def check_bad_eq(arg):
assert '=' not in arg, 'Invalid parameter (do not use "=" with "--" options)'
@@ -321,6 +329,11 @@ try:
f.close()
newargs[i] = ''
newargs[i+1] = ''
+ elif newargs[i].startswith('--shell-file'):
+ check_bad_eq(newargs[i])
+ shell_path = newargs[i+1]
+ newargs[i] = ''
+ newargs[i+1] = ''
newargs = [ arg for arg in newargs if arg is not '' ]
if llvm_opt_level is None: llvm_opt_level = 1 if opt_level >= 1 else 0
@@ -626,7 +639,7 @@ try:
# If we were asked to also generate HTML, do that
if final_suffix == 'html':
if DEBUG: print >> sys.stderr, 'emcc: generating HTML'
- shell = open(shared.path_from_root('src', 'shell.html')).read()
+ shell = open(shell_path).read()
html = open(target, 'w')
html.write(shell.replace('{{{ SCRIPT_CODE }}}', open(final).read()))
html.close()