]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Further internal wasm build cleanups. No functional changes.
authorstephan <stephan@noemail.net>
Wed, 16 Jul 2025 11:09:18 +0000 (11:09 +0000)
committerstephan <stephan@noemail.net>
Wed, 16 Jul 2025 11:09:18 +0000 (11:09 +0000)
FossilOrigin-Name: 8364d89c3bc1d1dbd95b4324a41bd655251ebd2da5b9f1b9f9aceba9c3d26d3d

ext/wasm/GNUmakefile
ext/wasm/mkwasmbuilds.c
manifest
manifest.uuid

index 51a6bf965fd1ebfcab298ecc197e6ec22deb3a27..77fdce810750b36f54a854b96ba9df112872a4fb 100644 (file)
@@ -860,15 +860,10 @@ if [ x1 = x$(1) ]; then \
 fi
 endef
 
-sqlite3-api.js := $(dir.dout)/sqlite3-api.js
 sqlite3.js := $(dir.dout)/sqlite3.js
-sqlite3-api.mjs := $(dir.dout)/sqlite3-api.mjs
 sqlite3.mjs := $(dir.dout)/sqlite3.mjs
-sqlite3-api-bundler-friendly.mjs := $(dir.dout)/sqlite3-api-bundler-friendly.mjs
 sqlite3-bundler-friendly.mjs := $(dir.dout)/sqlite3-bundler-friendly.mjs
-sqlite3-api-node.mjs := $(dir.dout)/sqlite3-api-node.mjs
 sqlite3-node.mjs := $(dir.dout)/sqlite3-node.mjs
-sqlite3-api-wasmfs.mjs := $(dir.tmp)/sqlite3-api-wasmfs.mjs
 sqlite3-wasmfs.mjs    := $(dir.wasmfs)/sqlite3-wasmfs.mjs
 EXPORTED_FUNCTIONS.fiddle := $(dir.tmp)/EXPORTED_FUNCTIONS.fiddle
 
@@ -913,7 +908,9 @@ $(sqlite3-node.mjs): $(sqlite3.mjs)
 # bundler-friendly build. Concretely, any supplemental JS files which
 # themselves use importScripts() or Workers or URL() constructors
 # which refer to other in-tree (m)JS files require a bundler-friendly
-# copy.
+# copy. Bundler-friendly builds replace certain references to string
+# vars/expressions with string literals, as bundler tools are static
+# code analyzers and cannot cope with the former.
 sqlite3-worker1.js.in := $(dir.api)/sqlite3-worker1.c-pp.js
 sqlite3-worker1-promiser.js.in := $(dir.api)/sqlite3-worker1-promiser.c-pp.js
 sqlite3-worker1.js := $(dir.dout)/sqlite3-worker1.js
index bc2ae0423295f74c3152f4bf63bcea5bf56f76b6..5e9bdd6a36ab2ec40268484292bfc6f863a5ee7e 100644 (file)
 *************************************************************************
 **
 ** This app's single purpose is to emit parts of the Makefile code for
-** building sqlite3's WASM build. The main motivation is to generate
-** code which "can" be created via GNU Make's eval command but is
+** sqlite3's canonical WASM build. The main motivation is to generate
+** code which "could" be created via GNU Make's eval command but is
 ** highly illegible when constructed that way. Attempts to write this
-** app in Bash and TCL have suffered from the problem that both
-** require escaping $ symbols, making the resulting script code as
-** illegible as the eval spaghetti we want to get away from. Writing
-** it in C is, somewhat surprisingly, _slightly_ less illegible than
-** writing it in bash, tcl, or native Make code.
+** app in Bash and TCL have suffered from the problem that those
+** languages require escaping $ symbols, making the resulting script
+** code as illegible as the eval spaghetti we want to get away
+** from. Maintaining it in C is, somewhat surprisingly, _slightly_
+** less illegible than writing it in bash, tcl, or native Make code.
 **
 ** The emitted makefile code is not standalone - it depends on
 ** variables and $(call)able functions from the main makefile.
-**
 */
 
 #undef NDEBUG
 #define ps puts
 
 /*
-** Valid names for the zName arguments.
+** Valid build names. Each build is a combination of one of these and
+** one of JS_BUILD_MODES, but only certain combinations are legal.
+** This macro and JS_BUILD_MODES exist solely for documentation
+** purposes: they are not expanded into code anywhere.
 */
 #define JS_BUILD_NAMES sqlite3 sqlite3-wasmfs
 /*
-** Valid names for the zMode arguments of the "sqlite3" build. For the
-** "sqlite3-wasmfs" build, only "esm" (ES6 Module) is legal.
+** Valid build modes. For the "sqlite3-wasmfs" build, only "esm" (ES6
+** Module) is legal.
 */
 #define JS_BUILD_MODES vanilla esm bundler-friendly node
-/* Separator to help eyeballs find the different sections */
+
+/* Separator to help eyeballs find the different output sections */
 static const char * zBanner =
   "\n########################################################################\n";
 
@@ -82,6 +85,8 @@ struct BuildDef {
   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. */
   const char *zCmppD;     /* Extra -D... flags for c-pp */
   const char *zEmcc;      /* Extra flags for emcc */
 };
@@ -95,24 +100,25 @@ typedef struct BuildDef BuildDef;
 const BuildDef aBuildDefs[] = {
   {/* Core build */
     "sqlite3", "vanilla", LIBMODE_PLAIN,
-    "$(sqlite3-api.js)", "$(sqlite3.js)", 0, 0},
+    "$(dir.dout)/sqlite3-api.js", "$(sqlite3.js)", 0, 0},
 
   {/* Core ESM */
    "sqlite3", "esm", LIBMODE_ESM,
-   "$(sqlite3-api.mjs)", "$(sqlite3.mjs)",
+   "$(dir.dout)/sqlite3-api.mjs", "$(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,
-    "$(sqlite3-api-bundler-friendly.mjs)",
+    "$(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,
-    "$(sqlite3-api-node.mjs)", "$(sqlite3-node.mjs)",
+    "$(dir.dout)/sqlite3-api-node.mjs",
+    "$(sqlite3-node.mjs)",
     "$(c-pp.D.sqlite3-bundler-friendly) -Dtarget=node", 0},
 
   {/* The wasmfs build is optional, untested, unsupported, and
@@ -120,7 +126,8 @@ const BuildDef aBuildDefs[] = {
    ** here. */
     "sqlite3-wasmfs", "esm" ,
     LIBMODE_WASMFS | LIBMODE_ESM | LIBMODE_DONT_ADD_TO_ALL,
-    "$(sqlite3-api-wasmfs.mjs)", "$(sqlite3-wasmfs.mjs)",
+    "$(dir.tmp)/sqlite3-api-wasmfs.mjs",
+    "$(sqlite3-wasmfs.mjs)",
     "$(c-pp.D.sqlite3-bundler-friendly) -Dwasmfs",
     "-sEXPORT_ES6 -sUSE_ES6_IMPORT_META"},
 
index 92cb421137e06d9dfb119f1bebc313b4a3ade327..eb07435b601ea409d06debbe835cb1e1c1cc2f38 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Internal\srefactoring\sof\sthe\sWASM\sbuild\smakefile\srule\sgenerator,\sworking\stowards\sparallelizing\sthe\svarious\sbuild\smodes\s(which\sis\snot\scurrently\spossible\sbecause\smost\smodes\sshare\sthe\ssame\ssqlite3.wasm\soutput\sfile\sname).
-D 2025-07-16T10:34:14.710
+C Further\sinternal\swasm\sbuild\scleanups.\sNo\sfunctional\schanges.
+D 2025-07-16T11:09:18.263
 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 d62af1b0914eb2e03fa6e4e75e93acadc8f4faeb2d56335da25d61b9ea144c53
+F ext/wasm/GNUmakefile eae071f5b1d3446052cb3f5e59a1306b0c8b1af83626dcf26f7bada7fa258352
 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 37520a569fc2503d294229601badde24104a08054f86da91f36d83f9d4246cd3
+F ext/wasm/mkwasmbuilds.c f6c528b34e1758267b43365532a3e701ff817a00b92ac8ed2fdec62090d6fe62
 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 1e663374c3fcc20ab0b3250aa1ff9d5e5ac391c89808ad589aa30c8882d4b61e
-R 4688f06c662343c6a49d62d0942495eb
+P 1062b61e9c949d76791ed7974cf6c38d1cec9797a930e9ad7ca851130f5e9a48
+R b2a9312c73209dce3b276f9c450c5ef5
 U stephan
-Z ccdf1d3c1044525847429d3e2a360fc7
+Z 2a2a13815507fb8a535b706df3b4d0cb
 # Remove this line to create a well-formed Fossil manifest.
index df1720da75ca051227ebc423ca09310c48e95157..78d50ea1e617e9190e34a616b7a97e41c229e71c 100644 (file)
@@ -1 +1 @@
-1062b61e9c949d76791ed7974cf6c38d1cec9797a930e9ad7ca851130f5e9a48
+8364d89c3bc1d1dbd95b4324a41bd655251ebd2da5b9f1b9f9aceba9c3d26d3d