1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-24 09:53:10 +03:00

Reinstate the Module.instantiateWasm() override and simplify how the wasm filename gets injected into the JS files.

FossilOrigin-Name: e878ffd2eaa87e2978c44fcd03a1eb6114a9ae31e31101898d682f43cf81000f
This commit is contained in:
stephan
2025-09-26 17:11:39 +00:00
parent b62c26d999
commit 96c753ec56
6 changed files with 256 additions and 232 deletions

View File

@@ -74,6 +74,7 @@ emo.lock = 🔒
emo.magic = 🧙
emo.megaphone = 📣
emo.mute = 🔇
emo.edit = ✏️
emo.stop = 🛑
emo.strip = 💈
emo.test = 🧪
@@ -201,13 +202,35 @@ b.cp = $(call b.mkdir@); \
cp -p $(2) $(3) || exit
#
# $(eval $(call b.eval.c-pp,@,src,dest,-Dx=y...))
# $(call b.c-pp.shcmd,LOGTAG,src,dest,-Dx=y...)
#
# Resolves to shell code to create $(3) from $(2) and $(4) using
# $(bin.c-pp).
#
# $1 = build name
# $2 = Input file(s): cat $(2) | $(bin.c-pp) ...
# $3 = Output file: $(bin.c-pp) -o $(3)
# $4 = optional $(bin.c-pp) -D... flags
define b.eval.c-pp
# $2 = Input file(s)
# $3 = Output file
# $4 = optional $(bin.c-pp) flags
define b.c-pp.shcmd
$(call b.mkdir@); \
$(call b.echo,$(1),$(emo.disk)$(emo.lock) $(bin.c-pp) $(4) $(if $(loud.if),$(2))); \
rm -f $(3); \
$(bin.c-pp) -o $(3) $(4) $(2) || exit; \
chmod -w $(3)
endef
#
# $(eval $(call b.c-pp.target,LOGTAG,src,dest,-Dx=y...))
#
# Creates target $(3) using $(bin.c-pp) $(2) $(4).
#
# Args: as for $(b.c-pp.shcmd).
define b.c-pp.target
$(3): $$(MAKEFILE_LIST) $$(bin.c-pp) $(2)
@$$(call b.c-pp.shcmd,$(1),$(2),$(3),$(4))
CLEAN_FILES += $(3)
endef
define xxxb.c-pp.target
$(3): $$(MAKEFILE_LIST) $$(bin.c-pp) $(2)
@$$(call b.mkdir@); \
$$(call b.echo,$(1),$$(emo.disk)$$(emo.lock) $$(bin.c-pp) $(4) $(if $(loud.if),$(2))); \
@@ -459,16 +482,17 @@ ifneq (,$(sqlite3_wasm_extra_init.c))
endif
#
# Experimental and not known to work since the build upheaval in
# 2025-09.
# Actitivates (or not) a custom Module.instantiateWasm() override for
# Emscripten. That override gives us more control over exactly which
# WASM file is in use.
#
# If $(WASM_CUSTOM_INSTANTIATE) is 1 then mkwasmbuilds will add
# -Dcustom-Module.instantiateWasm to some of the builds. This is
# experimental.
# experimental but works on all browsers tested by its developer.
#
# Changing this may require a clean rebuild. It also might not work.
#
WASM_CUSTOM_INSTANTIATE = 0
WASM_CUSTOM_INSTANTIATE = 1
########################################################################
# $(bin.c-pp): a minimal text file preprocessor. Like C's but much
@@ -500,7 +524,7 @@ WASM_CUSTOM_INSTANTIATE = 0
# build. They are solely for use with $(bin.c-pp) itself.
#
# -D... flags which should be included in all invocations should be
# appended to $(b.eval.c-pp.flags).
# appended to $(b.c-pp.target.flags).
bin.c-pp = ./c-pp
$(bin.c-pp): c-pp.c $(sqlite3.c) # $(MAKEFILE)
$(CC) -O0 -o $@ c-pp.c $(sqlite3.c) '-DCMPP_DEFAULT_DELIM="//#"' -I$(dir.top) \
@@ -508,9 +532,9 @@ $(bin.c-pp): c-pp.c $(sqlite3.c) # $(MAKEFILE)
-DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_WAL -DSQLITE_THREADSAFE=0 \
-DSQLITE_TEMP_STORE=3
DISTCLEAN_FILES += $(bin.c-pp)
b.eval.c-pp.flags ?=
b.c-pp.target.flags ?=
ifeq (1,$(SQLITE_C_IS_SEE))
b.eval.c-pp.flags += -Denable-see
b.c-pp.target.flags += -Denable-see
endif
# cflags.common = C compiler flags for all builds
@@ -742,19 +766,9 @@ emcc.jsflags += -sLLD_REPORT_UNDEFINED
########################################################################
# Undocumented Emscripten feature: if the target file extension is
# "mjs", it defaults to ES6 module builds:
# https://github.com/emscripten-core/emscripten/issues/14383
sqlite3.wasm = $(dir.dout)/sqlite3.wasm
sqlite3-wasm.c = $(dir.api)/sqlite3-wasm.c
sqlite3-wasm.c.in = $(sqlite3-wasm.c) $(sqlite3_wasm_extra_init.c)
sqlite3-wasmfs.c.in = $(sqlite3-wasm.c.in)
# sqlite3-wasm.o vs sqlite3-wasm.c: building against the latter
# (predictably) results in a slightly faster binary. We're close
# enough to the target speed requirements that the 500ms makes a
# difference, so we build all binaries against sqlite3-wasm.c instead
# of building a shared copy of sqlite3-wasm.o to link against.
########################################################################
#
# b.call.patch-export-default is used by mkwasmbuilds.c and the
@@ -1007,6 +1021,12 @@ fiddle.EXPORTED_FUNCTIONS.in = \
fiddle.c.in = $(dir.top)/shell.c $(sqlite3-wasm.c)
#
# 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.
#
# Only add wasmfs if wasmfs.enable=1 or we're running (dist)clean
#
@@ -1017,23 +1037,19 @@ else
# 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
# end wasmfs (the rest is in mkwasmbuilds.c)
#
#
# bin.mkwb is used for generating much of the makefile code for the
# $(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
# difficult-to-read/maintain block of $(eval)'d code. Attempts were
# made to generate it from tcl and bash (shell) but having to escape
# the $ references in those languages made it just as illegible as the
# native makefile code. Somewhat surprisingly, moving that code generation
# to C makes it slightly less illegible than the previous 3 options.
# native makefile code. Somewhat surprisingly, moving that code
# generation to C makes it slightly less illegible than the previous 3
# options.
#
# Maintenance notes:
#
@@ -1042,7 +1058,7 @@ cflags.wasmfs = -DSQLITE_ENABLE_WASMFS
#
# - Vars which are used by $(bin.mkwb) in dependency lists and such
# need to be defined before this is included. Those used in recipies
# do not.
# may be defined after this step.
#
bin.mkwb = ./mkwasmbuilds
ifneq (1,$(MAKING_CLEAN))
@@ -1080,7 +1096,7 @@ sqlite3.ext.js =
define gen-worker1
# $1 = X.ext part of sqlite3-worker1X.ext
# $2 = $(c-pp.D.NAME)
$(call b.eval.c-pp,filter,$(dir.api)/sqlite3-worker1.c-pp.js,\
$(call b.c-pp.target,filter,$(dir.api)/sqlite3-worker1.c-pp.js,\
$(dir.dout)/sqlite3-worker1$(1),$(2))
sqlite3.ext.js += $(dir.dout)/sqlite3-worker1$(1)
all: $(dir.dout)/sqlite3-worker1$(1)
@@ -1097,7 +1113,7 @@ $(eval $(call gen-worker1,-bundler-friendly.mjs,$(c-pp.D.bundler)))
define gen-promiser
# $1 = X.ext part of sqlite3-worker1-promiserX.ext
# $2 = $(c-pp.D.NAME)
$(call b.eval.c-pp,filter,$(dir.api)/sqlite3-worker1-promiser.c-pp.js,\
$(call b.c-pp.target,filter,$(dir.api)/sqlite3-worker1-promiser.c-pp.js,\
$(dir.dout)/sqlite3-worker1-promiser$(1),$(2))
sqlite3.ext.js += $(dir.dout)/sqlite3-worker1-promiser$(1)
all: $(dir.dout)/sqlite3-worker1-promiser$(1)
@@ -1114,8 +1130,8 @@ $(eval $(call gen-promiser,-bundler-friendly.mjs,$(c-pp.D.bundler)))
# $3 = -D... flags for $(bin.c-pp)
#
define gen-dwp
$(call b.eval.c-pp,test,demo-worker1-promiser.c-pp.js,demo-worker1-promiser$(1),$(3))
$(call b.eval.c-pp,test,demo-worker1-promiser.c-pp.html,demo-worker1-promiser$(2),$(3))
$(call b.c-pp.target,test,demo-worker1-promiser.c-pp.js,demo-worker1-promiser$(1),$(3))
$(call b.c-pp.target,test,demo-worker1-promiser.c-pp.html,demo-worker1-promiser$(2),$(3))
demos: demo-worker1-promiser$(1) demo-worker1-promiser$(2)
endef
$(eval $(call gen-dwp,.js,.html,$(c-pp.D.vanilla)))
@@ -1226,7 +1242,7 @@ define gen-tester1.js
# $1 = build name to have dep on
# $2 = suffix for tester1SUFFIX JS
# $3 = c-pp flags
$(call b.eval.c-pp,test,tester1.c-pp.js,tester1$(2),$(3))
$(call b.c-pp.target,test,tester1.c-pp.js,tester1$(2),$(3))
tester1$(2): $(sqlite3.ext.js) $(out.$(1).wasm)
tester1-$(1): tester1$(2)
tester1: tester1$(2)
@@ -1242,7 +1258,7 @@ define gen-tester1.html
# $1 = build name to have a dep on
# $2 = file suffix: empty, -64bit, -esm, esm-64bit
# $3 = c-pp -D flags.
$(call b.eval.c-pp,test,tester1.c-pp.html,tester1$(2).html,$(3))
$(call b.c-pp.target,test,tester1.c-pp.html,tester1$(2).html,$(3))
tester1$(2).html: tester1-$(1)
tester1: tester1$(2).html
endef
@@ -1255,8 +1271,8 @@ $(eval $(call gen-tester1.html,esm64,-esm-64bit,$(c-pp.D.esm64)))
# tester1-worker.html variants:
# There is no ESM variant of this file. Instead, that page accepts a
# ?esm URL flag to switch to ESM mode.
$(eval $(call b.eval.c-pp,test,tester1-worker.c-pp.html,tester1-worker.html))
$(eval $(call b.eval.c-pp,test,tester1-worker.c-pp.html,tester1-worker-64bit.html,$(c-pp.D.64bit)))
$(eval $(call b.c-pp.target,test,tester1-worker.c-pp.html,tester1-worker.html))
$(eval $(call b.c-pp.target,test,tester1-worker.c-pp.html,tester1-worker-64bit.html,$(c-pp.D.64bit)))
tester1: tester1-worker.html tester1-worker-64bit.html
all: tester1

View File

@@ -45,7 +45,18 @@ const toExportForESM =
location: globalThis.location,
urlParams: globalThis?.location?.href
? new URL(globalThis.location.href).searchParams
: new URLSearchParams()
: new URLSearchParams(),
/*
It is literally impossible to reliably get the name of _this_ script
at runtime, so impossible to reliably derive X.wasm from script name
X.js. (This is apparently why Emscripten hard-codes the name of the
wasm file into their output.) Thus we need, at build-time, to set
the name of the WASM file which our custom instantiateWasm() should to
load. The build process populates this.
Module.instantiateWasm() is found in pre-js.c-pp.js.
*/
wasmFilename: '@sqlite3.wasm@' /* replaced by the build process */
});
sIMS.debugModule =
sIMS.urlParams.has('sqlite3.debugModule')

View File

@@ -14,18 +14,18 @@
itself. i.e. try to keep file-local symbol names obnoxiously
collision-resistant.
*/
const sIMS =
(function(Module){
const sIMS =
globalThis.sqlite3InitModuleState/*from extern-post-js.c-pp.js*/
|| Object.assign(Object.create(null),{
debugModule: ()=>{
console.warn("globalThis.sqlite3InitModuleState is missing");
}
});
delete globalThis.sqlite3InitModuleState;
sIMS.debugModule('pre-js.js sqlite3InitModuleState =',sIMS);
delete globalThis.sqlite3InitModuleState;
sIMS.debugModule('pre-js.js sqlite3InitModuleState =',sIMS);
//#ifnot target=es6-bundler-friendly
/**
/**
This custom locateFile() tries to figure out where to load `path`
from. The intent is to provide a way for foo/bar/X.js loaded from a
Worker constructor or importScripts() to be able to resolve
@@ -43,9 +43,10 @@ sIMS.debugModule('pre-js.js sqlite3InitModuleState =',sIMS);
4) If none of the above apply, (prefix+path) is returned.
None of the above apply in ES6 builds.
*/
Module['locateFile'] = function(path, prefix) {
None of the above apply in ES6 builds, which uses a much simpler
approach.
*/
Module['locateFile'] = function(path, prefix) {
//#if target=es6-module
return new URL(path, import.meta.url).href;
//#else
@@ -69,27 +70,20 @@ Module['locateFile'] = function(path, prefix) {
);
return theFile;
//#endif target=es6-module
}.bind(sIMS);
//#endif ifnot target=es6-bundler-friendly
}.bind(sIMS);
//#if custom-Module.instantiateWasm
//#if !wasmfs
/**
//#if Module.instantiateWasm
//#ifnot wasmfs
/**
Override Module.instantiateWasm().
Bug warning: a custom Module.instantiateWasm() does not work
in WASMFS builds:
A custom Module.instantiateWasm() does not work in WASMFS builds:
https://github.com/emscripten-core/emscripten/issues/17951
In such builds we must disable this.
*/
Module['instantiateWasm'
/* This works, but it does not have the testing coverage in
the wild which Emscripten's default impl does, so we'll
save this option until we really need a custom
Module.instantiateWasm(). */
] = function callee(imports,onSuccess){
*/
Module['instantiateWasm'] = function callee(imports,onSuccess){
const sims = this;
const uri = Module.locateFile(
sims.wasmFilename, (
@@ -98,40 +92,24 @@ Module['instantiateWasm'
);
sims.debugModule("instantiateWasm() uri =", uri, "sIMS =",this);
const wfetch = ()=>fetch(uri, {credentials: 'same-origin'});
const finalThen = (arg)=>{
arg.imports = imports;
sims.instantiateWasm = arg /* used by sqlite3-api-prologue.c-pp.js */;
onSuccess(arg.instance, arg.module);
};
const loadWasm = WebAssembly.instantiateStreaming
? async ()=>
WebAssembly
.instantiateStreaming(wfetch(), imports)
.then((arg)=>{
arg.imports = imports;
sims.instantiateWasm = arg /* used by extern-post-js.c-pp.js */;
onSuccess(arg.instance, arg.module);
})
.then(finalThen)
: async ()=>// Safari < v15
wfetch()
.then(response => response.arrayBuffer())
.then(bytes => WebAssembly.instantiate(bytes, imports))
.then((arg)=>{
arg.imports = imports;
sims.instantiateWasm = arg;
onSuccess(arg.instance, arg.module);
})
;
.then(finalThen)
return loadWasm();
}.bind(sIMS);
/*
It is literally impossible to reliably get the name of _this_
script at runtime, so impossible to derive X.wasm from script name
X.js. Thus we need, at build-time, to redefine
sIMS.uri by appending it to a build-specific
copy of this file with the name of the wasm file. This is
apparently why Emscripten hard-codes the name of the wasm file
into their glue scripts.
*/
sIMS.wasmFilename = 'sqlite3.wasm';
//#endif !wasmfs
//#endif custom-Module.instantiateWasm
/*
END FILE: api/pre-js.js, noting that the build process may append
"sIMS.wasmFilename = x;" to this file, for some value of x.
*/
}.bind(sIMS);
//#endif ifnot wasmfs
//#endif Module.instantiateWasm
})(Module);
/* END FILE: api/pre-js.js. */

View File

@@ -211,10 +211,11 @@ const BuildDefs oBuildDefs = {
/*
** The canonical build, against which all others are compared and
** contrasted. This is the one we post downloads for.
**
** This one's zBaseName and zEnv MUST be non-NULL so it can be used
** as a default for all others
*/
.vanilla = {
/* This one's zBaseName and zEnv MUST be non-NULL so it can be
** used as a default for all others. */
.zEmo = "🍦",
.zBaseName = "sqlite3",
.zDotWasm = 0,
@@ -351,7 +352,7 @@ const BuildDefs oBuildDefs = {
/* 64-bit bundler-friendly. */
.bundler64 = {
.zEmo = "📦",
.zBaseName = "sqlite3-bundler-friendlyu",
.zBaseName = "sqlite3-bundler-friendly-64bit",
.zDotWasm = "sqlite3-64bit",
.zCmppD = "$(c-pp.D.bundler)",
.zEmcc = 0,
@@ -413,7 +414,7 @@ const BuildDefs oBuildDefs = {
,
.zEnv = 0,
.zDeps = 0,
.zIfCond = 0,
.zIfCond = "ifeq (1,$(wasmfs.enable))",
.flags = CP_ALL | F_UNSUPPORTED | F_WASMFS | F_ESM
}
};
@@ -565,7 +566,7 @@ static void mk_prologue(void){
#if WASM_CUSTOM_INSTANTIATE
/* c-pp -D... flags for the custom instantiateWasm(). */
#define C_PP_D_CUSTOM_INSTANTIATE " -Dcustom-Module.instantiateWasm "
#define C_PP_D_CUSTOM_INSTANTIATE " -DModule.instantiateWasm "
#else
#define C_PP_D_CUSTOM_INSTANTIATE
#endif
@@ -588,8 +589,8 @@ static void mk_pre_post(char const *zBuildName, BuildDef const * pB){
pf("pre-js.%s.js = $(dir.tmp)/pre-js.%s.js\n",
zBuildName, zBuildName);
if( 0==WASM_CUSTOM_INSTANTIATE || !pB || !pB->zDotWasm ){
pf("$(eval $(call b.eval.c-pp,"
if( 0==WASM_CUSTOM_INSTANTIATE || !pB ){
pf("$(eval $(call b.c-pp.target,"
"%s,"
"$(pre-js.in.js),"
"$(pre-js.%s.js),"
@@ -597,33 +598,36 @@ static void mk_pre_post(char const *zBuildName, BuildDef const * pB){
"))",
zBuildName, zBuildName, zBuildName);
}else{
assert( pB && pB->zDotWasm );
#if 0
pf("$(error fix the bit near %s:%d)\n",
__FILE__, __LINE__);
#else
/* This part is needed for builds which have to rename the wasm file
in zDotWasm so that the loader can find it. */
pf("pre-js.%s.intermediary = "
"$(dir.tmp)/pre-js.%s.intermediary.js\n",
zBuildName, zBuildName);
pf("$(eval $(call b.eval.c-pp,"
char const *zWasmFile = pB->zDotWasm
? pB->zDotWasm
: pB->zBaseName;
/*
** See BuildDef::zDotWasm for _why_ we do this. _What_ we're doing
** is generate $(pre-js.BUILDNAME.js) as above, but:
**
** 1) Add an extra -D... flag to activate the custom
** Module.intantiateWasm() in the JS code.
**
** 2) Amend the generated pre-js.js with the name of the WASM
** file which should be loaded. That tells the custom
** Module.instantiateWasm() to use that file instead of
** the default.
*/
pf("$(pre-js.%s.js): $(pre-js.in.js) $(MAKEFILE_LIST)", zBuildName);
if( pB->zDotWasm ){
pf(" $(dir.dout)/%s.wasm" /* This .wasm is from some other
build, so this may trigger a full
build of the reference copy. */,
pB->zDotWasm);
}
ps("");
pf("\t@$(call b.c-pp.shcmd,"
"%s,"
"$(pre-js.in.js),"
"$(pre-js.%s.intermediary),"
C_PP_D_CUSTOM_INSTANTIATE "$(c-pp.D.%s)))\n",
"$(pre-js.%s.js),"
"$(c-pp.D.%s)" C_PP_D_CUSTOM_INSTANTIATE
")\n",
zBuildName, zBuildName, zBuildName);
pf("$(pre-js.%s.js): $(pre-js.%s.intermediary)"
" $(out.dout)/%s\n" /* from a different build */
"\t$(call b.cp,%s,cp $(pre-js.%s.intermediary) $@\n",
zBuildName, zBuildName,
pB->zDotWasm,
zBuildName, zBuildName);
pf("\t@echo 'sIMS.wasmFilename = \"%s\";' >> $@\n",
pB->zDotWasm
/* see api/pre-js.c-pp.js:Module.instantiateModule() */
);
#endif
}
ps("\n# --post-js=...");
@@ -635,7 +639,7 @@ static void mk_pre_post(char const *zBuildName, BuildDef const * pB){
" $(dir.api)/post-js-footer.js\n",
zBuildName, zBuildName);
pf("$(eval $(call b.eval.c-pp,"
pf("$(eval $(call b.c-pp.target,"
"%s,"
"$(post-js.%s.in),"
"$(post-js.%s.js),"
@@ -649,11 +653,11 @@ static void mk_pre_post(char const *zBuildName, BuildDef const * pB){
ps("\n# --extern-post-js=...");
pf("extern-post-js.%s.js = $(dir.tmp)/extern-post-js.%s.js\n",
zBuildName, zBuildName);
pf("$(eval $(call b.eval.c-pp,"
pf("$(eval $(call b.c-pp.target,"
"%s,"
"$(extern-post-js.in.js),"
"$(extern-post-js.%s.js),"
C_PP_D_CUSTOM_INSTANTIATE "$(c-pp.D.%s)))\n",
"$(c-pp.D.%s)))\n",
zBuildName, zBuildName, zBuildName);
ps("\n# --pre/post misc...");
@@ -699,7 +703,7 @@ static void emit_api_js(char const *zBuildName,
"sqlite3-api.%s.js = $(dir.tmp)/sqlite3-api.%s.js\n",
zBuildName, zCmppD ? zCmppD: "",
zBuildName, zBuildName);
pf("$(eval $(call b.eval.c-pp,"
pf("$(eval $(call b.c-pp.target,"
"%s,"
"$(sqlite3-api.jses),"
"$(sqlite3-api.%s.js),"
@@ -809,6 +813,17 @@ static void mk_lib_mode(const char *zBuildName, const BuildDef * pB){
{ /* Post-compilation transformations and copying to
$(dir.dout)... */
/* Avoid a 3rd occurrence of the bug fixed by 65798c09a00662a3,
** which was (in two cases) caused by makefile refactoring and
** not recognized until after a release was made with the broken
** sqlite3-bundler-friendly.mjs (which is used by the npm
** subproject but is otherwise untested/unsupported): */
pf("\t@if grep -e '^ *importScripts(' $@; "
"then echo '$(logtag.%s) $(emo.bug)$(emo.fire): "
"bug fixed in 65798c09a00662a3 has re-appeared'; "
"exit 1; fi;\n", zBuildName);
if( (F_ESM & pB->flags) || (F_NODEJS & pB->flags) ){
pf("\t@$(call b.call.patch-export-default,1,%d,$(logtag.%s))\n",
(F_WASMFS & pB->flags) ? 1 : 0,
@@ -824,11 +839,47 @@ static void mk_lib_mode(const char *zBuildName, const BuildDef * pB){
pf("\t@$(call b.do.wasm-opt,%s)\n", zBuildName);
pf("\t@$(call b.strip-js-emcc-bindings,$(logtag.%s))\n", zBuildName);
{ /* Replace @sqlite3.wasm@ with the proper wasm file name. */
char const *zWF = pB->zDotWasm ? pB->zDotWasm : pB->zBaseName;
pf("\t@echo '"
"$(logtag.%s) $(emo.disk) s/@sqlite.wasm@/%s.wasm/g"
"'; "
"sed -i -e 's/@sqlite3.wasm@/%s.wasm/g' $@ || exit\n",
zBuildName, zWF, zWF);
}
if( CP_JS & pB->flags && !(pB->zDotWasm/*handled below*/) ){
if( CP_JS & pB->flags ){
/*
** $(bin.emcc) will write out $@ and will create a like-named
** .wasm file. The resulting .wasm and .js/.mjs files are
** identical across all builds which have the same pB->zEmmc
** and/or pB->zEmccExtra.
**
** For the final deliverables we copy one or both of those
** js/wasm files to $(dir.dout) (the top-most build target
** dir). We only copy the wasm file for the "base-most" builds
** and recycle those for the rest of the builds. The catch is:
** that .wasm file name gets hard-coded into $@ so we need,
** for cases in which we "recycle" a .wasm file from another
** build, to patch the name to pB->zDotWasm when copying to
** $(dir.dout).
*/
if( pB->zDotWasm ){
pf("\t@echo '$(logtag.%s) $(emo.disk) "
"s/\"%s.wasm\"/\"%s.wasm\"/g "
"in $(dir.dout)/$(notdir $@)'; \\\n"
"sed"
" -e 's/\"%s.wasm\"/\"%s.wasm\"/g'"
" -e \"s/'%s.wasm'/'%s.wasm'/g\""
" $@ > $(dir.dout)/$(notdir $@);\n",
zBuildName,
zBaseName, pB->zDotWasm,
zBaseName, pB->zDotWasm,
zBaseName, pB->zDotWasm);
}else{
pf("\t@$(call b.cp,%s,$@,$(dir.dout))\n",
zBuildName
);
zBuildName);
}
}
if( CP_WASM & pB->flags ){
pf("\t@$(call b.cp,%s,$(basename $@).wasm,$(dir.dout))\n",
@@ -837,39 +888,7 @@ static void mk_lib_mode(const char *zBuildName, const BuildDef * pB){
//pB->zEmo, zBuildName
);
}
/*
** $(bin.emcc) will write out $@ and will create a like-named
** .wasm file. The resulting .wasm and .js/.mjs files are
** identical across all builds which have the same pB->zEmccExtra.
**
** We copy one or both of those files to $(dir.dout) (the top-most
** build target dir), but: that .wasm file name gets hard-coded
** into $@ so we need, for some cases, to patch the name to
** pB->zDotWasm when copying to $(dir.dout).
*/
if( pB->zDotWasm && (CP_JS & pB->flags) ){
pf("\t@echo '$(logtag.%s) $(emo.disk) "
"s/\"%s.wasm\"/\"%s.wasm\"/g "
"in $(dir.dout)/$(notdir $@)'; \\\n"
"sed "
"-e 's/\"%s.wasm\"/\"%s.wasm\"/g' "
"-e \"s/'%s.wasm'/'%s.wasm'/g\" "
"$@ > $(dir.dout)/$(notdir $@)\n",
zBuildName,
zBaseName, pB->zDotWasm,
zBaseName, pB->zDotWasm,
zBaseName, pB->zDotWasm);
}
/* Avoid a 3rd occurrence of the bug fixed by 65798c09a00662a3,
** which was (in two cases) caused by makefile refactoring and
** not recognized until after a release was made with the broken
** sqlite3-bundler-friendly.mjs (which is used by the npm
** subproject but is otherwise untested/unsupported): */
pf("\t@if grep -e '^ *importScripts(' $@; "
"then echo '$(logtag.%s) $(emo.bug)$(emo.fire): "
"bug fixed in 65798c09a00662a3 has re-appeared'; "
"exit 1; fi;\n", zBuildName);
}
}
pf("\t@$(call b.echo,%s,$(emo.done) done!)\n", zBuildName);

View File

@@ -1,5 +1,5 @@
C Limit\sthe\scomplexity\sof\sa\sREGEXP\spattern\susing\sSQLITE_LIMIT_LIKE_PATTERN_LENGTH
D 2025-09-26T15:38:52.279
C Reinstate\sthe\sModule.instantiateWasm()\soverride\sand\ssimplify\show\sthe\swasm\sfilename\sgets\sinjected\sinto\sthe\sJS\sfiles.
D 2025-09-26T17:11:39.321
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -578,7 +578,7 @@ F ext/session/sqlite3session.c b3de195ce668cace9b324599bf6255a70290cbfb5451e826e
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 3c9bab1b8bf5c816fbfe226927e27e72812a8bade09e96cced474e94741051ce
F ext/wasm/GNUmakefile e6ab3f66057c889ef384ba57240e1a6eb128d1b0dddb919aa3c6ec2a845f4117
F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a
F ext/wasm/README.md 66ace67ae98a45e4116f2ca5425b716887bcee4d64febee804ff6398e1ae9ec7
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
@@ -591,11 +591,11 @@ F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-extras cb4fa8842c875b6ee99381523792975
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-see fb29e62082a658f0d81102488414d422c393c4b20cc2f685b216bc566237957b
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
F ext/wasm/api/README.md f4c0d67caaee21a77b8938c30b5f79667bfc9d0c95d01b51df77ea35ee773884
F ext/wasm/api/extern-post-js.c-pp.js c9d73ffbe40c06de302e9ee92ff21bfed53102ccff383fbc0026771aab4ad42c
F ext/wasm/api/extern-post-js.c-pp.js 8ed3cefbc2b73e2c16afae7bf64917361fdd26871f0d427d422cf48b7b2b40c5
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js 5bd7170b5e8ce7b62102702bbcf47ef7b3b49cd56ed40c043fd990aa715b74ee
F ext/wasm/api/post-js-header.js 79d078aec33d93b640a19c574b504d88bb2446432f38e2fbb3bb8e36da436e70
F ext/wasm/api/pre-js.c-pp.js 1a02efe3ddb6ca929b32399b2761bf129912809ac59530a2cc7b4060f54bb2c4
F ext/wasm/api/pre-js.c-pp.js a03310c02d3bcf1414ea4a6a5e8070155184d56d01bf0f9e17d26162a4bdb1d0
F ext/wasm/api/sqlite3-api-cleanup.js a3d6b9e449aefbb8bba283c2ba9477e2333a0eeb94a7a26b5bf952736f65a6dd
F ext/wasm/api/sqlite3-api-glue.c-pp.js 12f5b36775fab1e7bf5385689fded2b2a9f77360562515e9849acb5e66602e2d
F ext/wasm/api/sqlite3-api-oo1.c-pp.js db4c8ebb03bac60db32ce03f8c615b00f4e4ad53e7d5de5e63d2780cba052caa
@@ -634,7 +634,7 @@ F ext/wasm/index.html 1b329fb63e057c02a17ce178308d6b06aac62d92af7dd6d821fb0e183e
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 d8b5e332b53a9ccbad937a3dbb59d850cbef91d67efa9c326feac0430ee90fbb
F ext/wasm/mkwasmbuilds.c 97c628e27c97aa23b9a5d2fec1b59af34cc002441780aa909b2a87dd61b8c5fd
F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337
F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96
F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63
@@ -2169,8 +2169,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
P 911c745f88c0ee8569e67bbcbbab034264f8c981b505aadac3ce7289486a1a68
R 828f930d9062f970a087f3cd9db90d9c
U drh
Z 512ef129556a7f8a07d748aea238fc85
P 869c968569b09d05a5b7d587d8fddb3b4611daf7467dc157701e5dc6c9608606
R b3633c338a6e359cda01fed061e2f038
U stephan
Z 287871c6cf5545c1ebf0563c19172d63
# Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
869c968569b09d05a5b7d587d8fddb3b4611daf7467dc157701e5dc6c9608606
e878ffd2eaa87e2978c44fcd03a1eb6114a9ae31e31101898d682f43cf81000f