$(MAKE) -C $(dir.top) sqlite3.c
$(sqlite3.c): $(sqlite3.h)
-ifeq (,$(filter release snapshot,$(MAKECMDGOALS)))
- $(info Development build. Use 'release' or 'snapshot' target for a smaller release build.)
+ifneq (1,$(MAKING_CLEAN))
+ ifeq (,$(filter release snapshot,$(MAKECMDGOALS)))
+ $(info ==============================================================)
+ $(info == Development build. Use 'release' or 'snapshot' target)
+ $(info == for a smaller release build.)
+ $(info ==============================================================)
+ endif
endif
########################################################################
# Find emcc (Emscripten compiler)...
-emcc.bin := $(shell which emcc 2>/dev/null)
-ifeq (,$(emcc.bin))
- ifneq (,$(EMSDK_HOME))
- emcc.bin := $(wildcard $(EMSDK_HOME)/upstream/emscripten/emcc)
- endif
+ifeq (1,$(MAKING_CLEAN))
+ emcc.bin := echo
+ emcc.version := unknown
+else
+ emcc.bin := $(shell which emcc 2>/dev/null)
ifeq (,$(emcc.bin))
- $(error Cannot find emcc in path.)
+ ifneq (,$(EMSDK_HOME))
+ emcc.bin := $(wildcard $(EMSDK_HOME)/upstream/emscripten/emcc)
+ endif
+ ifeq (,$(emcc.bin))
+ $(error Cannot find emcc in path.)
+ endif
endif
+ emcc.version := $(shell $(emcc.bin) --version | sed -n 1p | sed -e 's/^.* \([3-9][^ ]*\) .*$$/\1/;')
+ $(info using emcc version [$(emcc.version)])
endif
-emcc.version := $(shell $(emcc.bin) --version | sed -n 1p | sed -e 's/^.* \([3-9][^ ]*\) .*$$/\1/;')
-$(info using emcc version [$(emcc.version)])
#########################################################################
# Find wasm-strip, which we need for release builds (see below for
# why) but not strictly for non-release builds.
-wasm-strip.bin ?= $(shell which wasm-strip 2>/dev/null)
-ifeq (,$(wasm-strip.bin))
- ifeq (,$(filter clean,$(MAKECMDGOALS)))
+ifeq (1,$(MAKING_CLEAN))
+ wasm-strip-bin := irrelevant
+else
+ wasm-strip.bin ?= $(shell which wasm-strip 2>/dev/null)
+ ifeq (,$(wasm-strip.bin))
$(info WARNING: *******************************************************************)
- $(info WARNING: builds using -O2/-O3/-Os/-Oz will minify WASM-exported names,)
+ $(info WARNING: Builds using -O2/-O3/-Os/-Oz will minify WASM-exported names,)
$(info WARNING: breaking _All The Things_. The workaround for that is to build)
$(info WARNING: with -g3 (which explodes the file size) and then strip the debug)
$(info WARNING: info after compilation, using wasm-strip, to shrink the wasm file.)
$(info WARNING: on Ubuntu-like systems it can be installed with:)
$(info WARNING: sudo apt install wabt)
$(info WARNING: *******************************************************************)
+ wasm-strip.bin := echo "not wasm-stripping"
endif
ifneq (,$(filter release snapshot,$(MAKECMDGOALS)))
$(error Cannot make release-quality binary because wasm-strip is not available.)
endif
- wasm-strip.bin := echo "not wasm-stripping"
endif
maybe-wasm-strip := $(wasm-strip.bin)
# goal being to create a WASM file with only the core APIs.
ifeq (1,$(barebones))
wasm-bare-bones := 1
+ $(info ==============================================================)
+ $(info == This is a bare-bones build. It trades away features for)
+ $(info == a smaller .wasm file.)
+ $(info ==============================================================)
else
wasm-bare-bones := 0
endif
-DSQLITE_OMIT_LOAD_EXTENSION -DSQLITE_OMIT_DEPRECATED -DSQLITE_OMIT_UTF16 \
-DSQLITE_OMIT_SHARED_CACHE -DSQLITE_OMIT_WAL -DSQLITE_THREADSAFE=0 \
-DSQLITE_TEMP_STORE=3
+DISTCLEAN_FILES += $(bin.c-pp)
C-PP.FILTER.global ?=
ifeq (1,$(SQLITE_C_IS_SEE))
C-PP.FILTER.global += -Denable-see
endif
ifeq (0,$(wasm-bare-bones))
EXPORTED_FUNCTIONS.api.in += $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-extras
-else
- $(info ============================================================)
- $(info This is a bare-bones build. It is missing many features.)
- $(info ============================================================)
endif
EXPORTED_FUNCTIONS.api := $(dir.tmp)/EXPORTED_FUNCTIONS.api
$(EXPORTED_FUNCTIONS.api): $(EXPORTED_FUNCTIONS.api.in) $(sqlite3.c) $(MAKEFILE)
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
+ifneq (1,$(MAKING_CLEAN))
.wasmbuilds.make: $(bin.mkwb)
@rm -f $@
$(bin.mkwb) > $@
@chmod -w $@
-DISTCLEAN_FILES += .wasmbuilds.make
-include .wasmbuilds.make
+endif
+DISTCLEAN_FILES += .wasmbuilds.make
+
# The various -D... values used by *.c-pp.js include:
#
# -Dtarget=es6-module: for all ESM module builds
}.bind(sqlite3InitModuleState);
//#endif ifnot target=es6-bundler-friendly
+//#if custom-Module.instantiateModule
/**
Bug warning: a custom Module.instantiateWasm() does not work
in WASMFS builds:
In such builds we must disable this.
*/
-const xNameOfInstantiateWasm = false
+const xNameOfInstantiateWasm =
+//#if wasmfs
+ false
+//#else
+ true /* 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() */
+//#endif
? 'instantiateWasm'
: 'emscripten-bug-17951';
Module[xNameOfInstantiateWasm] = function callee(imports,onSuccess){
sqlite3InitModuleState.debugModule(
"instantiateWasm() uri =", uri
);
+ //console.warn("Custom instantiateModule",uri);
const wfetch = ()=>fetch(uri, {credentials: 'same-origin'});
const loadWasm = WebAssembly.instantiateStreaming
? async ()=>{
scripts.
*/
Module[xNameOfInstantiateWasm].uri = 'sqlite3.wasm';
+//#endif custom-Module.instantiateModule
/* END FILE: api/pre-js.js, noting that the build process may add a
line after this one to change the above .uri to a build-specific
one. */
}
ISFLAG("debug"){
++g.doDebug;
- }else if(!zInfile){
+ }else if(!zInfile && '-'!=argv[i][0]){
goto do_infile;
}else{
fatal("Unhandled flag: %s", argv[i]);
** 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
-** highly illegible when built that way. Attempts to write this app in
-** Bash and TCL have failed because 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.
+** 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.
**
** The emitted makefile code is not standalone - it depends on
** variables and $(call)able functions from the main makefile.
*/
#define JS_BUILD_NAMES sqlite3 sqlite3-wasmfs
/*
-** Valid names for the zMode arguments.
+** Valid names for the zMode arguments of the "sqlite3" build. For the
+** "sqlite3-wasmfs" build, only "esm" (ES6 Module) is legal.
*/
#define JS_BUILD_MODES vanilla esm bundler-friendly node
pf("pre-post-%s-%s.flags ?=\n", zNM);
/* --pre-js=... */
- pf("pre-js.js.%s-%s.intermediary := $(dir.tmp)/pre-js.%s-%s.intermediary.js\n",
- zNM, zNM);
pf("pre-js.js.%s-%s := $(dir.tmp)/pre-js.%s-%s.js\n",
zNM, zNM);
+ pf("$(pre-js.js.%s-%s): $(MAKEFILE)\n", zNM);
+#if 1
+ pf("$(eval $(call C-PP.FILTER,$(pre-js.js.in),$(pre-js.js.%s-%s),"
+ "$(c-pp.D.%s-%s)))\n", zNM, zNM);
+#else
+ /* This part is needed if/when we re-enable the custom
+ ** Module.instantiateModule() impl. */
+ 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),"
"$(c-pp.D.%s-%s)))\n", zNM, zNM);
+ pf("$(pre-js.js.%s-%s): $(pre-js.js.%s-%s.intermediary)\n", zNM, zNM);
+ pf("\tcp $(pre-js.js.%s-%s.intermediary) $@\n", zNM);
+
+ /* Amend $(pre-js.js.zName-zMode) for all targets except the plain
+ ** "sqlite3" build... */
+ if( 0!=strcmp("sqlite3-wasmfs", zName)
+ && 0!=strcmp("sqlite3", zName) ){
+ pf("\t@echo 'Module[xNameOfInstantiateWasm].uri = "
+ "\"%s.wasm\";' >> $@\n", zName);
+ }
+#endif
/* --post-js=... */
pf("post-js.js.%s-%s := $(dir.tmp)/post-js.%s-%s.js\n", zNM, zNM);
pf("pre-post-%s-%s.flags += $(pre-post-common.flags.%s-%s) "
"--pre-js=$(pre-js.js.%s-%s)\n", zNM, zNM, zNM);
- pf("$(pre-js.js.%s-%s): $(pre-js.js.%s-%s.intermediary) $(MAKEFILE)\n",
- zNM, zNM);
- pf("\tcp $(pre-js.js.%s-%s.intermediary) $@\n", zNM);
- /* Amend $(pre-js.js.zName-zMode) for all targets except the plain
- "sqlite3" build... */
- if( 0==strcmp("sqlite3-wasmfs", zName) ){
- pf("\t@echo 'delete Module[xNameOfInstantiateWasm]; /"
- "* for %s build *" "/' >> $@\n", zName);
- }else if( 0!=strcmp("sqlite3", zName) ){
- pf("\t@echo 'Module[xNameOfInstantiateWasm].uri = \"$(1).wasm\";' >> $@\n");
- }
-
/* Set up deps... */
pf("pre-post-jses.%s-%s.deps := $(pre-post-jses.deps.common) "
"$(post-js.js.%s-%s) $(extern-post-js.js.%s-%s)\n",
if( !zEmcc ) zEmcc = "";
pf("#################### begin build [%s-%s]\n", 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);
** conditionally using info we don't have here. */
pf("all: %s\n", zJsOut);
}
+ ps("endif\n# ^^^ !$(MAKING_CLEAN)");
pf("#################### end build [%s-%s]\n\n", zNM);
}
# GNUMakefile.
########################################################################
MAKEFILE.wasmfs := $(lastword $(MAKEFILE_LIST))
-$(warning The WASMFS build is not well-supported. \
- WASMFS is a proverbial moving target, so what builds today might not tomorrow.)
+# ensure that the following message starts on line 10 or higher for proper
+# alignment!
+ifneq (1,$(MAKING_CLEAN))
+ $(warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
+ $(warning !! The WASMFS build is not well-supported. WASMFS is a proverbial)
+ $(warning !! moving target, sometimes changing in incompatible ways between)
+ $(warning !! Emscripten versions. This build is provided for adventurous folks)
+ $(warning !! and is not a supported deliverable of the SQLite project.)
+ $(warning !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!)
+endif
sqlite3-wasmfs.js := $(dir.wasmfs)/sqlite3-wasmfs.js
sqlite3-wasmfs.wasm := $(dir.wasmfs)/sqlite3-wasmfs.wasm
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 EXPORTED_RUNTIME_METHODS.
+# 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
-# ^^^^^ it likes to warn when we have "limited optimizations" via the -g3 flag.
+# ^^^^^ 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
# 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.
-#
+# 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) $(sqlite3-wasmfs.mjs): $(SOAP.js.bld)
ifeq (js,$(wasmfs.build.ext))
$(sqlite3-wasmfs.wasm): $(sqlite3-wasmfs.mjs)
wasmfs: $(sqlite3-wasmfs.mjs)
endif
-#all: wasmfs
########################################################################
# speedtest1 for wasmfs.
-C Typo\sfix\sin\smakefile\scomments.
-D 2024-09-23T22:56:54.375
+C Further\swasm\sbuild\scleanups\sand\stweaks.\sNo\sfunctional\schanges.
+D 2024-09-24T00:31:08.220
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
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 9ad87c7b7cdbbf4b3d48ff8aad8b12ffca2f48cb0190d366efa1c25386601f99
+F ext/wasm/GNUmakefile fdb89338c1c6ce71ce804ef1c3de8ac9aa0b68566e2ce3210ebe4951e88e3b52
F ext/wasm/README-dist.txt 6382cb9548076fca472fb3330bbdba3a55c1ea0b180ff9253f084f07ff383576
F ext/wasm/README.md a8a2962c3aebdf8d2104a9102e336c5554e78fc6072746e5daf9c61514e7d193
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
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 ad906703f7429590f2fbf5e6498513bf727a1a4f0ebfa057afb08161d7511219
+F ext/wasm/api/pre-js.c-pp.js b10a41b749e86670d17c0937c95e60eefe33dfdea1c5fc6c95d5b62a7b2b1f2c
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
F ext/wasm/batch-runner-sahpool.js 54a3ac228e6c4703fe72fb65c897e19156263a51fe9b7e21d2834a45e876aabd
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
F ext/wasm/batch-runner.js 05ec254f5dbfe605146d9640b3db17d6ef8c3fbef6aa8396051ca72bb5884e3f
-F ext/wasm/c-pp.c e230a9f71a6179971a65d87e2d393a16c87285f6a3bbad232f494fbc5ab9f82f
+F ext/wasm/c-pp.c 6d131069644964223305582a80973477fa8b06b57306781690d7874ebd3a4f84
F ext/wasm/common/SqliteTestUtil.js 7adaeffef757d8708418dc9190f72df22367b531831775804b31598b44f6aa51
F ext/wasm/common/emscripten.css 11bd104b6c0d597c67d40cc8ecc0a60dae2b965151e3b6a37fa5708bac3acd15
F ext/wasm/common/testing.css e97549bab24126c24e0daabfe2de9bb478fb0a69fdb2ddd0a73a992c091aad6f
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 3bdf224f68038aaf16b9551ff95f72bda9aab122d047542ebb011a3108ea8e3c
+F ext/wasm/mkwasmbuilds.c 1b7e970bcfbf4197cedc6e4da9e6939f869801c2d9fe70b4e844a8c598678359
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/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471f4520a99e5b545928668f4285fb5e
F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88
F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
-F ext/wasm/wasmfs.make fb12389969139fd379bb4aa8455bf110cf6856fc54c8901e7451fab23834a8ef
+F ext/wasm/wasmfs.make 8067daf346482cdb91414c3f6b8f6ff110bfa874294f73e13479c755af67ec20
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P 5440de48903e94f91090e2df65702ec0c504e33dd5cbd50f684cf30988f20b02
-R af6369038d36d387fd18581223ef3153
+P a4a1287fe8205d7c24556ec2e7ae09cda37a36dbe405ea70cd756cf488549036
+R 9f08f9acf686695c4b728c0d11a4b3f8
U stephan
-Z 842b2632fb8484faa7396f7355e6a0a1
+Z 7db74120d28ad7360e1e90126cd6bb3c
# Remove this line to create a well-formed Fossil manifest.
-a4a1287fe8205d7c24556ec2e7ae09cda37a36dbe405ea70cd756cf488549036
+3b72a143431537ec275aefae739e56330c1d445c9ea80885882a2b9aa2201179