diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-05-24 10:13:42 +0200 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-05-24 10:13:42 +0200 |
commit | a6d312ccb942b50287777fc22dc69de926ea3412 (patch) | |
tree | 0acabef2e78a97e7cd1742b9d98acb2a1b496e72 | |
parent | c3570e254952ba0593038993674473e900ada9e0 (diff) | |
parent | b7ce870dd4b1352e308e212e77cd6161c1ec904e (diff) |
Merge branch 'master' into llvmsvn
117 files changed, 17558 insertions, 963 deletions
@@ -20,3 +20,5 @@ under the licensing terms detailed in LICENSE. * David Benjamin <davidben@mit.edu> * Pierre Renaux <pierre@talansoft.com> * Brian Anderson <banderson@mozilla.com> +* Jon Bardin <diclophis@gmail.com> +* Jukka Jylänki <jujjyl@gmail.com> diff --git a/em-config b/em-config new file mode 100755 index 00000000..dee399ed --- /dev/null +++ b/em-config @@ -0,0 +1,24 @@ +#!/usr/bin/env python + +''' +This is a helper tool which is designed to make it possible +for other apps to read emscripten's configuration variables +in a unified way. Usage: + + em-config VAR_NAME + +This tool prints the value of the variable to stdout if one +is found, or exits with 1 if the variable does not exist. +''' + +import os, sys, re +from tools import shared + +if len(sys.argv) != 2 or \ + not re.match(r"^[\w\W_][\w\W_\d]*$", sys.argv[1]) or \ + not (sys.argv[1] in dir(shared)): + print 'Usage: em-config VAR_NAME' + exit(1) + +print eval('shared.' + sys.argv[1]) + @@ -272,6 +272,10 @@ Options that are modified or new in %s include: --js-library <lib> A JavaScript library to use in addition to those in Emscripten's src/library_* + -v Turns on verbose output. This will pass + -v to Clang, and also enable EMCC_DEBUG + to details emcc's operations + The target file, if specified (-o <target>), defines what will be generated: @@ -293,6 +297,9 @@ the source of emcc (search for 'os.environ'). ''' % (this, this, this) exit(0) +elif len(sys.argv) == 2 and sys.argv[1] == '-v': # -v with no inputs + print 'emcc (Emscripten GCC-like replacement) 2.0' + exit(subprocess.call([shared.CLANG, '-v'])) # If this is a configure-type thing, do not compile to JavaScript, instead use clang # to compile to a native binary (using our headers, so things make sense later) @@ -513,6 +520,10 @@ try: elif newargs[i] == '--ignore-dynamic-linking': ignore_dynamic_linking = True newargs[i] = '' + elif newargs[i] == '-v': + shared.COMPILER_OPTS += ['-v'] + DEBUG = 1 + newargs[i] = '' elif newargs[i].startswith('--shell-file'): check_bad_eq(newargs[i]) shell_path = newargs[i+1] @@ -700,17 +711,18 @@ try: else: assert not has_dash_c, 'fatal error: cannot specify -o with -c with multiple files' + str(sys.argv) # We have a specified target (-o <target>), which is not JavaScript or HTML, and - # we have multiple files: Link them TODO: llvm link-time opts? - ld_args = temp_files + ['-b', specified_target] - #[arg.split('-Wl,')[1] for arg in filter(lambda arg: arg.startswith('-Wl,'), sys.argv)] - if DEBUG: print >> sys.stderr, 'emcc: link: ' + str(ld_args) - execute([shared.LLVM_LD, '-disable-opt'] + ld_args) + # we have multiple files: Link them + if DEBUG: print >> sys.stderr, 'emcc: link: ' + str(temp_files) + shared.Building.link(temp_files, specified_target) exit(0) ## Continue on to create JavaScript if DEBUG: print >> sys.stderr, 'emcc: will generate JavaScript' + if final_suffix == 'html': + shared.Settings.GENERATING_HTML = 1 + extra_files_to_link = [] if not LEAVE_INPUTS_RAW and not AUTODEBUG: @@ -722,9 +734,9 @@ try: # dlmalloc def create_dlmalloc(): if DEBUG: print >> sys.stderr, 'emcc: building dlmalloc for cache' - execute(['python', shared.EMCC, shared.path_from_root('system', 'lib', 'dlmalloc.c'), '-g', '-o', in_temp('dlmalloc.o')], stdout=stdout, stderr=stderr) + execute(shared.ENV_PREFIX + ['python', shared.EMCC, shared.path_from_root('system', 'lib', 'dlmalloc.c'), '-g', '-o', in_temp('dlmalloc.o')], stdout=stdout, stderr=stderr) # we include the libc++ new stuff here, so that the common case of using just new/delete is quick to link - execute(['python', shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', 'new.cpp'), '-g', '-o', in_temp('new.o')], stdout=stdout, stderr=stderr) + execute(shared.ENV_PREFIX + ['python', shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', 'new.cpp'), '-g', '-o', in_temp('new.o')], stdout=stdout, stderr=stderr) shared.Building.link([in_temp('dlmalloc.o'), in_temp('new.o')], in_temp('dlmalloc_full.o')) return in_temp('dlmalloc_full.o') def fix_dlmalloc(): @@ -846,7 +858,7 @@ try: if AUTODEBUG: if DEBUG: print >> sys.stderr, 'emcc: autodebug' - execute(['python', shared.AUTODEBUGGER, final, final + '.ad.ll']) + execute(shared.ENV_PREFIX + ['python', shared.AUTODEBUGGER, final, final + '.ad.ll']) final += '.ad.ll' if DEBUG: save_intermediate('autodebug', 'll') @@ -900,7 +912,8 @@ try: partial_dirs = [] for file_ in data_files: dirname = os.path.dirname(file_['name']) - if dirname != '' and dirname != '/': + dirname = dirname.lstrip('/') # absolute paths start with '/', remove that + if dirname != '': parts = dirname.split('/') for i in range(len(parts)): partial = '/'.join(parts[:i+1]) @@ -979,14 +992,23 @@ try: var b = new Blob([byteArray.buffer], { type: '%(mimetype)s' }); var url = URLObject.createObjectURL(b); // XXX we never revoke this! |