aboutsummaryrefslogtreecommitdiffstats
path: root/testing/emscripten/binaryen-wasm-js-path.patch
blob: d2c7ab994a05281dcdbb3aeee45b194e0b0f563b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sun, 02 Mar 2017 22:42:00 +0200
Subject: [PATCH] Allow to specify path to wasm.js

Add configuration variable BINARYEN_WASM_JS that allows to specify location of
the Binaryen's wasm.js file.

--- a/emcc.py
+++ b/emcc.py
@@ -1282,6 +1282,11 @@
             shared.Settings.BINARYEN_ROOT = shared.BINARYEN_ROOT
           except:
             pass
+        if not shared.Settings.BINARYEN_WASM_JS:
+          try:
+            shared.Settings.BINARYEN_WASM_JS = shared.BINARYEN_WASM_JS
+          except:
+            shared.Settings.BINARYEN_WASM_JS = os.path.join(BINARYEN_ROOT, 'bin', 'wasm.js')
         # default precise-f32 to on, since it works well in wasm
         # also always use f32s when asm.js is not in the picture
         if ('PRECISE_F32=0' not in settings_changes and 'PRECISE_F32=2' not in settings_changes) or 'asmjs' not in shared.Settings.BINARYEN_METHOD:
@@ -2110,7 +2115,7 @@
         # BINARYEN_METHOD with something that doesn't use the polyfill, then we don't need it.
         if not shared.Settings.BINARYEN_METHOD or 'interpret' in shared.Settings.BINARYEN_METHOD:
           logging.debug('integrating wasm.js polyfill interpreter')
-          wasm_js = open(os.path.join(binaryen_bin, 'wasm.js')).read()
+          wasm_js = open(shared.Settings.BINARYEN_WASM_JS).read()
           wasm_js = wasm_js.replace('EMSCRIPTEN_', 'emscripten_') # do not confuse the markers
           js = open(js_target).read()
           combined = open(js_target, 'w')
--- a/src/settings.js
+++ b/src/settings.js
@@ -709,6 +709,7 @@
                                     // required for all but the smallest modules to run in V8
 var BINARYEN_ROOT = ""; // Directory where we can find Binaryen. Will be automatically set for you,
                         // but you can set it to override if you are a Binaryen developer.
+var BINARYEN_WASM_JS = ""; // Path to the file wasm.js, the Binaryen components compiled to JavaScript.
 
 var WASM = 0; // Alias for BINARYEN, the two are identical. Both make us compile code to WebAssembly.