diff options
Diffstat (limited to 'tools/shared.py')
-rw-r--r-- | tools/shared.py | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/tools/shared.py b/tools/shared.py index bc1d4352..09277d06 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -199,29 +199,33 @@ def check_node_version(): # we re-check sanity when the settings are changed) # We also re-check sanity and clear the cache when the version changes -EMSCRIPTEN_VERSION = '1.3.7' +EMSCRIPTEN_VERSION = '1.4.1' + +def generate_sanity(): + return EMSCRIPTEN_VERSION + '|' + LLVM_TARGET def check_sanity(force=False): try: - if not force: - if not CONFIG_FILE: - return # config stored directly in EM_CONFIG => skip sanity checks + reason = None + if not CONFIG_FILE: + if not force: return # config stored directly in EM_CONFIG => skip sanity checks + else: settings_mtime = os.stat(CONFIG_FILE).st_mtime sanity_file = CONFIG_FILE + '_sanity' - reason = 'unknown' - try: - sanity_mtime = os.stat(sanity_file).st_mtime - if sanity_mtime <= settings_mtime: - reason = 'settings file has changed' - else: - sanity_version = open(sanity_file).read() - if sanity_version != EMSCRIPTEN_VERSION: - reason = 'version bump' + if os.path.exists(sanity_file): + try: + sanity_mtime = os.stat(sanity_file).st_mtime + if sanity_mtime <= settings_mtime: + reason = 'settings file has changed' else: - return # all is well - except: - pass - + sanity_data = open(sanity_file).read() + if sanity_data != generate_sanity(): + reason = 'system change: %s vs %s' % (generate_sanity(), sanity_data) + else: + if not force: return # all is well + except Exception, e: + reason = 'unknown: ' + str(e) + if reason: print >> sys.stderr, '(Emscripten: %s, clearing cache)' % reason Cache.erase() @@ -262,7 +266,7 @@ def check_sanity(force=False): if not force: # Only create/update this file if the sanity check succeeded, i.e., we got here f = open(sanity_file, 'w') - f.write(EMSCRIPTEN_VERSION) + f.write(generate_sanity()) f.close() except Exception, e: @@ -394,6 +398,9 @@ except: # Additional compiler options +# Target choice. Must be synced with src/settings.js (TARGET_*) +LLVM_TARGET = os.environ.get('EMCC_LLVM_TARGET') or 'i386-pc-linux-gnu' # 'le32-unknown-nacl' + try: COMPILER_OPTS # Can be set in EM_CONFIG, optionally except: @@ -402,7 +409,8 @@ except: COMPILER_OPTS = COMPILER_OPTS + ['-m32', '-U__i386__', '-U__i386', '-Ui386', '-U__SSE__', '-U__SSE_MATH__', '-U__SSE2__', '-U__SSE2_MATH__', '-U__MMX__', '-DEMSCRIPTEN', '-D__EMSCRIPTEN__', '-U__STRICT_ANSI__', - '-target', 'i386-pc-linux-gnu', '-D__IEEE_LITTLE_ENDIAN', '-fno-math-errno'] + '-D__IEEE_LITTLE_ENDIAN', '-fno-math-errno', + '-target', LLVM_TARGET] USE_EMSDK = not os.environ.get('EMMAKEN_NO_SDK') |