Wasm build cleanups. Fix the wasm speedtest1 builds broken by yesterday's refactoring.

FossilOrigin-Name: 5d4a090230d1d7609e70b9c28d662dc8b0f8dd4d70a254f3ce6e449c68a25897
This commit is contained in:
stephan 2024-09-24 12:16:05 +00:00
parent 405ae974ee
commit 88c43ce1f6
6 changed files with 47 additions and 44 deletions

View File

@ -819,12 +819,11 @@ sqlite3-wasmfs.cfiles := $(sqlite3-wasm.cfiles)
########################################################################
########################################################################
# SQLITE3.xJS.ESM-EXPORT-DEFAULT is part of SQLITE3-WASMFS.xJS.RECIPE
# and SETUP_LIB_BUILD_MODE, factored into a separate piece to avoid
# code duplication. $1 is 1 if the build mode needs this workaround
# (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 be 1.
# SQLITE3.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
# be 1.
#
# Reminder for ESM builds: even if we use -sEXPORT_ES6=0, emcc _still_
# adds:
@ -843,7 +842,7 @@ sqlite3-wasmfs.cfiles := $(sqlite3-wasm.cfiles)
# use awk instead of sed for this.
define SQLITE3.xJS.ESM-EXPORT-DEFAULT
if [ x1 = x$(1) ]; then \
echo "Fragile workaround for emscripten/issues/18237. See SQLITE3.xJS.RECIPE."; \
echo "Fragile workaround for emscripten/issues/18237. See SQLITE3.xJS.ESM-EXPORT-DEFAULT."; \
{\
awk '/^export default/ && !f{f=1; next} 1' $@ > $@.tmp && mv $@.tmp $@; \
} || exit $$?; \
@ -1030,9 +1029,7 @@ $(EXPORTED_FUNCTIONS.speedtest1): $(EXPORTED_FUNCTIONS.api.core)
speedtest1.js := $(dir.dout)/speedtest1.js
speedtest1.wasm := $(dir.dout)/speedtest1.wasm
emcc.flags.speedtest1-vanilla := $(cflags.common) -DSQLITE_SPEEDTEST1_WASM
speedtest1.cfiles := $(speedtest1.c) $(sqlite3-wasm.c)
$(eval $(call call-make-pre-post,speedtest1,vanilla))
$(speedtest1.js): $(MAKEFILE) $(speedtest1.cfiles) \
$(pre-post-speedtest1-vanilla.deps) \
$(EXPORTED_FUNCTIONS.speedtest1)

View File

@ -48,7 +48,7 @@ Module['locateFile'] = function(path, prefix) {
}else{
theFile = prefix + path;
}
sqlite3InitModuleState.debugModule(
this.debugModule(
"locateFile(",arguments[0], ',', arguments[1],")",
'sqlite3InitModuleState.scriptDir =',this.scriptDir,
'up.entries() =',Array.from(up.entries()),

View File

@ -20,7 +20,7 @@ endif
ifeq (,$(SHELL_DEP))
$(error Could not parse SHELL_DEP from $(dir.top)/Makefile.)
endif
$(dir.top)/shell.c: $(SHELL_DEP) $(dir.top)/tool/mkshellc.tcl $(sqlite3.c)
$(dir.top)/shell.c: $(SHELL_DEP) $(dir.tool)/mkshellc.tcl $(sqlite3.c)
$(MAKE) -C $(dir.top) shell.c
# /shell.c
########################################################################

View File

@ -45,31 +45,15 @@
** "sqlite3-wasmfs" build, only "esm" (ES6 Module) is legal.
*/
#define JS_BUILD_MODES vanilla esm bundler-friendly node
/*
** Emits common vars needed by the rest of the emitted code (but not
** needed by code outside of these generated pieces).
*/
static void mk_prologue(void){
ps("########################################################################");
ps("# extern-post-js* and extern-pre-js* are files for use with");
ps("# Emscripten's --extern-pre-js and --extern-post-js flags.");
ps("extern-pre-js.js := $(dir.api)/extern-pre-js.js");
ps("extern-post-js.js.in := $(dir.api)/extern-post-js.c-pp.js");
ps("# Emscripten flags for --[extern-][pre|post]-js=... for the");
ps("# various builds.");
ps("pre-post-common.flags := --extern-pre-js=$(sqlite3-license-version.js)");
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)");
}
static const char * zBanner =
"\n########################################################################\n";
/*
** Emits makefile code for setting up values for the --pre-js=FILE,
** --post-js=FILE, and --extern-post-js=FILE emcc flags, as well as
** populating those files.
*/
static void mk_pre_post(const char *zName, const char *zMode){
pf("%s# Begin --pre/--post flags for %s-%s\n", zBanner, zName, zMode);
pf("pre-post-%s-%s.flags ?=\n", zNM);
/* --pre-js=... */
@ -81,7 +65,7 @@ static void mk_pre_post(const char *zName, const char *zMode){
"$(c-pp.D.%s-%s)))\n", zNM, zNM);
#else
/* This part is needed if/when we re-enable the custom
** Module.instantiateModule() impl. */
** Module.instantiateModule() impl in api/pre-js.c-pp.js. */
pf("pre-js.js.%s-%s.intermediary := $(dir.tmp)/pre-js.%s-%s.intermediary.js\n",
zNM, zNM);
pf("$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.%s-%s.intermediary),"
@ -123,6 +107,25 @@ static void mk_pre_post(const char *zName, const char *zMode){
zNM, zNM, zNM);
pf("pre-post-%s-%s.deps := $(pre-post-jses.%s-%s.deps) $(dir.tmp)/pre-js.%s-%s.js\n",
zNM, zNM, zNM);
pf("# End --pre/--post flags for %s-%s%s", zName, zMode, zBanner);
}
/*
** Emits common vars needed by the rest of the emitted code (but not
** needed by code outside of these generated pieces).
*/
static void mk_prologue(void){
pf("%s", zBanner);
ps("# extern-post-js* and extern-pre-js* are files for use with");
ps("# Emscripten's --extern-pre-js and --extern-post-js flags.");
ps("extern-pre-js.js := $(dir.api)/extern-pre-js.js");
ps("extern-post-js.js.in := $(dir.api)/extern-post-js.c-pp.js");
ps("# Emscripten flags for --[extern-][pre|post]-js=... for the");
ps("# various builds.");
ps("pre-post-common.flags := --extern-pre-js=$(sqlite3-license-version.js)");
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)");
}
/*
@ -144,12 +147,12 @@ static void mk_lib_mode(const char *zName /* build name */,
if( !zCmppD ) zCmppD = "";
if( !zEmcc ) zEmcc = "";
pf("#################### begin build [%s-%s]\n", zNM);
pf("%s# Begin build [%s-%s]\n", zBanner, zNM);
pf("ifneq (1,$(MAKING_CLEAN))\n");
pf("$(info Setting up build [%s-%s]: %s)\n", zNM, zJsOut);
pf("c-pp.D.%s-%s := %s\n", zNM, zCmppD);
mk_pre_post(zNM);
pf("emcc.flags.%s.%s ?=\n", zNM);
pf("\nemcc.flags.%s.%s ?=\n", zNM);
if( zEmcc[0] ){
pf("emcc.flags.%s.%s += %s\n", zNM, zEmcc);
}
@ -199,7 +202,7 @@ static void mk_lib_mode(const char *zName /* build name */,
pf("all: %s\n", zJsOut);
}
ps("endif\n# ^^^ !$(MAKING_CLEAN)");
pf("#################### end build [%s-%s]\n\n", zNM);
pf("# End build [%s-%s]%s", zNM, zBanner);
}
int main(void){
@ -221,5 +224,8 @@ int main(void){
"$(sqlite3-api-wasmfs.mjs)", "$(sqlite3-wasmfs.mjs)",
"$(c-pp.D.sqlite3-bundler-friendly) -Dwasmfs",
"-sEXPORT_ES6 -sUSE_ES6_IMPORT_META");
mk_pre_post("speedtest1","vanilla");
mk_pre_post("speedtest1-wasmfs","esm");
return rc;
}

View File

@ -1,5 +1,5 @@
C Further\swasm\sbuild\scleanups\sand\stweaks.\sNo\sfunctional\schanges.
D 2024-09-24T00:31:08.220
C Wasm\sbuild\scleanups.\sFix\sthe\swasm\sspeedtest1\sbuilds\sbroken\sby\syesterday's\srefactoring.
D 2024-09-24T12:16:05.567
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -601,7 +601,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt ca7e9ee82ca4e1c1744295f8184dd70edfae1992865d26c64303f539eb6c084c
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile fdb89338c1c6ce71ce804ef1c3de8ac9aa0b68566e2ce3210ebe4951e88e3b52
F ext/wasm/GNUmakefile 4e2be9c8bed22922703f3ed6bb2444ff7c5b1053e466421e69a57c664d7a042d
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
F ext/wasm/README.md a8a2962c3aebdf8d2104a9102e336c5554e78fc6072746e5daf9c61514e7d193
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
@ -618,7 +618,7 @@ F ext/wasm/api/extern-post-js.c-pp.js c4154a7f90c2d7e51fd6738273908152036c3457fd
F ext/wasm/api/extern-pre-js.js cc61c09c7a24a07dbecb4c352453c3985170cec12b4e7e7e7a4d11d43c5c8f41
F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08902f15c34720ee4a1
F ext/wasm/api/post-js-header.js 04dc12c3edd666b64a1b4ef3b6690c88dcc653f26451fd4734472d8e29c1c122
F ext/wasm/api/pre-js.c-pp.js b10a41b749e86670d17c0937c95e60eefe33dfdea1c5fc6c95d5b62a7b2b1f2c
F ext/wasm/api/pre-js.c-pp.js a614a2c82b12c4d96d8e3ba77330329efc53c4d56a8a7e60ade900f341866cfb
F ext/wasm/api/sqlite3-api-cleanup.js d235ad237df6954145404305040991c72ef8b1881715d2a650dda7b3c2576d0e
F ext/wasm/api/sqlite3-api-glue.c-pp.js fb6dbfe692cc23000a65a4cd95a1a47ed5eb592dc9d8b55363b3c2952a787244
F ext/wasm/api/sqlite3-api-oo1.c-pp.js f3a8e2004c6625d17946c11f2fb32008be78bc5207bf746fc77d59848813225f
@ -653,7 +653,7 @@ F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2
F ext/wasm/demo-worker1.js 836bece8615b17b1b572584f7b15912236a5947fe8c68b98d2737d7e287447ef
F ext/wasm/dist.make 653e212c1e84aa3be168d62a10616ccea45ee9585b0192745d2706707a5248ce
F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c95839afd8b05862f
F ext/wasm/fiddle.make b3b118516ed581cdf2c16de8eb1672427320e67ff19d710a09c891e895883644
F ext/wasm/fiddle.make 2a1a232157f6638bdcb4496cfc0014ca2ab723fe5d986989c9fd9ee3867e1be7
F ext/wasm/fiddle/fiddle-worker.js 850e66fce39b89d59e161d1abac43a181a4caa89ddeea162765d660277cd84ce
F ext/wasm/fiddle/fiddle.js b444a5646a9aac9f3fc06c53d78af5e1912eb235d69a8e6010723e4eb0e9d4a1
F ext/wasm/fiddle/index.html 739e0b75bc592679665d25e2f7649d2b8b2db678f3b41a772a8720b609b8482d
@ -661,7 +661,7 @@ F ext/wasm/index-dist.html 564b5ec5669676482c5a25dea9e721d8eafed426ecb155f93d29a
F ext/wasm/index.html 4337f495416756802669f69f9f9f3df9f87ee4c1918e6718719b4b5718e4713a
F ext/wasm/jaccwabyt/jaccwabyt.js 1264710db3cfbcb6887d95665b7aeba60c1126eaef789ca4cf1a4a17d5bc7f54
F ext/wasm/jaccwabyt/jaccwabyt.md 59a20df389abcc3606eb4eaea7fb7ba14504beb3e345dbea9b99a0618ba3bec8
F ext/wasm/mkwasmbuilds.c 1b7e970bcfbf4197cedc6e4da9e6939f869801c2d9fe70b4e844a8c598678359
F ext/wasm/mkwasmbuilds.c c8906d4e54c605d8cddfce36f62723d6f0e89c3813ecebec9fec4a3fcb952003
F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337
F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96
F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63
@ -2211,8 +2211,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P a4a1287fe8205d7c24556ec2e7ae09cda37a36dbe405ea70cd756cf488549036
R 9f08f9acf686695c4b728c0d11a4b3f8
P 3b72a143431537ec275aefae739e56330c1d445c9ea80885882a2b9aa2201179
R 04e34f9a24dc7d45d5d906b5bbfab195
U stephan
Z 7db74120d28ad7360e1e90126cd6bb3c
Z acb2af67fc0175d67098e0add512a294
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
3b72a143431537ec275aefae739e56330c1d445c9ea80885882a2b9aa2201179
5d4a090230d1d7609e70b9c28d662dc8b0f8dd4d70a254f3ce6e449c68a25897