1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-30 19:03:16 +03:00

Remove an unnecessary step from the wasm builds and account for a recent Emscripten-internal code-generation change which caused a post-build cleanup step to not actually clean up (harmless, but adds about 26k of useless stuff to the resulting JS).

FossilOrigin-Name: a8ed16989dcd324bd9caa09aec7979249deaf59ca13bc377379ddd83c53379cd
This commit is contained in:
stephan
2025-07-16 11:56:16 +00:00
parent e5a7b815af
commit 68b74e2c42
4 changed files with 17 additions and 32 deletions

View File

@ -573,12 +573,7 @@ $(SOAP.js.bld): $(SOAP.js)
# Sidebar: some of the imports are used soley by the Emscripten glue,
# which the sqlite3 JS code does not rely on.
#
# We build $(sqlite3-api*.*) "because we can" and because it might be
# a useful point of experimentation for some clients, but the
# above-described caveat may well make them unusable for real-life
# clients.
#
# sqlite3-api.js.in = the generated sqlite3-api.js before it gets
# sqlite3-api.js.in = the amalgamated sqlite3-api.js before it gets
# preprocessed. It contains all of $(sqlite3-api.jses) but none of the
# Emscripten-specific headers and footers.
sqlite3-api.js.in := $(dir.tmp)/sqlite3-api.c-pp.js

View File

@ -83,7 +83,6 @@ struct BuildDef {
const char *zName; /* Name from JS_BUILD_NAMES */
const char *zMode; /* Name from JS_BUILD_MODES */
int flags; /* Flags from LibModeFlags */
const char *zApiJsOut; /* Name of generated sqlite3-api.js/.mjs */
const char *zJsOut; /* Name of generated sqlite3.js/.mjs */
/* TODO: dynamically determine zApiJsOut and zJsOut based on zName, zMode,
and flags. */
@ -99,25 +98,21 @@ typedef struct BuildDef BuildDef;
*/
const BuildDef aBuildDefs[] = {
{/* Core build */
"sqlite3", "vanilla", LIBMODE_PLAIN,
"$(dir.dout)/sqlite3-api.js", "$(sqlite3.js)", 0, 0},
"sqlite3", "vanilla", LIBMODE_PLAIN, "$(sqlite3.js)", 0, 0},
{/* Core ESM */
"sqlite3", "esm", LIBMODE_ESM,
"$(dir.dout)/sqlite3-api.mjs", "$(sqlite3.mjs)",
"sqlite3", "esm", LIBMODE_ESM, "$(sqlite3.mjs)",
"-Dtarget=es6-module", 0},
{/* Core bundler-friend. Untested and "not really" supported, but
** required by the downstream npm subproject. */
"sqlite3", "bundler-friendly",
LIBMODE_BUNDLER_FRIENDLY | LIBMODE_ESM,
"$(dir.dout)/sqlite3-api-bundler-friendly.mjs",
"$(sqlite3-bundler-friendly.mjs)",
"$(c-pp.D.sqlite3-esm) -Dtarget=es6-bundler-friendly", 0},
{/* node.js mode. Untested and unsupported. */
"sqlite3", "node", LIBMODE_NODEJS | LIBMODE_DONT_ADD_TO_ALL,
"$(dir.dout)/sqlite3-api-node.mjs",
"$(sqlite3-node.mjs)",
"$(c-pp.D.sqlite3-bundler-friendly) -Dtarget=node", 0},
@ -126,12 +121,11 @@ const BuildDef aBuildDefs[] = {
** here. */
"sqlite3-wasmfs", "esm" ,
LIBMODE_WASMFS | LIBMODE_ESM | LIBMODE_DONT_ADD_TO_ALL,
"$(dir.tmp)/sqlite3-api-wasmfs.mjs",
"$(sqlite3-wasmfs.mjs)",
"$(c-pp.D.sqlite3-bundler-friendly) -Dwasmfs",
"-sEXPORT_ES6 -sUSE_ES6_IMPORT_META"},
{/*End-of-list sentinel*/0,0,0,0,0,0,0}
{/*End-of-list sentinel*/0,0,0,0,0,0}
};
/*
@ -354,26 +348,22 @@ static void mk_lib_mode(const BuildDef * pB){
** post-processing after Emscripten generates X.wasm. */;
assert( pB->zName );
assert( pB->zMode );
assert( pB->zApiJsOut );
assert( pB->zJsOut );
#define MT(X) ((X) ? (X) : "")
/* Very common printf() args combo. */
#define zNM pB->zName, pB->zMode
pf("%s# Begin build [%s-%s]\n", zBanner, zNM);
pf("# zApiJsOut=%s\n# zJsOut=%s\n# zCmppD=%s\n",
pB->zApiJsOut, pB->zJsOut, MT(pB->zCmppD));
pf("%s# Begin build [%s-%s]. flags=0x%02x\n", zBanner, zNM, pB->flags);
pf("# zJsOut=%s\n# zCmppD=%s\n", pB->zJsOut, MT(pB->zCmppD));
pf("$(info Setting up build [%s-%s]: %s)\n", zNM, pB->zJsOut);
mk_pre_post(zNM, pB->flags, pB->zCmppD);
pf("\nemcc.flags.%s.%s ?=\n", zNM);
if( pB->zEmcc && pB->zEmcc[0] ){
pf("emcc.flags.%s.%s += %s\n", zNM, pB->zEmcc);
}
pf("$(eval $(call SQLITE.CALL.C-PP.FILTER, $(sqlite3-api.js.in), %s, %s))\n",
pB->zApiJsOut, MT(pB->zCmppD));
/* target pB->zJsOut */
pf("%s: %s $(MAKEFILE_LIST) $(sqlite3-wasm.cfiles) $(EXPORTED_FUNCTIONS.api) "
pf("%s: $(MAKEFILE_LIST) $(sqlite3-wasm.cfiles) $(EXPORTED_FUNCTIONS.api) "
"$(pre-post-%s-%s.deps) "
"$(sqlite3-api.ext.jses)"
/* ^^^ maintenance reminder: we set these as deps so that they
@ -382,7 +372,7 @@ static void mk_lib_mode(const BuildDef * pB){
are still compiling, which is especially helpful when running
builds with long build times (like -Oz). */
"\n",
pB->zJsOut, pB->zApiJsOut, zNM);
pB->zJsOut, zNM);
pf("\t@echo \"Building $@ ...\"\n");
pf("\t$(bin.emcc) -o $@ $(emcc_opt_full) $(emcc.flags) \\\n");
pf("\t\t$(emcc.jsflags) -sENVIRONMENT=$(emcc.environment.%s) \\\n",
@ -404,7 +394,7 @@ static void mk_lib_mode(const BuildDef * pB){
"\t\t$(maybe-wasm-strip) %s;\n",
zWasmOut, zWasmOut);
pf("\t@$(call SQLITE.CALL.WASM-OPT,%s)\n", zWasmOut);
pf("\t@sed -i -e '/^var _sqlite3.*createExportWrapper/d' %s || exit; \\\n"
pf("\t@sed -i -e '/^.*= *_sqlite.*= *createExportWrapper/d' %s || exit; \\\n"
/* ^^^^^^ reminder: Mac/BSD sed has no -i flag */
"\t\techo 'Stripped out createExportWrapper() parts.'\n",
pB->zJsOut) /* Our JS code installs bindings of each WASM export. The

View File

@ -1,5 +1,5 @@
C Further\sinternal\swasm\sbuild\scleanups.\sNo\sfunctional\schanges.
D 2025-07-16T11:09:18.263
C Remove\san\sunnecessary\sstep\sfrom\sthe\swasm\sbuilds\sand\saccount\sfor\sa\srecent\sEmscripten-internal\scode-generation\schange\swhich\scaused\sa\spost-build\scleanup\sstep\sto\snot\sactually\sclean\sup\s(harmless,\sbut\sadds\sabout\s26k\sof\suseless\sstuff\sto\sthe\sresulting\sJS).
D 2025-07-16T11:56:16.567
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@ -622,7 +622,7 @@ F ext/session/sqlite3session.c 19e14bcca2fbc63a8022ffd708ea6e6986c4003a1e9bbca9b
F ext/session/sqlite3session.h b81e8536ce4b83babafd700f4ff67017804b6c1d71df963b30d3972958e7f4a7
F ext/session/test_session.c 8766b5973a6323934cb51248f621c3dc87ad2a98f023c3cc280d79e7d78d36fb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile eae071f5b1d3446052cb3f5e59a1306b0c8b1af83626dcf26f7bada7fa258352
F ext/wasm/GNUmakefile 52fb4cde68470c35e95a0815f575ad039cbe13b7dba7e1da7c71cb0924ad0ea8
F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a
F ext/wasm/README.md b89605f65661cf35bf034ff6d43e448cc169b8017fc105d498e33b81218b482c
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
@ -683,7 +683,7 @@ F ext/wasm/index-dist.html 56132399702b15d70c474c3f1952541e25cb0922942868f70daf1
F ext/wasm/index.html bcaa00eca521b372a6a62c7e7b17a870b0fcdf3e418a5921df1fd61e5344080d
F ext/wasm/jaccwabyt/jaccwabyt.js 6e4f26d0edb5c2e7d381b7eff1924832a040a12274afab2d1e1789027e9f6c5c
F ext/wasm/jaccwabyt/jaccwabyt.md 1128e3563e7eff90b5a373395251fc76cb32386fad1fea6075b0f34a8f1b9bdf
F ext/wasm/mkwasmbuilds.c f6c528b34e1758267b43365532a3e701ff817a00b92ac8ed2fdec62090d6fe62
F ext/wasm/mkwasmbuilds.c 7468d1775bf3713f568fd2632464094d1792ce25ebd4cb9ee218420b4178bebe
F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337
F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96
F ext/wasm/scratchpad-wasmfs.mjs 66034b9256b218de59248aad796760a1584c1dd842231505895eff00dbd57c63
@ -2213,8 +2213,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 1062b61e9c949d76791ed7974cf6c38d1cec9797a930e9ad7ca851130f5e9a48
R b2a9312c73209dce3b276f9c450c5ef5
P 8364d89c3bc1d1dbd95b4324a41bd655251ebd2da5b9f1b9f9aceba9c3d26d3d
R 0893c79a61f46e221edf5665d49d3e5c
U stephan
Z 2a2a13815507fb8a535b706df3b4d0cb
Z 67fac4b4445edb998537bdf8f4c47b0b
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
8364d89c3bc1d1dbd95b4324a41bd655251ebd2da5b9f1b9f9aceba9c3d26d3d
a8ed16989dcd324bd9caa09aec7979249deaf59ca13bc377379ddd83c53379cd