diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d7a5bff78..ddee97372 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -139,13 +139,14 @@ build_wally_release_files: - mv release wallycore-android-jni - tar czf wally_dist/wallycore-android-jni.tar.gz --remove-files wallycore-android-jni - source /opt/emsdk/emsdk_env.sh - - tools/build_wasm.sh + - EMCC_OPTIONS="-s EXPORT_ES6=1 -s MODULARIZE=1" tools/build_wasm.sh + - cp contrib/wally_js_example.html dist/wallycore.html - cd dist - - tar czf wallycore-wasm.tar.gz --remove-files wallycore.html wallycore.js wallycore.wasm + - tar czf ../wally_dist/wallycore-wasm.tar.gz --remove-files wallycore.html wallycore.js wallycore.wasm - cd .. - - EXPORTED_FUNCTIONS="['_malloc','_free','_wally_init','_wally_asset_value_commitment','_wally_asset_generator_from_bytes']" tools/build_wasm.sh --no-modularize + - EMCC_OPTIONS="-s MODULARIZE=1" EXPORTED_FUNCTIONS="['_malloc','_free','_wally_init','_wally_asset_value_commitment','_wally_asset_generator_from_bytes']" tools/build_wasm.sh - cd dist - - tar czf esplora-wasm.tar.gz --remove-files wallycore.html wallycore.js wallycore.wasm + - tar czf ../wally_dist/esplora-wasm.tar.gz --remove-files wallycore.js wallycore.wasm - cd .. - sphinx-build -b html -a -c docs/source docs/source docs/build/html - cd docs/build diff --git a/README.md b/README.md index cd75239ae..96042dd5b 100644 --- a/README.md +++ b/README.md @@ -191,18 +191,21 @@ $ source $HOME/emsdk/emsdk_env.sh # Optionally set the list of wally functions to export to wasm (default: all) $ export EXPORTED_FUNCTIONS="['_malloc','_free','_wally_init','_wally_cleanup',...]" +# Optionally set emcc options, e.g. to build as an ES6 module: +$ export EMCC_OPTIONS="-s EXPORT_ES6=1 -s MODULARIZE=1" + # Build $ ./tools/build_wasm.sh [--disable-elements] ``` Note that emsdk v3.1.27 or later is required. -The script `tools/build_wasm.sh` builds the `wallycore.html` example as well -as the required `wallycore.js` and `wallycore.wasm` files, which can be used -as an example for your own WebAssembly projects. +The file `contrib/wally_js_example.html` is an example page using the +`wallycore.js` and `wallycore.wasm` files, which can be used as an example +for your own WebAssembly projects. -Open `wallycore.html` in a browser via a webserver like [nginx](https://www.nginx.com/) -or `python2 -m SimpleHTTPServer 8000` to run the example. +Open `wally_js_example.html` in a browser via a webserver like [nginx](https://www.nginx.com/) +or `python3 -m http.server` to run the example. ## Cleaning diff --git a/contrib/shell_minimal.html b/contrib/shell_minimal.html deleted file mode 100644 index 0275a724e..000000000 --- a/contrib/shell_minimal.html +++ /dev/null @@ -1,41 +0,0 @@ - - -
- - -