########################################################################
########################################################################
-# SQLITE3.xJS.ESM-EXPORT-DEFAULT is used by mkwasmbuilds.c and the
+# SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT is used by mkwasmbuilds.c and the
# wasmfs build. $1 is 1 if the build mode needs this workaround
# (modes: esm, bundler-friendly, node) and 0 if not (vanilla). $2 must
# be 0 for all builds except sqlite3-wasmfs.mjs, in which case it must
#
# Maintenance reminder: Mac sed works differently than GNU sed, so we
# use awk instead of sed for this.
-define SQLITE3.xJS.ESM-EXPORT-DEFAULT
+define SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT
if [ x1 = x$(1) ]; then \
- echo "Fragile workaround for emscripten/issues/18237. See SQLITE3.xJS.ESM-EXPORT-DEFAULT."; \
+ echo "Fragile workaround for emscripten/issues/18237. See SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT."; \
{\
awk '/^export default/ && !f{f=1; next} 1' $@ > $@.tmp && mv $@.tmp $@; \
} || exit $$?; \
bin.wasm-strip = @BIN_WASM_STRIP@
bin.wasm-opt = @BIN_WASM_OPT@
+ifeq (,$(bin.wasm-opt))
+ # wasm-opt is an optional optimization step. We install a dummy
+ # command in its place if it's not available to simplify the make
+ # recipes which use it.
+ #bin.wasm-opt = echo "[not wasm-opt]"
+endif
SHELL := $(bin.bash)
# The following overrides can be activated to test
ps("# pre-post-jses.deps.* = a list of dependencies for the");
ps("# --[extern-][pre/post]-js files.");
ps("pre-post-jses.deps.common := $(extern-pre-js.js) $(sqlite3-license-version.js)");
+
+ /* SQLITE.CALL.WASM-OPT = shell code to run $(1) (source wasm file
+ ** name) through $(bin.wasm-opt) */
+ ps("ifeq (,$(bin.wasm-opt))");
+ ps("define SQLITE.CALL.WASM-OPT");
+ ps("echo 'wasm-opt not available: $(1)'");
+ ps("endef");
+ ps("else");
+ ps("define SQLITE.CALL.WASM-OPT");
+ ps("echo -n 'Before wasm-opt:'; ls -l $(1);\\\n"
+ "\trm -f wasm-opt-tmp.wasm;\\\n"
+ "\t$(bin.wasm-opt) --enable-bulk-memory-opt --all-features --post-emscripten\\\n"
+ "\t$(1) -o wasm-opt-tmp.wasm || exit;\\\n"
+ "\tmv wasm-opt-tmp.wasm $(1); "
+ "echo -n 'After wasm-opt: '; ls -l $(1)"
+ );
+ ps("endef");
+ ps("endif");
}
/*
const char *zJsOut /* name of generated sqlite3.js/.mjs */,
const char *zCmppD /* extra -D flags for c-pp */,
const char *zEmcc /* extra flags for emcc */){
+ const char * zTgtWasmName = "$(basename $@).wasm"
+ /* The various targets named X.js or X.mjs (zJsOut) also generate
+ ** X.wasm, and we need that part of the name to perform some
+ ** post-processing after Emscripten generates X.wasm. */;
assert( zName );
assert( zMode );
assert( zApiJsOut );
/* TODO? Replace this CALL with the corresponding makefile code.
** OTOH, we also use this $(call) in the speedtest1-wasmfs build,
** which is not part of the rules emitted by this program. */
- pf("\t@$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,1,%d)\n",
+ pf("\t@$(call SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT,1,%d)\n",
0==strcmp("sqlite3-wasmfs", zName) ? 1 : 0);
}
- pf("\t@dotwasm=$(basename $@).wasm; \\\n"
- "\tchmod -x $$dotwasm; \\\n"
- "\t$(maybe-wasm-strip) $$dotwasm; \\\n");
- pf("\tsed -i -e '/^var _sqlite3.*createExportWrapper/d' %s; \\\n"
- "\techo 'Stripped out createExportWrapper() parts.'; \\\n",
+ pf("\t@chmod -x %s; \\\n"
+ "\t$(maybe-wasm-strip) %s;\n",
+ zTgtWasmName, zTgtWasmName);
+ pf("\t@$(call SQLITE.CALL.WASM-OPT,%s)\n", zTgtWasmName);
+ pf("\t@sed -i -e '/^var _sqlite3.*createExportWrapper/d' %s || exit; \\\n"
+ /* ^^^^^^ reminder: Mac/BSD sed has no -i flag */
+ "\techo 'Stripped out createExportWrapper() parts.'\n",
zJsOut) /* Our JS code installs bindings of each WASM export. The
generated Emscripten JS file does the same using its
own framework, but we don't use those results and can
** identical for all builds for which zEmcc is empty.
*/
if( 0==strcmp("bundler-friendly", zMode)
- || 0==strcmp("node", zMode) ) {
- pf("\techo 'Patching $@ for %s.wasm...' \\\n", zName);
- pf("\trm -f $$dotwasm; dotwasm=; \\\n"
- "\tsed -i -e 's/%s-%s.wasm/%s.wasm/g' $@ || exit $$?; \\\n",
+ || 0==strcmp("node", zMode) ){
+ pf("\t@echo 'Patching $@ for %s.wasm...'; \\\n", zName);
+ pf("\trm -f %s; \\\n", zTgtWasmName);
+ pf("\tsed -i -e 's/%s-%s.wasm/%s.wasm/g' $@ || exit;\n",
+ /* ^^^^^^ reminder: Mac/BSD sed has no -i flag */
zNM, zName);
}
- pf("\tls -la $$dotwasm $@\n");
+ pf("\t@ls -la %s $@\n", zTgtWasmName);
if( 0!=strcmp("sqlite3-wasmfs", zName) ){
/* The sqlite3-wasmfs build is optional and needs to be invoked
** conditionally using info we don't have here. */
$(emcc.flags.sqlite3-wasmfs) \
$(emcc.flags.speedtest1-wasmfs) \
-o $@ $(speedtest1.cfiles) -lm
- @$(call SQLITE3.xJS.ESM-EXPORT-DEFAULT,1,1)
+ @$(call SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT,1,1)
$(maybe-wasm-strip) $(speedtest1-wasmfs.wasm)
chmod -x $(speedtest1-wasmfs.wasm)
ls -la $@ $(speedtest1-wasmfs.wasm)
-C Move\ssmall\sparts\sof\sext/wasm/GNUmakefile\sinto\sext/wasm/config.make.in\sand\shave\sthe\sconfigure\sscript\spopulate\sthat,\srather\sthan\sdynamically\sdetermining\sthose\svalues\son\seach\s'make'\sinvocation.\sAdd\sa\sconfigure-time\scheck\sfor\sthe\soptional\swasm-opt\sbinary\sin\sprep\sfor\spending\sexperimentation\swith\susing\sit\sto\sreduce\sthe\swasm\sfile\ssizes.
-D 2025-01-23T14:09:02.122
+C Initial\ssupport\sfor\spost-processing\swasm\sfiles\swith\swasm-opt\s(if\sit's\savailable).\sThis\scurrently\sshaves\s12kb\soff\sof\sthe\srelease-mode\sbuild\sof\ssqlite3.wasm\sbut\sthere\sare\smany\sdozens\sof\swasm-opt\sflags\sleft\sto\stry.
+D 2025-01-23T15:58:01.776
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d
F ext/session/sqlite3session.h 683ccbf16e2c2521661fc4c1cf918ce57002039efbcabcd8097fa4bca569104b
F ext/session/test_session.c 12e0a2c15fd60f92da4bb29c697c9177ff0c0dbcdc5129a54c47e999f147937a
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
-F ext/wasm/GNUmakefile 5c36cb9ad5217e74f8936861210dac0b052b9cd418cbabe915cc9d646c5743a0
+F ext/wasm/GNUmakefile 999ea962c098a934daa18e724c53856493adf1e03b3237465a5ee5b6fde28880
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
F ext/wasm/README.md a8a2962c3aebdf8d2104a9102e336c5554e78fc6072746e5daf9c61514e7d193
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
F ext/wasm/common/testing.css e97549bab24126c24e0daabfe2de9bb478fb0a69fdb2ddd0a73a992c091aad6f
F ext/wasm/common/whwasmutil.js d76c69617e95d85ffc9996f7d9d7481df6976dcbd860ecd82bd8c075e3a101ae
-F ext/wasm/config.make.in f830c98f0f668f7628d9521bc0b1175ab15b050f20fe3234346be346d747c587
+F ext/wasm/config.make.in a44a2f9657c80c9ef0f5a462937a7c2f64916c8b99fb0a28b67d37f961997c94
F ext/wasm/demo-123-worker.html a0b58d9caef098a626a1a1db567076fca4245e8d60ba94557ede8684350a81ed
F ext/wasm/demo-123.html 8c70a412ce386bd3796534257935eb1e3ea5c581e5d5aea0490b8232e570a508
F ext/wasm/demo-123.js c7b3cca50c55841c381a9ca4f9396e5bbdc6114273d0b10a43e378e32e7be5bf
F ext/wasm/index.html e4bbffdb3d40eff12b3f9c7abedef91787e2935620b7f8d40f2c774b80ad8fa9
F ext/wasm/jaccwabyt/jaccwabyt.js 1264710db3cfbcb6887d95665b7aeba60c1126eaef789ca4cf1a4a17d5bc7f54
F ext/wasm/jaccwabyt/jaccwabyt.md 59a20df389abcc3606eb4eaea7fb7ba14504beb3e345dbea9b99a0618ba3bec8
-F ext/wasm/mkwasmbuilds.c 619b99bffb9538c681f0622395a177e4ba2e2658bc1b94bb7f6605245b6e365e
+F ext/wasm/mkwasmbuilds.c 9f4e0527043a20fab98463e455eeaf287e58b01700248b213159b86a6c3fbb5f
F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337
F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96
F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63
F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471f4520a99e5b545928668f4285fb5e
F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
-F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35
+F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
F main.mk 18b859068a43818d29172b36d624a9bc8ce8204350ebd18a9f96994970081ab9
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 10c91f9cd074e8d35af1c7f8251ac18e5dd91fa14df3fe4e1fb44441c4f08c7a
-R 07e50a0cf41474faaa27c1572e1c844e
+P 0a426a549577b883e2de7cd0605041cc97b57f53ee6657bc318b0bfde7b62677
+R 2d32486992b9b3356e014d934b282b6a
U stephan
-Z 685755e90bacd2eb62f10206ae6eb72e
+Z edbdf887524cd901e3308cf68c45b681
# Remove this line to create a well-formed Fossil manifest.
-0a426a549577b883e2de7cd0605041cc97b57f53ee6657bc318b0bfde7b62677
+5d16e3f28364de2d6b6456a6fc56bf604b9106c3ae15719f2862192ae3020cc1