Skip to content

Commit ed4d512

Browse files
committed
wasm: Update EMCC_OPTIONS default behavior
- If no EMCC_OPTIONS is specified, enable all options necessary for the NPM WASM package build by default. - If it is specified, use it as-is with no added defaults. This enables full control over the options, e.g. for esplora, which has to disable some. This also updates the gitlab CI build to use the correct EMCC_OPTIONS for the esplora build.
1 parent fde2ab1 commit ed4d512

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,12 @@ build_wally_release_files:
139139
- mv release wallycore-android-jni
140140
- tar czf wally_dist/wallycore-android-jni.tar.gz --remove-files wallycore-android-jni
141141
- source /opt/emsdk/emsdk_env.sh
142-
- EMCC_OPTIONS="-s EXPORT_ES6=1 -s MODULARIZE=1" tools/build_wasm.sh
142+
- tools/build_wasm.sh
143143
- cp contrib/wally_js_example.html dist/wallycore.html
144144
- cd dist
145145
- tar czf ../wally_dist/wallycore-wasm.tar.gz --remove-files wallycore.html wallycore.js wallycore.wasm
146146
- cd ..
147-
- EMCC_OPTIONS="-s MODULARIZE=1" EXPORTED_FUNCTIONS="['_malloc','_free','_wally_init','_wally_asset_value_commitment','_wally_asset_generator_from_bytes']" tools/build_wasm.sh
147+
- EMCC_OPTIONS="-s MODULARIZE=1 -s EXPORT_NAME=InitWally" EXPORTED_FUNCTIONS="['_malloc','_free','_wally_init','_wally_asset_value_commitment','_wally_asset_generator_from_bytes']" tools/build_wasm.sh
148148
- cd dist
149149
- tar czf ../wally_dist/esplora-wasm.tar.gz --remove-files wallycore.js wallycore.wasm
150150
- cd ..

src/wasm_package/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -xeo pipefail
33

44
# Build WASM (Note Elements is always enabled)
5-
(cd ../.. && EMCC_OPTIONS="-s EXPORT_ES6=1 -s MODULARIZE=1" ./tools/build_wasm.sh)
5+
(cd ../.. && ./tools/build_wasm.sh)
66
mkdir -p libwally_wasm && cp ../../dist/wallycore.{js,wasm} libwally_wasm/
77
touch libwally_wasm/index # necessary for webpack to work (fixes "Can't resolve './' in 'wasm_package/libwally_wasm'")
88

tools/build_wasm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export CFLAGS="-fno-stack-protector"
3030
emconfigure ./configure --build=$HOST_OS ac_cv_c_bigendian=no --disable-swig-python --disable-swig-java $DISABLE_ELEMENTS --disable-tests --enable-export-all --enable-wasm-interface
3131
emmake make -j $num_jobs
3232

33-
EMCC_OPTIONS="$EMCC_OPTIONS -s EXPORT_NAME=InitWally -s WASM_BIGINT"
33+
: ${EMCC_OPTIONS:="-s EXPORT_ES6=1 -s WASM_BIGINT"}
3434
: ${OPTIMIZATION_LEVEL:=3}
3535
: ${EXPORTED_RUNTIME_METHODS:='cwrap,ccall,getValue,UTF8ToString'}
3636
# Get the list of functions to export

0 commit comments

Comments
 (0)