webruby 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/webruby/config.rb +4 -9
- data/lib/webruby/rake/files.rake +2 -2
- data/modules/emscripten/AUTHORS +9 -1
- data/modules/emscripten/CONTRIBUTING.markdown +5 -0
- data/modules/emscripten/ChangeLog +435 -0
- data/modules/emscripten/cmake/Modules/FindOpenAL.cmake +26 -0
- data/modules/emscripten/cmake/Platform/Emscripten.cmake +9 -2
- data/modules/emscripten/em++ +0 -2
- data/modules/emscripten/emcc +92 -32
- data/modules/emscripten/emlink.py +16 -13
- data/modules/emscripten/emmake +1 -1
- data/modules/emscripten/emrun +918 -0
- data/modules/emscripten/emrun.bat +2 -0
- data/modules/emscripten/emscripten.py +545 -20
- data/modules/emscripten/src/analyzer.js +6 -1
- data/modules/emscripten/src/compiler.js +25 -16
- data/modules/emscripten/src/emrun_postjs.js +20 -0
- data/modules/emscripten/{tests → src}/hello_world.js +0 -0
- data/modules/emscripten/src/intertyper.js +45 -16
- data/modules/emscripten/src/jsifier.js +78 -48
- data/modules/emscripten/src/library.js +381 -96
- data/modules/emscripten/src/library_browser.js +50 -53
- data/modules/emscripten/src/library_egl.js +66 -24
- data/modules/emscripten/src/library_fs.js +122 -90
- data/modules/emscripten/src/library_gl.js +739 -353
- data/modules/emscripten/src/library_glfw.js +9 -3
- data/modules/emscripten/src/library_glut.js +10 -5
- data/modules/emscripten/src/library_idbfs.js +14 -14
- data/modules/emscripten/src/library_memfs.js +65 -41
- data/modules/emscripten/src/library_nodefs.js +61 -9
- data/modules/emscripten/src/library_openal.js +4 -4
- data/modules/emscripten/src/library_path.js +9 -13
- data/modules/emscripten/src/library_sdl.js +301 -64
- data/modules/emscripten/src/library_sockfs.js +7 -5
- data/modules/emscripten/src/modules.js +62 -22
- data/modules/emscripten/src/parseTools.js +135 -102
- data/modules/emscripten/src/postamble.js +3 -4
- data/modules/emscripten/src/preamble.js +49 -29
- data/modules/emscripten/src/proxyClient.js +1 -1
- data/modules/emscripten/src/proxyWorker.js +10 -10
- data/modules/emscripten/src/relooper/Relooper.cpp +15 -4
- data/modules/emscripten/src/runtime.js +32 -8
- data/modules/emscripten/src/settings.js +25 -8
- data/modules/emscripten/src/shell.html +6 -3
- data/modules/emscripten/src/shell.js +13 -11
- data/modules/emscripten/src/simd.js +602 -432
- data/modules/emscripten/src/struct_info.json +22 -2
- data/modules/emscripten/src/utility.js +32 -17
- data/modules/emscripten/system/include/SDL/SDL_events.h +1 -0
- data/modules/emscripten/system/include/compat/ctype.h +17 -0
- data/modules/emscripten/system/include/compat/wchar.h +23 -0
- data/modules/emscripten/system/include/compat/wctype.h +23 -0
- data/modules/emscripten/system/include/emscripten/emmintrin.h +87 -0
- data/modules/emscripten/system/include/emscripten/emscripten.h +30 -4
- data/modules/emscripten/system/include/emscripten/vector.h +29 -1
- data/modules/emscripten/system/include/emscripten/xmmintrin.h +131 -0
- data/modules/emscripten/system/include/libcxx/CREDITS.TXT +9 -1
- data/modules/emscripten/system/include/libcxx/__bit_reference +8 -8
- data/modules/emscripten/system/include/libcxx/__config +95 -17
- data/modules/emscripten/system/include/libcxx/__debug +25 -4
- data/modules/emscripten/system/include/libcxx/__functional_03 +7 -7
- data/modules/emscripten/system/include/libcxx/__functional_base +169 -9
- data/modules/emscripten/system/include/libcxx/__functional_base_03 +1 -1
- data/modules/emscripten/system/include/libcxx/__hash_table +25 -25
- data/modules/emscripten/system/include/libcxx/__locale +21 -19
- data/modules/emscripten/system/include/libcxx/__mutex_base +2 -33
- data/modules/emscripten/system/include/libcxx/__split_buffer +9 -9
- data/modules/emscripten/system/include/libcxx/__std_stream +14 -0
- data/modules/emscripten/system/include/libcxx/__tree +35 -26
- data/modules/emscripten/system/include/libcxx/__tuple +15 -15
- data/modules/emscripten/system/include/libcxx/__tuple_03 +2 -2
- data/modules/emscripten/system/include/libcxx/__undef_min_max +8 -0
- data/modules/emscripten/system/include/libcxx/algorithm +121 -110
- data/modules/emscripten/system/include/libcxx/array +15 -15
- data/modules/emscripten/system/include/libcxx/bitset +4 -4
- data/modules/emscripten/system/include/libcxx/chrono +51 -17
- data/modules/emscripten/system/include/libcxx/cmath +25 -23
- data/modules/emscripten/system/include/libcxx/codecvt +21 -18
- data/modules/emscripten/system/include/libcxx/complex +48 -7
- data/modules/emscripten/system/include/libcxx/cstddef +1 -1
- data/modules/emscripten/system/include/libcxx/cstdio +8 -1
- data/modules/emscripten/system/include/libcxx/cstdlib +1 -1
- data/modules/emscripten/system/include/libcxx/cwchar +1 -1
- data/modules/emscripten/system/include/libcxx/deque +26 -12
- data/modules/emscripten/system/include/libcxx/dynarray +311 -0
- data/modules/emscripten/system/include/libcxx/exception +4 -4
- data/modules/emscripten/system/include/libcxx/ext/__hash +3 -3
- data/modules/emscripten/system/include/libcxx/ext/hash_map +19 -15
- data/modules/emscripten/system/include/libcxx/ext/hash_set +7 -3
- data/modules/emscripten/system/include/libcxx/forward_list +33 -7
- data/modules/emscripten/system/include/libcxx/fstream +4 -4
- data/modules/emscripten/system/include/libcxx/functional +200 -170
- data/modules/emscripten/system/include/libcxx/future +83 -39
- data/modules/emscripten/system/include/libcxx/initializer_list +24 -11
- data/modules/emscripten/system/include/libcxx/iomanip +147 -0
- data/modules/emscripten/system/include/libcxx/ios +24 -16
- data/modules/emscripten/system/include/libcxx/iosfwd +19 -19
- data/modules/emscripten/system/include/libcxx/istream +13 -8
- data/modules/emscripten/system/include/libcxx/iterator +108 -417
- data/modules/emscripten/system/include/libcxx/limits +8 -4
- data/modules/emscripten/system/include/libcxx/list +28 -8
- data/modules/emscripten/system/include/libcxx/locale +153 -390
- data/modules/emscripten/system/include/libcxx/map +280 -100
- data/modules/emscripten/system/include/libcxx/memory +49 -97
- data/modules/emscripten/system/include/libcxx/mutex +2 -2
- data/modules/emscripten/system/include/libcxx/new +43 -14
- data/modules/emscripten/system/include/libcxx/numeric +2 -2
- data/modules/emscripten/system/include/libcxx/optional +697 -0
- data/modules/emscripten/system/include/libcxx/ostream +17 -8
- data/modules/emscripten/system/include/libcxx/queue +5 -5
- data/modules/emscripten/system/include/libcxx/random +53 -51
- data/modules/emscripten/system/include/libcxx/ratio +11 -11
- data/modules/emscripten/system/include/libcxx/readme.txt +1 -1
- data/modules/emscripten/system/include/libcxx/regex +23 -20
- data/modules/emscripten/system/include/libcxx/scoped_allocator +1 -1
- data/modules/emscripten/system/include/libcxx/set +166 -2
- data/modules/emscripten/system/include/libcxx/shared_mutex +419 -0
- data/modules/emscripten/system/include/libcxx/sstream +4 -4
- data/modules/emscripten/system/include/libcxx/stack +3 -3
- data/modules/emscripten/system/include/libcxx/streambuf +5 -5
- data/modules/emscripten/system/include/libcxx/string +372 -324
- data/modules/emscripten/system/include/libcxx/support/ibm/limits.h +99 -0
- data/modules/emscripten/system/include/libcxx/support/ibm/support.h +54 -0
- data/modules/emscripten/system/include/libcxx/support/ibm/xlocale.h +326 -0
- data/modules/emscripten/system/include/libcxx/support/win32/limits_win32.h +6 -6
- data/modules/emscripten/system/include/libcxx/support/win32/locale_win32.h +15 -15
- data/modules/emscripten/system/include/libcxx/support/win32/math_win32.h +2 -0
- data/modules/emscripten/system/include/libcxx/support/win32/support.h +6 -1
- data/modules/emscripten/system/include/libcxx/system_error +14 -8
- data/modules/emscripten/system/include/libcxx/thread +7 -8
- data/modules/emscripten/system/include/libcxx/tuple +29 -88
- data/modules/emscripten/system/include/libcxx/type_traits +253 -209
- data/modules/emscripten/system/include/libcxx/typeindex +3 -3
- data/modules/emscripten/system/include/libcxx/unordered_map +162 -101
- data/modules/emscripten/system/include/libcxx/unordered_set +79 -2
- data/modules/emscripten/system/include/libcxx/utility +20 -20
- data/modules/emscripten/system/include/libcxx/valarray +23 -23
- data/modules/emscripten/system/include/libcxx/vector +114 -91
- data/modules/emscripten/system/lib/libc/musl/src/regex/regcomp.c +3352 -0
- data/modules/emscripten/system/lib/libc/musl/src/regex/regerror.c +35 -0
- data/modules/emscripten/system/lib/libc/musl/src/regex/regexec.c +1011 -0
- data/modules/emscripten/system/lib/libc/musl/src/regex/tre-mem.c +158 -0
- data/modules/emscripten/system/lib/libc/musl/src/regex/tre.h +231 -0
- data/modules/emscripten/system/lib/libcextra.symbols +7 -0
- data/modules/emscripten/system/lib/libcxx/CREDITS.TXT +9 -1
- data/modules/emscripten/system/lib/libcxx/algorithm.cpp +1 -0
- data/modules/emscripten/system/lib/libcxx/debug.cpp +66 -42
- data/modules/emscripten/system/lib/libcxx/exception.cpp +88 -16
- data/modules/emscripten/system/lib/libcxx/future.cpp +6 -0
- data/modules/emscripten/system/lib/libcxx/ios.cpp +7 -2
- data/modules/emscripten/system/lib/libcxx/iostream.cpp +8 -8
- data/modules/emscripten/system/lib/libcxx/locale.cpp +38 -11
- data/modules/emscripten/system/lib/libcxx/mutex.cpp +3 -0
- data/modules/emscripten/system/lib/libcxx/new.cpp +44 -10
- data/modules/emscripten/system/lib/libcxx/optional.cpp +25 -0
- data/modules/emscripten/system/lib/libcxx/random.cpp +26 -0
- data/modules/emscripten/system/lib/libcxx/readme.txt +1 -1
- data/modules/emscripten/system/lib/libcxx/shared_mutex.cpp +101 -0
- data/modules/emscripten/system/lib/libcxx/stdexcept.cpp +11 -7
- data/modules/emscripten/system/lib/libcxx/string.cpp +3 -1
- data/modules/emscripten/system/lib/libcxx/strstream.cpp +7 -7
- data/modules/emscripten/system/lib/libcxx/support/win32/locale_win32.cpp +12 -13
- data/modules/emscripten/system/lib/libcxx/support/win32/support.cpp +33 -36
- data/modules/emscripten/system/lib/libcxx/symbols +187 -168
- data/modules/emscripten/system/lib/libcxx/system_error.cpp +1 -0
- data/modules/emscripten/system/lib/libcxx/thread.cpp +7 -3
- data/modules/emscripten/system/lib/libcxx/typeinfo.cpp +9 -6
- data/modules/emscripten/system/lib/libcxx/valarray.cpp +2 -0
- data/modules/emscripten/third_party/lzma.js/doit.bat +4 -0
- data/modules/emscripten/third_party/lzma.js/doit.sh +9 -2
- data/modules/emscripten/tools/cache.py +5 -7
- data/modules/emscripten/tools/cache.pyc +0 -0
- data/modules/emscripten/tools/eliminator/asm-eliminator-test-output.js +7 -0
- data/modules/emscripten/tools/eliminator/asm-eliminator-test.js +9 -1
- data/modules/emscripten/tools/eliminator/eliminator-test-output.js +3 -0
- data/modules/emscripten/tools/eliminator/eliminator-test.js +9 -1
- data/modules/emscripten/tools/file_packager.py +93 -50
- data/modules/emscripten/tools/js-optimizer.js +98 -48
- data/modules/emscripten/tools/js_optimizer.py +4 -4
- data/modules/emscripten/tools/js_optimizer.pyc +0 -0
- data/modules/emscripten/tools/jsrun.py +1 -1
- data/modules/emscripten/tools/jsrun.pyc +0 -0
- data/modules/emscripten/tools/response_file.py +6 -0
- data/modules/emscripten/tools/response_file.pyc +0 -0
- data/modules/emscripten/tools/settings_template_readonly.py +2 -0
- data/modules/emscripten/tools/shared.py +88 -34
- data/modules/emscripten/tools/shared.pyc +0 -0
- data/modules/emscripten/tools/split.py +21 -13
- data/modules/mruby/build_config.rb +7 -1
- data/modules/mruby/doc/compile/README.md +5 -9
- data/modules/mruby/include/mrbconf.h +5 -2
- data/modules/mruby/include/mruby/array.h +1 -0
- data/modules/mruby/include/mruby/compile.h +2 -4
- data/modules/mruby/include/mruby/dump.h +7 -16
- data/modules/mruby/include/mruby/hash.h +1 -1
- data/modules/mruby/include/mruby/irep.h +14 -2
- data/modules/mruby/include/mruby/khash.h +8 -7
- data/modules/mruby/include/mruby/string.h +1 -0
- data/modules/mruby/include/mruby/value.h +5 -2
- data/modules/mruby/include/mruby.h +12 -13
- data/modules/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +16 -6
- data/modules/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +18 -30
- data/modules/mruby/mrbgems/mruby-fiber/src/fiber.c +21 -0
- data/modules/mruby/mrbgems/mruby-math/src/math.c +1 -1
- data/modules/mruby/mrbgems/mruby-random/src/random.c +144 -47
- data/modules/mruby/mrbgems/mruby-random/test/random.rb +44 -0
- data/modules/mruby/mrbgems/mruby-struct/src/struct.c +5 -5
- data/modules/mruby/mrblib/numeric.rb +99 -33
- data/modules/mruby/src/array.c +11 -4
- data/modules/mruby/src/backtrace.c +2 -2
- data/modules/mruby/src/class.c +49 -30
- data/modules/mruby/src/codegen.c +131 -79
- data/modules/mruby/src/debug.c +1 -1
- data/modules/mruby/src/dump.c +213 -163
- data/modules/mruby/src/error.c +17 -17
- data/modules/mruby/src/error.h +1 -1
- data/modules/mruby/src/etc.c +10 -0
- data/modules/mruby/src/gc.c +35 -17
- data/modules/mruby/src/hash.c +5 -5
- data/modules/mruby/src/kernel.c +36 -14
- data/modules/mruby/src/load.c +238 -296
- data/modules/mruby/src/numeric.c +18 -98
- data/modules/mruby/src/object.c +3 -5
- data/modules/mruby/src/parse.y +63 -56
- data/modules/mruby/src/proc.c +8 -5
- data/modules/mruby/src/re.h +0 -1
- data/modules/mruby/src/state.c +65 -27
- data/modules/mruby/src/string.c +3 -31
- data/modules/mruby/src/symbol.c +3 -3
- data/modules/mruby/src/variable.c +12 -5
- data/modules/mruby/src/vm.c +90 -72
- data/modules/mruby/tasks/mruby_build.rake +10 -1
- data/modules/mruby/tasks/toolchains/gcc.rake +12 -2
- data/modules/mruby/tasks/toolchains/{vs2012.rake → visualcpp.rake} +1 -1
- data/modules/mruby/test/driver.c +3 -3
- data/modules/mruby/test/t/array.rb +5 -5
- data/modules/mruby/test/t/class.rb +14 -1
- data/modules/mruby/test/t/kernel.rb +4 -0
- data/modules/mruby/test/t/module.rb +4 -4
- data/modules/mruby/test/t/nameerror.rb +1 -1
- data/modules/mruby/tools/mrbc/mrbc.c +23 -17
- data/modules/mruby/travis_config.rb +10 -1
- metadata +28 -5
- data/modules/mruby/tasks/toolchains/vs2010.rake +0 -3
data/modules/emscripten/emcc
CHANGED
@@ -50,11 +50,12 @@ emcc can be influenced by a few environment variables:
|
|
50
50
|
import os, sys, shutil, tempfile, subprocess, shlex, time, re, logging
|
51
51
|
from subprocess import PIPE, STDOUT
|
52
52
|
from tools import shared, jsrun
|
53
|
-
from tools.shared import Compression, execute, suffix, unsuffixed, unsuffixed_basename
|
53
|
+
from tools.shared import Compression, execute, suffix, unsuffixed, unsuffixed_basename, WINDOWS
|
54
54
|
from tools.response_file import read_response_file
|
55
55
|
|
56
|
-
|
57
|
-
|
56
|
+
C_SUFFIXES = ('.c', '.C')
|
57
|
+
CXX_SUFFIXES = ('.cpp', '.cxx', '.cc', '.CPP', '.CXX', '.CC')
|
58
|
+
SOURCE_SUFFIXES = C_SUFFIXES + CXX_SUFFIXES + ('.m', '.mm')
|
58
59
|
BITCODE_SUFFIXES = ('.bc', '.o', '.obj')
|
59
60
|
DYNAMICLIB_SUFFIXES = ('.dylib', '.so', '.dll')
|
60
61
|
STATICLIB_SUFFIXES = ('.a',)
|
@@ -397,7 +398,8 @@ Options that are modified or new in %s include:
|
|
397
398
|
--shell-file <path> The path name to a skeleton HTML file used
|
398
399
|
when generating HTML output. The shell file
|
399
400
|
used needs to have this token inside it:
|
400
|
-
{{{
|
401
|
+
{{{ SCRIPT }}}
|
402
|
+
(see src/shell.html for an example)
|
401
403
|
Note that this argument is ignored if a
|
402
404
|
target other than HTML is specified using
|
403
405
|
the -o option.
|
@@ -497,11 +499,23 @@ Options that are modified or new in %s include:
|
|
497
499
|
--proxy-to-worker Generates both html and js files. The main
|
498
500
|
program is in js, and the html proxies to/from it.
|
499
501
|
|
502
|
+
--emrun Enables the generated output to be aware of the
|
503
|
+
emrun command line tool. This allows stdout, stderr
|
504
|
+
and exit(returncode) capture when running the
|
505
|
+
generated application through emrun.
|
506
|
+
|
507
|
+
--em-config Specifies the location of the .emscripten configuration
|
508
|
+
file for the current compiler run. If not specified,
|
509
|
+
the environment variable EM_CONFIG is read for this
|
510
|
+
file, and if that is not set, the default location
|
511
|
+
~/.emscripten is assumed.
|
512
|
+
|
500
513
|
The target file, if specified (-o <target>), defines what will
|
501
514
|
be generated:
|
502
515
|
|
503
516
|
<name>.js JavaScript
|
504
|
-
<name>.html HTML
|
517
|
+
<name>.html HTML + side JavaScript file (<name>.js)
|
518
|
+
(JS on the side improves page load time)
|
505
519
|
<name>.bc LLVM bitcode (default)
|
506
520
|
<name>.o LLVM bitcode (same as .bc)
|
507
521
|
|
@@ -542,7 +556,7 @@ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR P
|
|
542
556
|
exit(0)
|
543
557
|
|
544
558
|
elif len(sys.argv) == 2 and sys.argv[1] == '-v': # -v with no inputs
|
545
|
-
print 'emcc (Emscripten GCC-like replacement + linker emulating GNU ld )
|
559
|
+
print 'emcc (Emscripten GCC-like replacement + linker emulating GNU ld ) %s' % shared.EMSCRIPTEN_VERSION
|
546
560
|
exit(subprocess.call([shared.CLANG, '-v']))
|
547
561
|
|
548
562
|
def is_minus_s_for_emcc(newargs,i):
|
@@ -771,10 +785,12 @@ try:
|
|
771
785
|
shell_path = shared.path_from_root('src', 'shell.html')
|
772
786
|
js_libraries = []
|
773
787
|
bind = False
|
788
|
+
emrun = False
|
774
789
|
jcache = False
|
775
790
|
save_bc = False
|
776
791
|
memory_init_file = False
|
777
792
|
use_preload_cache = False
|
793
|
+
no_heap_copy = False
|
778
794
|
proxy_to_worker = False
|
779
795
|
|
780
796
|
if use_cxx:
|
@@ -884,8 +900,17 @@ try:
|
|
884
900
|
check_bad_eq(newargs[i])
|
885
901
|
parts = newargs[i+1].split(',')
|
886
902
|
assert len(parts) == 3, '--compression requires specifying native_encoder,js_decoder,js_name - see emcc --help. got: %s' % newargs[i+1]
|
887
|
-
|
888
|
-
|
903
|
+
def locate(tool):
|
904
|
+
if WINDOWS:
|
905
|
+
if os.path.exists(tool+'.exe'):
|
906
|
+
return tool+'.exe'
|
907
|
+
if os.path.exists(tool+'.bat'):
|
908
|
+
return tool+'.bat'
|
909
|
+
if os.path.exists(tool+'.cmd'):
|
910
|
+
return tool+'.cmd'
|
911
|
+
return tool
|
912
|
+
Compression.encoder = locate(parts[0])
|
913
|
+
Compression.decoder = locate(parts[1])
|
889
914
|
Compression.js_name = parts[2]
|
890
915
|
assert os.path.exists(Compression.encoder), 'native encoder %s does not exist' % Compression.encoder
|
891
916
|
assert os.path.exists(Compression.decoder), 'js decoder %s does not exist' % Compression.decoder
|
@@ -895,6 +920,9 @@ try:
|
|
895
920
|
elif newargs[i].startswith('--use-preload-cache'):
|
896
921
|
use_preload_cache = True
|
897
922
|
newargs[i] = ''
|
923
|
+
elif newargs[i].startswith('--no-heap-copy'):
|
924
|
+
no_heap_copy = True
|
925
|
+
newargs[i] = ''
|
898
926
|
elif newargs[i] == '--ignore-dynamic-linking':
|
899
927
|
ignore_dynamic_linking = True
|
900
928
|
newargs[i] = ''
|
@@ -947,12 +975,23 @@ try:
|
|
947
975
|
if not absolute_warning_shown and os.path.isabs(path_name):
|
948
976
|
logging.warning ('-I or -L of an absolute path "' + newargs[i] + '" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass \'-Wno-warn-absolute-paths\' to emcc to hide this warning.') # Of course an absolute path to a non-system-specific library or header is fine, and you can ignore this warning. The danger are system headers that are e.g. x86 specific and nonportable. The emscripten bundled headers are modified to be portable, local system ones are generally not
|
949
977
|
absolute_warning_shown = True
|
978
|
+
elif newargs[i] == '--emrun':
|
979
|
+
emrun = True
|
980
|
+
newargs[i] = ''
|
981
|
+
elif newargs[i] == '--em-config':
|
982
|
+
# This option is parsed in tools/shared.py, here only clean it up from being passed to clang.
|
983
|
+
newargs[i] = ''
|
984
|
+
newargs[i+1] = ''
|
985
|
+
|
950
986
|
newargs = [ arg for arg in newargs if arg is not '' ]
|
951
987
|
|
952
988
|
# If user did not specify a default -std for C++ code, specify the emscripten default.
|
953
989
|
if default_cxx_std:
|
954
990
|
newargs = newargs + [default_cxx_std]
|
955
991
|
|
992
|
+
if emrun:
|
993
|
+
post_js += open(shared.path_from_root('src', 'emrun_postjs.js')).read() + '\n'
|
994
|
+
|
956
995
|
if js_opts is None: js_opts = opt_level >= 2
|
957
996
|
if llvm_opts is None: llvm_opts = LLVM_OPT_LEVEL[opt_level]
|
958
997
|
if llvm_lto is None and opt_level >= 3: llvm_lto = 3
|
@@ -1127,7 +1166,7 @@ try:
|
|
1127
1166
|
|
1128
1167
|
heap = 4096
|
1129
1168
|
while heap < shared.Settings.TOTAL_MEMORY:
|
1130
|
-
if heap
|
1169
|
+
if heap < 16*1024*1024:
|
1131
1170
|
heap *= 2
|
1132
1171
|
else:
|
1133
1172
|
heap += 16*1024*1024
|
@@ -1258,7 +1297,16 @@ try:
|
|
1258
1297
|
shutil.move(in_temp(unsuffixed(uniquename(input_file)) + '.o'), unsuffixed_basename(input_file) + '.' + final_suffix)
|
1259
1298
|
else:
|
1260
1299
|
if len(input_files) == 1:
|
1261
|
-
|
1300
|
+
temp_output_base = in_temp(unsuffixed(uniquename(input_files[0])))
|
1301
|
+
shutil.move(temp_output_base + '.o', specified_target)
|
1302
|
+
if os.path.exists(temp_output_base + '.d'):
|
1303
|
+
# There was a .d file generated, from -MD or -MMD and friends, save a copy of it to where the output resides,
|
1304
|
+
# adjusting the target name away from the temporary file name to the specified target.
|
1305
|
+
# It will be deleted with the rest of the temporary directory.
|
1306
|
+
deps = open(temp_output_base + '.d').read()
|
1307
|
+
deps = deps.replace(temp_output_base + '.o', specified_target)
|
1308
|
+
with open(os.path.join(os.path.dirname(specified_target), os.path.basename(unsuffixed(input_files[0]) + '.d')), "w") as out_dep:
|
1309
|
+
out_dep.write(deps)
|
1262
1310
|
else:
|
1263
1311
|
assert len(original_input_files) == 1 or not has_dash_c, 'fatal error: cannot specify -o with -c with multiple files' + str(sys.argv) + ':' + str(original_input_files)
|
1264
1312
|
# We have a specified target (-o <target>), which is not JavaScript or HTML, and
|
@@ -1423,6 +1471,12 @@ try:
|
|
1423
1471
|
'wctob.c',
|
1424
1472
|
'wctomb.c',
|
1425
1473
|
]],
|
1474
|
+
['regex', [
|
1475
|
+
'regcomp.c',
|
1476
|
+
'regerror.c',
|
1477
|
+
'regexec.c',
|
1478
|
+
'tre-mem.c',
|
1479
|
+
]],
|
1426
1480
|
['stdio', [
|
1427
1481
|
'fwprintf.c',
|
1428
1482
|
'swprintf.c',
|
@@ -1625,18 +1679,26 @@ try:
|
|
1625
1679
|
else:
|
1626
1680
|
# At minimum remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
|
1627
1681
|
link_opts += shared.Building.get_safe_internalize() + ['-globaldce']
|
1628
|
-
|
1629
|
-
|
1682
|
+
if not save_bc:
|
1683
|
+
# let llvm opt directly emit ll, to skip writing and reading all the bitcode
|
1684
|
+
link_opts += ['-S']
|
1685
|
+
shared.Building.llvm_opt(final, link_opts, final + '.link.ll')
|
1686
|
+
final = final + '.link.ll'
|
1687
|
+
if DEBUG: save_intermediate('linktime', 'll')
|
1688
|
+
else:
|
1689
|
+
shared.Building.llvm_opt(final, link_opts)
|
1690
|
+
if DEBUG: save_intermediate('linktime', 'bc')
|
1630
1691
|
|
1631
1692
|
if save_bc:
|
1632
1693
|
shutil.copyfile(final, save_bc)
|
1633
1694
|
|
1634
1695
|
# Prepare .ll for Emscripten
|
1635
1696
|
if not LEAVE_INPUTS_RAW:
|
1636
|
-
|
1697
|
+
if save_bc:
|
1698
|
+
final = shared.Building.llvm_dis(final, final + '.ll')
|
1637
1699
|
else:
|
1638
1700
|
assert len(input_files) == 1
|
1639
|
-
if DEBUG: save_intermediate('ll', 'll')
|
1701
|
+
if DEBUG and save_bc: save_intermediate('ll', 'll')
|
1640
1702
|
|
1641
1703
|
if AUTODEBUG:
|
1642
1704
|
logging.debug('autodebug')
|
@@ -1654,7 +1716,7 @@ try:
|
|
1654
1716
|
# Embed and preload files
|
1655
1717
|
if len(preload_files) + len(embed_files) > 0:
|
1656
1718
|
logging.debug('setting up files')
|
1657
|
-
file_args = []
|
1719
|
+
file_args = ['--pre-run']
|
1658
1720
|
if len(preload_files) > 0:
|
1659
1721
|
file_args.append('--preload')
|
1660
1722
|
file_args += preload_files
|
@@ -1665,11 +1727,10 @@ try:
|
|
1665
1727
|
file_args += ['--compress', Compression.encoder, Compression.decoder, Compression.js_name]
|
1666
1728
|
if use_preload_cache:
|
1667
1729
|
file_args.append('--use-preload-cache')
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
if DEBUG: save_intermediate('files')
|
1730
|
+
if no_heap_copy:
|
1731
|
+
file_args.append('--no-heap-copy')
|
1732
|
+
file_code = execute([shared.PYTHON, shared.FILE_PACKAGER, unsuffixed(target) + '.data'] + file_args, stdout=PIPE)[0]
|
1733
|
+
pre_js = file_code + pre_js
|
1673
1734
|
|
1674
1735
|
# Apply pre and postjs files
|
1675
1736
|
if pre_js or post_js:
|
@@ -1821,22 +1882,21 @@ try:
|
|
1821
1882
|
if final_suffix == 'html':
|
1822
1883
|
logging.debug('generating HTML')
|
1823
1884
|
shell = open(shell_path).read()
|
1885
|
+
assert '{{{ SCRIPT }}}' in shell, 'HTML shell must contain {{{ SCRIPT }}} , see src/shell.html for an example'
|
1824
1886
|
html = open(target, 'w')
|
1887
|
+
js_target = unsuffixed(target) + '.js'
|
1888
|
+
base_js_target = os.path.basename(js_target)
|
1825
1889
|
if proxy_to_worker:
|
1826
|
-
html.write(shell.replace('{{{
|
1827
|
-
js_target
|
1828
|
-
shutil.copyfile(final, js_target)
|
1890
|
+
html.write(shell.replace('{{{ SCRIPT }}}', '<script>' + open(shared.path_from_root('src', 'proxyClient.js')).read().replace('{{{ filename }}}', target_basename) + '</script>'))
|
1891
|
+
shutil.move(final, js_target)
|
1829
1892
|
elif not Compression.on:
|
1830
1893
|
if debug_level >= 4:
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
generate_source_map(target, match.group().count('\n'))
|
1836
|
-
html.write(shell.replace('{{{ SCRIPT_CODE }}}', open(final).read()))
|
1894
|
+
generate_source_map(target)
|
1895
|
+
shutil.move(final, js_target)
|
1896
|
+
script_tag = '''<script async type="text/javascript" src="%s"></script>''' % base_js_target
|
1897
|
+
html.write(shell.replace('{{{ SCRIPT }}}', script_tag))
|
1837
1898
|
else:
|
1838
1899
|
# Compress the main code
|
1839
|
-
js_target = unsuffixed(target) + '.js'
|
1840
1900
|
shutil.move(final, js_target)
|
1841
1901
|
Compression.compress(js_target)
|
1842
1902
|
|
@@ -1884,8 +1944,8 @@ try:
|
|
1884
1944
|
});
|
1885
1945
|
};
|
1886
1946
|
compiledCodeXHR.send(null);
|
1887
|
-
''' % Compression.compressed_name(
|
1888
|
-
html.write(shell.replace('{{{
|
1947
|
+
''' % Compression.compressed_name(base_js_target)
|
1948
|
+
html.write(shell.replace('{{{ SCRIPT }}}', '<script>' + decoding + '</script>'))
|
1889
1949
|
|
1890
1950
|
# Add decompressor with web worker glue code
|
1891
1951
|
decompressor = open('decompress.js', 'w')
|
@@ -10,21 +10,24 @@ import sys
|
|
10
10
|
from tools import shared
|
11
11
|
from tools.asm_module import AsmModule
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
def run():
|
14
|
+
try:
|
15
|
+
me, main, side, out = sys.argv[:4]
|
16
|
+
except:
|
17
|
+
print >> sys.stderr, 'usage: emlink.py [main module] [side module] [output name]'
|
18
|
+
sys.exit(1)
|
18
19
|
|
19
|
-
print 'Main module:', main
|
20
|
-
print 'Side module:', side
|
21
|
-
print 'Output:', out
|
20
|
+
print 'Main module:', main
|
21
|
+
print 'Side module:', side
|
22
|
+
print 'Output:', out
|
22
23
|
|
23
|
-
shared.try_delete(out)
|
24
|
+
shared.try_delete(out)
|
24
25
|
|
25
|
-
main = AsmModule(main)
|
26
|
-
side = AsmModule(side)
|
26
|
+
main = AsmModule(main)
|
27
|
+
side = AsmModule(side)
|
27
28
|
|
28
|
-
side.relocate_into(main)
|
29
|
-
main.write(out)
|
29
|
+
side.relocate_into(main)
|
30
|
+
main.write(out)
|
30
31
|
|
32
|
+
if __name__ == '__main__':
|
33
|
+
run()
|
data/modules/emscripten/emmake
CHANGED
@@ -6,7 +6,7 @@ the environment variables to use emcc and so forth. Usage:
|
|
6
6
|
|
7
7
|
emmake make [FLAGS]
|
8
8
|
|
9
|
-
|
9
|
+
Note that if you ran configure with emconfigure, then
|
10
10
|
the environment variables have already been detected
|
11
11
|
and set. This script is useful if you have no configure
|
12
12
|
step, and your Makefile uses the environment vars
|