File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030# NODE Command for running Node.js. Default: `node`.
3131# NODE_PATH Path for resolving node modules.
3232# EMCCC_COMPILER Emscripten C compiler. Default: `emcc`.
33- # WASM2WAT Command for converting wasm binary format to text format. Default. `wasm2wat`.
33+ # WASM2WAT Command for converting WebAssembly binary format to text format. Default. `wasm2wat`.
34+ # WASM2JS Command for converting WebAssembly binary format to JavaScript. Default. `wasm2js`.
3435# SRC_FOLDER Folder containing source files. Default: `src`.
3536# INCLUDE Includes (e.g., `-I /foo/bar -I /a/b`).
3637# SOURCE_FILES Source file list.
@@ -67,6 +68,12 @@ if [[ -z "${wasm_to_wat}" ]]; then
6768 wasm_to_wat=' wasm2wat'
6869fi
6970
71+ # Define the path to an executable for converting a WebAssembly binary to JavaScript:
72+ wasm_to_js=" ${WASM2JS} "
73+ if [[ -z " ${wasm_to_js} " ]]; then
74+ wasm_to_js=' wasm2js'
75+ fi
76+
7077# Define the folder containing source files:
7178src_folder=" ${SRC_FOLDER} "
7279if [[ -z " ${src_folder} " ]]; then
@@ -194,7 +201,7 @@ resolve_libpaths() {
194201#
195202# $1 - source directory
196203compile () {
197- cd " $1 " && EMCC_COMPILER=" ${emcc_compiler} " WASM2WAT=" ${wasm_to_wat} " INCLUDE=" ${include} " SOURCE_FILES=" ${source_files} " LIBRARIES=" ${libraries} " LIBPATH=" ${libpath} " make wasm 2>&1
204+ cd " $1 " && EMCC_COMPILER=" ${emcc_compiler} " WASM2WAT=" ${wasm_to_wat} " WASM2JS= " ${wasm_to_js} " INCLUDE=" ${include} " SOURCE_FILES=" ${source_files} " LIBRARIES=" ${libraries} " LIBPATH=" ${libpath} " make wasm 2>&1
198205 if [[ " $? " -ne 0 ]]; then
199206 echo ' Error when attempting to compile WebAssembly.' >&2
200207 return 1
You can’t perform that action at this time.
0 commit comments