summaryrefslogtreecommitdiff
path: root/platform/javascript/detect.py
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2017-02-21 21:25:00 -0300
committerGitHub <noreply@github.com>2017-02-21 21:25:00 -0300
commitd0973e645cc82ef643153f920dba5ee2586f08cb (patch)
treed255acd29efb644159a7bad2806a0cd1bd92f6e9 /platform/javascript/detect.py
parentde0045cf1b0a5e20fbf74da192039d344ee8d0c7 (diff)
parent6e1828c9588eb731c4ec9dff9013d4db02d14975 (diff)
Merge pull request #7863 from eska014/webbuild
Web builds: Zip automatically; Fix on Windows; Parallel wasm/asm.js builds
Diffstat (limited to 'platform/javascript/detect.py')
-rw-r--r--platform/javascript/detect.py40
1 files changed, 28 insertions, 12 deletions
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 7237298169..a8bdb0a4f9 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -12,8 +12,6 @@ def get_name():
def can_build():
-
- import os
return os.environ.has_key("EMSCRIPTEN_ROOT")
@@ -35,23 +33,41 @@ def get_flags():
]
+def create(env):
+ # remove Windows' .exe suffix
+ return env.Clone(PROGSUFFIX='')
+
+
+def escape_sources_backslashes(target, source, env, for_signature):
+ return [path.replace('\\','\\\\') for path in env.GetBuildPath(source)]
+
+def escape_target_backslashes(target, source, env, for_signature):
+ return env.GetBuildPath(target[0]).replace('\\','\\\\')
+
+
def configure(env):
env['ENV'] = os.environ
- env.use_windows_spawn_fix('javascript')
env.Append(CPPPATH=['#platform/javascript'])
- em_path = os.environ["EMSCRIPTEN_ROOT"]
-
- env['ENV']['PATH'] = em_path + ":" + env['ENV']['PATH']
- env['CC'] = em_path + '/emcc'
- env['CXX'] = em_path + '/em++'
- env['LINK'] = em_path + '/emcc'
- env['AR'] = em_path + '/emar'
- env['RANLIB'] = em_path + '/emranlib'
+ env.PrependENVPath('PATH', os.environ['EMSCRIPTEN_ROOT'])
+ env['CC'] = 'emcc'
+ env['CXX'] = 'em++'
+ env['LINK'] = 'emcc'
+ env['RANLIB'] = 'emranlib'
+ # Emscripten's ar has issues with duplicate file names, so use cc
+ env['AR'] = 'emcc'
+ env['ARFLAGS'] = '-o'
+ if (os.name == 'nt'):
+ # use TempFileMunge on Windows since some commands get too long for
+ # cmd.exe even with spawn_fix
+ # need to escape backslashes for this
+ env['ESCAPED_SOURCES'] = escape_sources_backslashes
+ env['ESCAPED_TARGET'] = escape_target_backslashes
+ env['ARCOM'] = '${TEMPFILE("%s")}' % env['ARCOM'].replace('$SOURCES', '$ESCAPED_SOURCES').replace('$TARGET', '$ESCAPED_TARGET')
env['OBJSUFFIX'] = '.bc'
- env['LIBSUFFIX'] = '.a'
+ env['LIBSUFFIX'] = '.bc'
if (env["target"] == "release"):
env.Append(CCFLAGS=['-O2'])