# -Dcustom-Module.instantiateWasm to some of the builds. This is
# experimental.
#
-# Changing this may require a clean rebuild.
+# Changing this may require a clean rebuild. It also might not work.
#
-WASM_CUSTOM_INSTANTIATE = 1
+WASM_CUSTOM_INSTANTIATE = 0
########################################################################
# $(bin.c-pp): a minimal text file preprocessor. Like C's but much
endif
# cflags.common = C compiler flags for all builds
-cflags.common = -I. -I$(dir $(sqlite3.c))
+cflags.common = -I. -I$(dir $(sqlite3.c)) -std=c99 -fPIC
# emcc.WASM_BIGINT = 1 for BigInt (C int64) support, else 0. The API
# disables certain features if BigInt is not enabled and such builds
# _are not tested_ on any regular basis.
#
########################################################################
-#
-# Only add wasmfs if wasmfs.enable=1 or we're running (dist)clean
-#
-ifneq (,$(filter wasmfs,$(MAKECMDGOALS)))
-wasmfs.enable ?= 1
-else
-# Unconditionally enable wasmfs for [dist]clean so that the wasmfs
-# sub-make can clean up.
-wasmfs.enable ?= $(MAKING_CLEAN)
-endif
-ifeq (1,$(wasmfs.enable))
-# wasmfs build disabled 2022-10-19 per /chat discussion.
-# OPFS-over-wasmfs was initially a stopgap measure and a convenient
-# point of comparison for the OPFS sqlite3_vfs's performance, but it
-# currently doubles our deliverables and build maintenance burden for
-# little benefit.
-#
-########################################################################
-# Some platforms do not support the WASMFS build. Raspberry Pi OS is
-# one of them (or was when that comment was initially written). As
-# such platforms are discovered, add their (uname -m) name to
-# PLATFORMS_WITH_NO_WASMFS to exclude the wasmfs build parts.
-PLATFORMS_WITH_NO_WASMFS = aarch64 # add any others here
-THIS_ARCH = $(shell /usr/bin/uname -m)
-ifneq (,$(filter $(THIS_ARCH),$(PLATFORMS_WITH_NO_WASMFS)))
-$(info This platform does not support the WASMFS build.)
-HAVE_WASMFS = 0
-else
-HAVE_WASMFS = 1
-endif
-endif
-# /wasmfs
-########################################################################
-
#
# Inputs/outputs for the sqlite3-api.js family.
#
fiddle.c.in = $(dir.top)/shell.c $(sqlite3-wasm.c)
+#
+# Only add wasmfs if wasmfs.enable=1 or we're running (dist)clean
+#
+ifneq (,$(filter wasmfs b-wasmfs,$(MAKECMDGOALS)))
+wasmfs.enable ?= 1
+else
+# Unconditionally enable wasmfs for [dist]clean so that the wasmfs
+# sub-make can clean up.
+wasmfs.enable ?= $(MAKING_CLEAN)
+endif
+#
+# WASMFS build - unsupported and untested. We used WASMFS
+# to jumpstart development early on, but it has always been
+# a moving target, in that Emscripten updates have broken
+# our build often enough that we no longer actively support it.
+# It's interesting to keep around, though.
+#
+cflags.wasmfs = -DSQLITE_ENABLE_WASMFS
+
#
# bin.mkwb is used for generating much of the makefile code for the
# various wasm builds. It used to be generated in this makefile via a
** within the body of sqlite3InitModule().
**
** --extern-pre-js = gets injected before sqlite3InitModule(), in the
-** global scope.
+** global scope. We inject the license and version info here.
**
-** --extern-pre-js = gets injected immediately after
-** sqlite3InitModule(), in the global scope.
+** --extern-post-js = gets injected immediately after
+** sqlite3InitModule(), in the global scope. In this step we replace
+** sqlite3InitModule() with a slightly customized, the main purpose of
+** which is to (A) give us (not Emscripten) control over the arguments
+** it accepts and (B) to run the library bootstrap step.
**
** Then there's sqlite3-api.BuildName.js, which is the entire SQLite3
** JS API (generated from the list defined in $(sqlite3-api.jses)). It
.zDotWasm = 0,
.zCmppD = "$(c-pp.D.bundler)",
.zEmcc = 0,
- .zEmccExtra = "-sEXPORT_ES6 -sUSE_ES6_IMPORT_META",
+ .zEmccExtra =
+ "-sEXPORT_ES6 -sUSE_ES6_IMPORT_META"
+ " -sUSE_CLOSURE_COMPILER=0"
+ " -pthread -sWASMFS -sPTHREAD_POOL_SIZE=1"
+ " -sERROR_ON_UNDEFINED_SYMBOLS=0 -sLLD_REPORT_UNDEFINED"
+ ,
.zEnv = 0,
.zDeps = 0,
- .zIfCond = "ifeq (1,$(HAVE_WASMFS))",
- .flags = CP_ALL | F_UNSUPPORTED | F_WASMFS
+ .zIfCond = 0,
+ .flags = CP_ALL | F_UNSUPPORTED | F_WASMFS | F_ESM
}
};
+++ /dev/null
-#!/usr/bin/make
-#^^^^ help emacs select makefile mode
-#
-# This is a sub-make for building a standalone wasmfs-based
-# sqlite3.wasm. It is intended to be "include"d from the main
-# GNUMakefile.
-########################################################################
-MAKEFILE.wasmfs = $(lastword $(MAKEFILE_LIST))
-# ensure that the following message starts on line 10 or higher for proper
-# $(warning) alignment!
-ifneq (1,$(MAKING_CLEAN))
- $(warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
- $(warning !! The WASMFS build is unsupported. Use at your own risk.
- $(warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
-endif
-
-sqlite3-wasmfs.js = $(dir.wasmfs)/sqlite3-wasmfs.js
-sqlite3-wasmfs.wasm = $(dir.wasmfs)/sqlite3-wasmfs.wasm
-
-########################################################################
-# emcc flags for .c/.o.
-cflags.sqlite3-wasmfs =
-cflags.sqlite3-wasmfs += -std=c99 -fPIC
-cflags.sqlite3-wasmfs += -pthread
-cflags.sqlite3-wasmfs += -DSQLITE_ENABLE_WASMFS
-
-########################################################################
-# emcc flags specific to building the final .js/.wasm file...
-emcc.flags.sqlite3-wasmfs =
-emcc.flags.sqlite3-wasmfs += \
- -sEXPORTED_RUNTIME_METHODS=wasmMemory
- # wasmMemory ==> for -sIMPORTED_MEMORY
-# Some version of emcc between 3.1.60-ish(?) and 3.1.62 deprecated the
-# use of (allocateUTF8OnStack,stringToUTF8OnStack). Earlier emcc
-# versions will fail to build without those in the
-# EXPORTED_RUNTIME_METHODS list.
-emcc.flags.sqlite3-wasmfs += -sUSE_CLOSURE_COMPILER=0
-emcc.flags.sqlite3-wasmfs += -Wno-limited-postlink-optimizations
-# ^^^^^ emcc likes to warn when we have "limited optimizations" via the -g3 flag.
-emcc.flags.sqlite3-wasmfs += -sMEMORY64=0
-emcc.flags.sqlite3-wasmfs += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.128)
-# ^^^^ 64MB is not enough for WASMFS/OPFS test runs using batch-runner.js
-sqlite3-wasmfs.fsflags = -pthread -sWASMFS \
- -sPTHREAD_POOL_SIZE=1 \
- -sERROR_ON_UNDEFINED_SYMBOLS=0 -sLLD_REPORT_UNDEFINED
-# ^^^^^ why undefined symbols are necessary for the wasmfs build is anyone's guess.
-emcc.flags.sqlite3-wasmfs += $(sqlite3-wasmfs.fsflags)
-emcc.flags.sqlite3-wasmfs += -sALLOW_MEMORY_GROWTH=0
-#^^^ using ALLOW_MEMORY_GROWTH produces a warning from emcc:
-# USE_PTHREADS + ALLOW_MEMORY_GROWTH may run non-wasm code slowly,
-# see https://github.com/WebAssembly/design/issues/1271 [-Wpthreads-mem-growth]
-# And, indeed, it runs slowly if memory is permitted to grow.
-#emcc.flags.sqlite3-wasmfs.vanilla =
-#emcc.flags.sqlite3-wasmfs.esm = -sEXPORT_ES6 -sUSE_ES6_IMPORT_META
-$(sqlite3-wasmfs.js) $(dir.wasmfs)/sqlite3-wasmfs.mjs: $(MAKEFILE.wasmfs)
-########################################################################
-# Build quirk: we cannot build BOTH .js and .mjs with our current
-# build infrastructure because the supplemental *.worker.js files get
-# generated with the name of the main module file
-# ($(sqlite3-wasmfs.{js,mjs})) hard-coded in them. Thus the last one
-# to get built gets the *.worker.js files mapped to it. In order to
-# build both modes they would need to have distinct base names or
-# output directories. "The problem" with giving them distinct base
-# names is that it means that the corresponding .wasm file is also
-# built/saved multiple times. It is likely that anyone wanting to use
-# WASMFS will want an ES6 module, so that's what we build here.
-wasmfs.build.ext = mjs
-$(sqlite3-wasmfs.js) $(dir.wasmfs)/sqlite3-wasmfs.mjs: $(SOAP.js.bld)
-ifeq (js,$(wasmfs.build.ext))
- $(sqlite3-wasmfs.wasm): $(sqlite3-wasmfs.js)
- wasmfs: $(sqlite3-wasmfs.js)
-else
- $(sqlite3-wasmfs.wasm): $(dir.wasmfs)/sqlite3-wasmfs.mjs
- wasmfs: $(dir.wasmfs)/sqlite3-wasmfs.mjs
-endif
-all: wasmfs
-
-########################################################################
-# speedtest1 for wasmfs.
-speedtest1-wasmfs.mjs = $(dir.wasmfs)/speedtest1-wasmfs.mjs
-speedtest1-wasmfs.wasm = $(subst .mjs,.wasm,$(speedtest1-wasmfs.mjs))
-emcc.flags.speedtest1-wasmfs = $(sqlite3-wasmfs.fsflags)
-emcc.flags.speedtest1-wasmfs += $(SQLITE_OPT)
-emcc.flags.speedtest1-wasmfs += -sALLOW_MEMORY_GROWTH=0
-emcc.flags.speedtest1-wasmfs += -sINITIAL_MEMORY=$(emcc.INITIAL_MEMORY.128)
-#$(info speedtest DEPS=pre-post-sqlite3-wasmfs-esm.deps=$(pre-post-sqlite3-wasmfs-esm.deps))
-$(speedtest1-wasmfs.mjs): $(speedtest1.cfiles) $(sqlite3-wasmfs.js) \
- $(MAKEFILE) $(MAKEFILE.wasmfs) $(pre-post-sqlite3-wasmfs-esm.deps) \
- $(EXPORTED_FUNCTIONS.speedtest1)
- @echo "Building $@ ..."
- $(bin.emcc) \
- $(pre-post-sqlite3-wasmfs-esm.flags) \
- $(cflags.common) \
- $(cflags.sqlite3-wasmfs) \
- $(emcc.speedtest1.common) \
- $(emcc.flags.speedtest1-vanilla) \
- $(emcc.flags.sqlite3-wasmfs) \
- $(emcc.flags.speedtest1-wasmfs) \
- -o $@ $(speedtest1.cfiles) -lm
- @$(call SQLITE.CALL.xJS.ESM-EXPORT-DEFAULT,1,1,$(logtag.wasmfs))
- $(maybe-wasm-strip) $(speedtest1-wasmfs.wasm)
- chmod -x $(speedtest1-wasmfs.wasm)
- ls -la $@ $(speedtest1-wasmfs.wasm)
-
-wasmfs: $(speedtest1-wasmfs.mjs)
-# end speedtest1.js
-########################################################################
-C Fix\sharmless\sinteger\soverflows\scaused\sby\sover-sized\sinteger\sconstants\sin\nthe\s"{m,n}"\ssyntax\sof\sthe\sregexp\sextension.
-D 2025-09-26T11:53:54.114
+C Get\swasmfs\sbuild\sworking\sin\sthe\snew\ssetup.\sDisable\sthe\scustom\swasm\sloader\sbecause\sits\sgenerated\smakefile\scode\sis\scurrently\sbroken.
+D 2025-09-26T12:49:41.370
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F ext/session/sqlite3session.h 7404723606074fcb2afdc6b72c206072cdb2b7d8ba097ca1559174a80bc26f7a
F ext/session/test_session.c 8766b5973a6323934cb51248f621c3dc87ad2a98f023c3cc280d79e7d78d36fb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
-F ext/wasm/GNUmakefile c6cd306a0b078daf7da2af2decd2f60d84aacc3cd6775b5481285628291c877b
+F ext/wasm/GNUmakefile 3c9bab1b8bf5c816fbfe226927e27e72812a8bade09e96cced474e94741051ce
F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a
F ext/wasm/README.md 66ace67ae98a45e4116f2ca5425b716887bcee4d64febee804ff6398e1ae9ec7
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
F ext/wasm/jaccwabyt/jaccwabyt.js bbac67bc7a79dca34afe6215fd16b27768d84e22273507206f888c117e2ede7d
F ext/wasm/jaccwabyt/jaccwabyt.md 167fc0b624c9bc2c477846e336de9403842d81b1a24fc4d3b24317cb9eba734f
F ext/wasm/mkdist.sh 29f8a37a7aba41fa5df8e89b1fab02b83b35c43473c5cf808584872e022514b8 x
-F ext/wasm/mkwasmbuilds.c 91624cea0a0e7b9b0c96bfb682f5a89c46d4f804a116b209dcbc808001a2c97f
+F ext/wasm/mkwasmbuilds.c d8b5e332b53a9ccbad937a3dbb59d850cbef91d67efa9c326feac0430ee90fbb
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/sahpool/index.html be736567fd92d3ecb9754c145755037cbbd2bca01385e2732294b53f4c842328
F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36e0f6991460fff0cb7c15079454679a4e2
F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61
-F ext/wasm/wasmfs.make 5de02751b3e9e79b81a52ab4fe0ed6aa6a23311a90db58fea98c1c4e2845e562
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
F main.mk fd45a3578989f38bbeb2564a63883f6f6c077105c9f1361c3eac411d31f3afbd
F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P d022ee167b90a7c32049a93d476e869270018017f60551185024409730d77640
-R b5ba3b2e9358725e1c77fc6398b42b2c
-U drh
-Z 70b5e36db724d08f297bb83c1614bd83
+P 8f17e1d869685b51f3368feed03dc06543ec16bc8fd81b8daad2ac2dbf99c5d6
+R 5e672d86934b8320ca0a7d5b18bc23c5
+U stephan
+Z 1a1ba5bad861e833b8982957ff27b00f
# Remove this line to create a well-formed Fossil manifest.
-8f17e1d869685b51f3368feed03dc06543ec16bc8fd81b8daad2ac2dbf99c5d6
+36bc2514f70af5608aa20903d9c38b316603e2f78f2cbf4a20c7c79b60c5b8d5