mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-29 08:01:23 +03:00
Update the dist rules for this evening's js/wasm build changes and include an index.html specifically for the subset of apps included in the dist archive.
FossilOrigin-Name: a0ef0f32e96638b502b3951e524d590bdfb09dd39be453686b075102da67b7db
This commit is contained in:
@ -185,17 +185,17 @@ else
|
||||
$(info Development build. Use '$(MAKE) release' for a smaller release build.)
|
||||
endif
|
||||
|
||||
version-info := $(dir.wasm)/version-info
|
||||
bin.version-info := $(dir.wasm)/bin.version-info
|
||||
# ^^^^ NOT in $(dir.tmp) because we need it to survive the cleanup
|
||||
# process for the dist build to work properly.
|
||||
$(version-info): $(dir.wasm)/version-info.c $(sqlite3.h) $(MAKEFILE)
|
||||
$(bin.version-info): $(dir.wasm)/version-info.c $(sqlite3.h) $(MAKEFILE)
|
||||
$(CC) -O0 -I$(dir.top) -o $@ $<
|
||||
DISTCLEAN_FILES += $(version-info)
|
||||
DISTCLEAN_FILES += $(bin.version-info)
|
||||
|
||||
stripccomments := $(dir.tool)/stripccomments
|
||||
$(stripccomments): $(stripccomments).c $(MAKEFILE)
|
||||
bin.stripccomments := $(dir.tool)/stripccomments
|
||||
$(bin.stripccomments): $(bin.stripccomments).c $(MAKEFILE)
|
||||
$(CC) -o $@ $<
|
||||
DISTCLEAN_FILES += $(stripccomments)
|
||||
DISTCLEAN_FILES += $(bin.stripccomments)
|
||||
|
||||
EXPORTED_FUNCTIONS.api.in := $(abspath $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-api)
|
||||
EXPORTED_FUNCTIONS.api := $(dir.tmp)/EXPORTED_FUNCTIONS.api
|
||||
@ -241,12 +241,12 @@ $(sqlite3-api.js): $(sqlite3-api.jses) $(MAKEFILE)
|
||||
echo "/* END FILE: $$i */"; \
|
||||
done > $@
|
||||
|
||||
$(sqlite3-api-build-version.js): $(version-info) $(MAKEFILE)
|
||||
$(sqlite3-api-build-version.js): $(bin.version-info) $(MAKEFILE)
|
||||
@echo "Making $@..."
|
||||
@{ \
|
||||
echo 'self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \
|
||||
echo -n ' sqlite3.version = '; \
|
||||
$(version-info) --json; \
|
||||
$(bin.version-info) --json; \
|
||||
echo ';'; \
|
||||
echo '});'; \
|
||||
} > $@
|
||||
@ -543,7 +543,7 @@ o-xtra := -flto
|
||||
# doubles the build time and seems to have negligible effect on
|
||||
# higher optimization levels.
|
||||
o0: clean
|
||||
$(MAKE) -e "emcc_opt=-O0 $(o-xtra)"
|
||||
$(MAKE) -e "emcc_opt=-O0"
|
||||
o1: clean
|
||||
$(MAKE) -e "emcc_opt=-O1 $(o-xtra)"
|
||||
o2: clean
|
||||
|
@ -7,18 +7,17 @@ TODO: link to main WASM/JS docs, once they are online
|
||||
This archive contains the sqlite3.js and sqlite3.wasm file which make
|
||||
up the sqlite3 WASM/JS build.
|
||||
|
||||
The jswasm directory contains both the main deliverables and small
|
||||
demonstration and test apps. Browsers will not serve WASM files from
|
||||
file:// URLs, so the demo/test apps require a web server and that
|
||||
server must include the following headers in its response when serving
|
||||
the files:
|
||||
The jswasm directory contains the core sqlite3 deliverables and the
|
||||
top-level directory contains demonstration and test apps. Browsers
|
||||
will not serve WASM files from file:// URLs, so the demo/test apps
|
||||
require a web server and that server must include the following
|
||||
headers in its response when serving the files:
|
||||
|
||||
Cross-Origin-Opener-Policy: same-origin
|
||||
Cross-Origin-Embedder-Policy: require-corp
|
||||
|
||||
The files named sqlite3*.js and sqlite3.wasm belong to the core
|
||||
sqlite3 deliverables and the others are soley for demonstration and
|
||||
may be discarded. They are not in separate directories from the main
|
||||
deliverables because a quirk of URI resolution in JS code would then
|
||||
require that sqlite3.js be duplicated and edited for Worker-loaded
|
||||
operation.
|
||||
One simple way to get the demo apps up and running on Unix-style
|
||||
systems is to install althttpd (https://sqlite.org/althttpd) and run:
|
||||
|
||||
althttpd --enable-sab --page index.html
|
||||
|
||||
|
@ -64,12 +64,12 @@ browser client:
|
||||
thread via the Worker message-passing interface. Like OO API #1,
|
||||
this is an optional component, offering one of any number of
|
||||
potential implementations for such an API.
|
||||
- `../sqlite3-worker1.js`\
|
||||
- `sqlite3-worker1.js`\
|
||||
Is not part of the amalgamated sources and is intended to be
|
||||
loaded by a client Worker thread. It loads the sqlite3 module
|
||||
and runs the Worker #1 API which is implemented in
|
||||
`sqlite3-api-worker1.js`.
|
||||
- `../sqlite3-worker1-promiser.js`\
|
||||
- `sqlite3-worker1-promiser.js`\
|
||||
Is likewise not part of the amalgamated sources and provides
|
||||
a Promise-based interface into the Worker #1 API. This is
|
||||
a far user-friendlier way to interface with databases running
|
||||
@ -78,7 +78,7 @@ browser client:
|
||||
is an sqlite3 VFS implementation which supports Google Chrome's
|
||||
Origin-Private FileSystem (OPFS) as a storage layer to provide
|
||||
persistent storage for database files in a browser. It requires...
|
||||
- `../sqlite3-opfs-async-proxy.js`\
|
||||
- `sqlite3-opfs-async-proxy.js`\
|
||||
is the asynchronous backend part of the OPFS proxy. It speaks
|
||||
directly to the (async) OPFS API and channels those results back
|
||||
to its synchronous counterpart. This file, because it must be
|
||||
|
@ -10,14 +10,11 @@
|
||||
MAKEFILE.dist := $(lastword $(MAKEFILE_LIST))
|
||||
|
||||
########################################################################
|
||||
# Chicken/egg situation: we need $(version-info) to get the version
|
||||
# Chicken/egg situation: we need $(bin.version-info) to get the version
|
||||
# info for the archive name, but that binary may not yet be built, and
|
||||
# won't be built until we expand the dependencies. We have to use a
|
||||
# temporary name for the archive.
|
||||
dist-name = sqlite-wasm-TEMP
|
||||
dist-archive = $(dist-name).zip
|
||||
.PHONY: $(dist-archive)
|
||||
CLEAN_FILES += $(wildcard sqlite-wasm-*.zip)
|
||||
#ifeq (0,1)
|
||||
# $(info WARNING *******************************************************************)
|
||||
# $(info ** Be sure to create the desired build configuration before creating the)
|
||||
@ -40,52 +37,58 @@ CLEAN_FILES += $(wildcard sqlite-wasm-*.zip)
|
||||
# date.
|
||||
dist-build ?= oz
|
||||
|
||||
demo-123.html := $(dir.wasm)/demo-123.html
|
||||
demo-123-worker.html := $(dir.wasm)/demo-123-worker.html
|
||||
demo-123.js := $(dir.wasm)/demo-123.js
|
||||
demo-files := $(demo-123.js) $(demo-123.html) $(demo-123-worker.html) \
|
||||
tester1.html tester1.js tester1-worker.html
|
||||
README-dist := $(dir.wasm)/README-dist.txt
|
||||
dist-dir-main := $(dist-name)/jswasm
|
||||
dist.main.extras := \
|
||||
sqlite3-opfs-async-proxy.js \
|
||||
sqlite3-worker1.js \
|
||||
sqlite3-worker1-promiser.js
|
||||
dist-dir.top := $(dist-name)
|
||||
dist-dir.jswasm := $(dist-dir.top)/$(notdir $(dir.dout))
|
||||
dist-dir.common := $(dist-dir.top)/common
|
||||
dist.top.extras := \
|
||||
demo-123.html demo-123-worker.html demo-123.js \
|
||||
tester1.html tester1-worker.html tester1.js
|
||||
dist.jswasm.extras := $(sqlite3-api.ext.jses) $(sqlite3.wasm)
|
||||
dist.common.extras := $(wildcard $(dir.common)/*.css)
|
||||
|
||||
.PHONY: dist
|
||||
########################################################################
|
||||
# $(dist-archive): create the end-user deliverable archive.
|
||||
# dist: create the end-user deliverable archive.
|
||||
#
|
||||
# Maintenance reminder: because $(dist-archive) depends on
|
||||
# $(dist-build), and $(dist-build) will depend on clean, having any deps
|
||||
# on $(dist-archive) which themselves may be cleaned up by the clean
|
||||
# Maintenance reminder: because dist depends on $(dist-build), and
|
||||
# $(dist-build) will depend on clean, having any deps on
|
||||
# $(dist-archive) which themselves may be cleaned up by the clean
|
||||
# target will lead to grief in parallel builds (-j #). Thus
|
||||
# $(dist-target)'s deps must be trimmed to non-generated files or
|
||||
# files which are _not_ cleaned up by the clean target.
|
||||
$(dist-archive): \
|
||||
$(stripccomments) $(version-info) \
|
||||
#
|
||||
# Note that we require $(bin.version-info) in order to figure out the
|
||||
# dist file's name, so cannot (without a recursive make) have the
|
||||
# target name equal to the archive name.
|
||||
dist: \
|
||||
$(bin.stripccomments) $(bin.version-info) \
|
||||
$(dist-build) \
|
||||
$(MAKEFILE) $(MAKEFILE.dist)
|
||||
@echo "Making end-user deliverables..."
|
||||
@rm -fr $(dist-name)
|
||||
@mkdir -p $(dist-dir-main)
|
||||
@cp -p $(README-dist) $(dist-name)/README.txt
|
||||
@cp -p $(sqlite3.wasm) $(dist.main.extras) $(dist-dir-main)
|
||||
@$(stripccomments) -k -k < $(sqlite3.js) \
|
||||
> $(dist-dir-main)/$(notdir $(sqlite3.js))
|
||||
@cp -p $(demo-files) $(dist-dir-main)
|
||||
@vnum=$$($(version-info) --version-number); \
|
||||
vdir=sqlite-wasm-$$vnum; \
|
||||
arc=$$vdir.zip; \
|
||||
echo "Making $$arc ..."; \
|
||||
rm -f $$arc; \
|
||||
mv $(dist-name) $$vdir; \
|
||||
zip -qr $$arc $$vdir; \
|
||||
rm -fr $$vdir; \
|
||||
ls -la $$arc; \
|
||||
unzip -lv $$arc || echo "Missing unzip app? Not fatal."
|
||||
@rm -fr $(dist-dir.top)
|
||||
@mkdir -p $(dist-dir.jswasm) $(dist-dir.common)
|
||||
@cp -p $(dist.top.extras) $(dist-dir.top)
|
||||
@cp -p README-dist.txt $(dist-dir.top)/README.txt
|
||||
@cp -p index-dist.html $(dist-dir.top)/index.html
|
||||
@cp -p $(dist.jswasm.extras) $(dist-dir.jswasm)
|
||||
@$(bin.stripccomments) -k -k < $(sqlite3.js) \
|
||||
> $(dist-dir.jswasm)/$(notdir $(sqlite3.js))
|
||||
@cp -p $(dist.common.extras) $(dist-dir.common)
|
||||
@vnum=$$($(bin.version-info) --version-number); \
|
||||
vdir=sqlite-wasm-$$vnum; \
|
||||
arczip=$$vdir.zip; \
|
||||
echo "Making $$arczip ..."; \
|
||||
rm -f $$arczip; \
|
||||
mv $(dist-dir.top) $$vdir; \
|
||||
zip -qr $$arczip $$vdir; \
|
||||
rm -fr $$vdir; \
|
||||
ls -la $$arczip; \
|
||||
unzip -lv $$arczip || echo "Missing unzip app? Not fatal."
|
||||
|
||||
#$(shell $(version-info) --version-number)
|
||||
dist: $(dist-archive)
|
||||
clean-dist:
|
||||
rm -f $(dist-archive)
|
||||
clean: clean-dist
|
||||
# We need a separate `clean` rule to account for weirdness in
|
||||
# a sub-make, where we get a copy of the $(dist-name) dir
|
||||
# copied into the new $(dist-name) dir.
|
||||
.PHONY: dist-clean
|
||||
clean: dist-clean
|
||||
dist-clean:
|
||||
rm -fr $(dist-name) $(wildcard sqlite-wasm-*.zip)
|
||||
|
82
ext/wasm/index-dist.html
Normal file
82
ext/wasm/index-dist.html
Normal file
@ -0,0 +1,82 @@
|
||||
<!doctype html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
|
||||
<title>sqlite3 WASM Demo Page Index</title>
|
||||
</head>
|
||||
<body>
|
||||
<style>
|
||||
body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
textarea {
|
||||
font-family: monospace;
|
||||
}
|
||||
header {
|
||||
font-size: 130%;
|
||||
font-weight: bold;
|
||||
}
|
||||
.hidden, .initially-hidden {
|
||||
position: absolute !important;
|
||||
opacity: 0 !important;
|
||||
pointer-events: none !important;
|
||||
display: none !important;
|
||||
}
|
||||
.warning { color: firebrick; }
|
||||
</style>
|
||||
<header id='titlebar'><span>sqlite3 WASM demo pages</span></header>
|
||||
<hr>
|
||||
<div>Below is the list of demo pages for the sqlite3 WASM
|
||||
builds. The intent is that <em>this</em> page be run
|
||||
using the functional equivalent of:</div>
|
||||
<blockquote><pre><a href='https://sqlite.org/althttpd'>althttpd</a> -enable-sab -page index.html</pre></blockquote>
|
||||
<div>and the individual pages be started in their own tab.
|
||||
Warnings and Caveats:
|
||||
<ul class='warning'>
|
||||
<li>Some of these pages require that the web server emit the
|
||||
so-called
|
||||
<a href='https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Opener-Policy'>COOP</a>
|
||||
and
|
||||
<a href='https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cross-Origin-Embedder-Policy'>COEP</a>
|
||||
headers. <a href='https://sqlite.org/althttpd'>althttpd</a> requires the
|
||||
<code>-enable-sab</code> flag for that.
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div>The tests and demos...
|
||||
<ul id='test-list'>
|
||||
<li>Core-most tests
|
||||
<ul>
|
||||
<li><a href='tester1.html'>tester1</a>: Core unit and
|
||||
regression tests for the various APIs and surrounding
|
||||
utility code.</li>
|
||||
<li><a href='tester1-worker.html'>tester1-worker</a>: same thing
|
||||
but running in a Worker.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>High-level apps and demos...
|
||||
<ul>
|
||||
<li><a href='demo-123.html'>demo-123</a> provides a
|
||||
no-nonsense example of adding sqlite3 support to a web
|
||||
page in the UI thread.</li>
|
||||
<li><a href='demo-123-worker.html'>demo-123-worker</a> is
|
||||
the same as <code>demo-123</code> but loads and runs
|
||||
sqlite3 from a Worker thread.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<style>
|
||||
#test-list { font-size: 120%; }
|
||||
</style>
|
||||
<script>//Assign a distinct target tab name for each test page...
|
||||
document.querySelectorAll('a').forEach(function(e){
|
||||
e.target = e.href;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -4,8 +4,8 @@
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<link rel="shortcut icon" href="data:image/x-icon;," type="image/x-icon">
|
||||
<link rel="stylesheet" href="../common/emscripten.css"/>
|
||||
<link rel="stylesheet" href="../common/testing.css"/>
|
||||
<link rel="stylesheet" href="common/emscripten.css"/>
|
||||
<link rel="stylesheet" href="common/testing.css"/>
|
||||
<title>sqlite3 tester #1 (UI thread)</title>
|
||||
<style>
|
||||
body {
|
||||
|
Reference in New Issue
Block a user