aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2012-01-27 16:35:21 -0500
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2012-01-27 16:35:21 -0500
commit9c1b4038ae78dfabe7342a31f9bfa9477c658994 (patch)
treea9ab1b871df220ee9cc425b84c02c75d11010c6d
parent57a4b89c54757caeda4a589b682ad04a2cd3ce10 (diff)
parent86e53100067d5f0f6f87c389ca2a4743e0e777fd (diff)
Merge branch 'support-html-template' into glgears
-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()