1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-21 11:13:54 +03:00

wasm dist: add --snapshot flag, add -64 flag to include 64-bit builds, and add module-symbols.html to the dist.

FossilOrigin-Name: e9a6391b377b6964620285192262a4dc9fe1712799f7aa8a8b37c5f718544ed2
This commit is contained in:
stephan
2025-09-25 18:53:28 +00:00
parent 3e7fe489e2
commit ae48a2463b
5 changed files with 119 additions and 33 deletions

View File

@@ -1420,7 +1420,7 @@ dist-name-prefix = sqlite-wasm$(dist-name-extra)
dist:
./mkdist.sh $(dist-name-prefix)
snapshot:
./mkdist.sh $(dist-name-prefix)-snapshot-$(shell /usr/bin/date +%Y%m%d)
./mkdist.sh $(dist-name-prefix) --snapshot
endif
# ^^^ making dist/snapshot
CLEAN_FILES += $(wildcard sqlite-wasm-*.zip)

View File

@@ -97,8 +97,9 @@
wrapper is significantly easier to use, however.</li>
<li><a href='demo-worker1-promiser.html'>demo-worker1-promiser</a>:
a demo of the Promise-based wrapper of the Worker1 API.</li>
<!--li><a href='demo-worker1-promiser-esm.html'>demo-worker1-promiser-esm</a>:
same as the previous demo except loads the promiser from an ESM module.</li-->
<li><a href='module-symbols.html'>module-symbols</a> gives
a high-level overview of the symbols exposed by the JS
module.</li>
</ul>
</li>
</ul>

View File

@@ -1,7 +1,26 @@
#!/usr/bin/env bash
###
#
# Creates the zip bundle for the sqlite3 wasm builds.
# $1 is a build name, defaulting to sqlite-wasm.
# Builds the SQLite JS/WASM distribution zip file.
#
# Usage: $0 build-name ?flags?
#
# build-name is the dir/archive name prefix for the
# build and defaults to sqlite-wasm.
#
# -?|--help = Show this text
#
# -0 = Use -O0 instead of ${optFlag}
#
# -1 = Use make -j1 instead of ${makeFlag}
#
# -64 = Include 64-bit builds
#
# --noclean = do not run 'make clean' first
#
# --snapshot = gives the archive name a distinctive suffix
#
###
function die(){
local rc=$1
@@ -10,16 +29,56 @@ function die(){
exit $rc
}
buildName=${1-sqlite-wasm}
dirTop=../..
buildName=
b64=0
optFlag=-Oz
clean=1
makeFlag=-j4
snapshotSuffix=
for arg in $@; do
case $arg in
-64) b64=1
;;
-0) optFlag=-O0
;;
-1) makeFlag=
;;
--noclean) clean=0
;;
--snapshot)
snapshotSuffix=$(date +%Y%m%d)
;;
-?|--help)
sed -n -e '2,/^###/p' $0
exit
;;
*) if [[ x != x${buildName} ]]; then
die 1 "Unhandled argument: $arg"
fi
buildName=$arg
;;
esac
done
make=
for i in gmake make; do
make=$(which $i 2>/dev/null)
[[ x != x$make ]] && break
[[ x != x${make} ]] && break
done
[[ x = x$make ]] && die 127 "Cannot find make"
dirTop=../..
[[ x = x${buildName} ]] && buildName=sqlite-wasm
buildName=${buildName}${snapshotSuffix}
echo "Creating the SQLite wasm dist bundle..."
@@ -28,23 +87,30 @@ echo "Creating the SQLite wasm dist bundle..."
# neaded for the dist bundle.
#
tgtFiles=(
tester1.html
tester1-worker.html
tester1-esm.html
tester1.js tester1.mjs
demo-worker1-promiser.html
demo-worker1-promiser.js
demo-worker1-promiser-esm.html
demo-worker1-promiser.mjs
tester1.html
tester1-esm.html
tester1-worker.html
tester1.js
tester1.mjs
)
if false; then
optFlag=-O0
else
optFlag=-Oz
$make clean
if [[ 1 = $b64 ]]; then
tgtFiles+=(
tester1-64bit.html
tester1-esm-64bit.html
tester1-worker-64bit.html
tester1-64bit.js
tester1-64bit.mjs
)
fi
$make -j4 \
[[ 1 = $clean ]] && $make clean
$make $makeFlag \
t-version-info t-stripccomments \
${tgtFiles[@]} \
"emcc_opt=${optFlag}" || die $?
@@ -54,14 +120,19 @@ rm -fr $dirTmp
mkdir -p $dirTmp/jswasm || die $?
mkdir -p $dirTmp/common || die $?
# Files for the top-most dir:
# Static files for the top-most dir:
fTop=(
demo-123.html
demo-123-worker.html
demo-123.js
demo-worker1.html
demo-worker1.js
demo-jsstorage.html
demo-jsstorage.js
demo-123.html
demo-123-worker.html demo-123.js
module-symbols.html
)
# Files for the jswasm subdir sans jswasm prefix:
@@ -82,8 +153,15 @@ fJ2=(
sqlite3.mjs
)
# fW = list of wasm files to copy from jswasm/.
fW=(sqlite3.wasm)
if [[ 1 = $b64 ]]; then
fW+=(sqlite3-64bit.wasm)
fi
function fcp() {
cp -p $@ || die $?
chmod +w ${@: -1}
}
function scc(){
@@ -95,12 +173,15 @@ fcp ${tgtFiles[@]} $dirTmp/.
fcp README-dist.txt $dirTmp/README.txt
fcp index-dist.html $dirTmp/index.html
fcp common/*.css common/SqliteTestUtil.js $dirTmp/common/.
fcp $jw/sqlite3.wasm $dirTmp/$jw/.
for i in ${fTop[@]}; do
fcp $i $dirTmp/.
done
for i in ${fW[@]}; do
fcp $jw/$i $dirTmp/$jw/.
done
for i in ${fJ1[@]}; do
scc -k < $jw/$i > $dirTmp/$jw/$i || die $?
done
@@ -112,13 +193,17 @@ done
#
# Done copying files. Now zip it up...
#
svi=${dirTop}/version-info
vnum=$($svi --download-version)
vdir=${buildName}-${vnum}
fzip=${vdir}.zip
rm -fr ${vdir} ${fzip}
mv $dirTmp $vdir || die $?
zip -rq $fzip $(find $vdir -type f | sort) || die $?
zip -rq9 $fzip $(find $vdir -type f | sort) || die $?
ls -la $fzip
unzip -lv $fzip || die $?
cat <<EOF
**
** Unzipped files are in $vdir
**
EOF

View File

@@ -1,5 +1,5 @@
C Replace\sext/wasm/dist.make\swith\smkdist.sh\sand\sget\sdist\sworking\swith\sthe\snew\sbuild.\sFix\sthe\spreprocessing\sflags\sfor\stester1-esm.html.
D 2025-09-25T17:29:12.649
C wasm\sdist:\sadd\s--snapshot\sflag,\sadd\s-64\sflag\sto\sinclude\s64-bit\sbuilds,\sand\sadd\smodule-symbols.html\sto\sthe\sdist.
D 2025-09-25T18:53:28.163
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -578,7 +578,7 @@ F ext/session/sqlite3session.c b3de195ce668cace9b324599bf6255a70290cbfb5451e826e
F ext/session/sqlite3session.h 7404723606074fcb2afdc6b72c206072cdb2b7d8ba097ca1559174a80bc26f7a
F ext/session/test_session.c 8766b5973a6323934cb51248f621c3dc87ad2a98f023c3cc280d79e7d78d36fb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile e478287749fcd55285072c4161cc6b9d6f448f14f9d84501de1a093734c9fd97
F ext/wasm/GNUmakefile f5c8895122666957bcf2b83a7bcef3e06e16d60b710282397f29bfa013e9c4bc
F ext/wasm/README-dist.txt f01081a850ce38a56706af6b481e3a7878e24e42b314cfcd4b129f0f8427066a
F ext/wasm/README.md 66ace67ae98a45e4116f2ca5425b716887bcee4d64febee804ff6398e1ae9ec7
F ext/wasm/SQLTester/GNUmakefile e0794f676d55819951bbfae45cc5e8d7818dc460492dc317ce7f0d2eca15caff
@@ -629,11 +629,11 @@ F ext/wasm/example_extra_init.c 2347cd69d19d839ef4e5e77b7855103a7fe3ef2af86f2e8c
F ext/wasm/fiddle/fiddle-worker.js 7798af02e672e088ff192716f80626c8895e19301a65b8af6d5d12b2d13d2451
F ext/wasm/fiddle/fiddle.js 84fd75967e0af8b69d3dd849818342227d0f81d13db92e0dcbc63649b31a4893
F ext/wasm/fiddle/index.html a27b8127ef9ecf19612da93b2a6a73bdb3777b5c56b5450bb7200a94bc108ff9
F ext/wasm/index-dist.html 56132399702b15d70c474c3f1952541e25cb0922942868f70daf188f024b3730
F ext/wasm/index-dist.html db23748044e286773f2768eec287669501703b5d5f72755e8db73607dc54d290
F ext/wasm/index.html 1b329fb63e057c02a17ce178308d6b06aac62d92af7dd6d821fb0e183e0f1557
F ext/wasm/jaccwabyt/jaccwabyt.js bbac67bc7a79dca34afe6215fd16b27768d84e22273507206f888c117e2ede7d
F ext/wasm/jaccwabyt/jaccwabyt.md 167fc0b624c9bc2c477846e336de9403842d81b1a24fc4d3b24317cb9eba734f
F ext/wasm/mkdist.sh 94e12f6cfb6131b90a994e7eab5a4b734e8f277fe38cffc3b37e775eb8fe8611 x
F ext/wasm/mkdist.sh 29f8a37a7aba41fa5df8e89b1fab02b83b35c43473c5cf808584872e022514b8 x
F ext/wasm/mkwasmbuilds.c 3f27681fd3b32a78560feb3bb54f0f46a68f75024f65d9c5d4247f6bd08a04ad
F ext/wasm/module-symbols.html dc476b403369b26a1a23773e13b80f41b9a49f0825e81435fe3600a7cfbbe337
F ext/wasm/scratchpad-wasmfs.html a3d7388f3c4b263676b58b526846e9d02dfcb4014ff29d3a5040935286af5b96
@@ -2170,8 +2170,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 2f4be98614b49def2c2951887796c736269ef3bb7ba5b045cae5f748ae165a83
R 2f32df5d7d259ad6860333afe5e70fec
P ab6eb4d3b723107da488770b1849b9f1d1c491348f1eaa544e0e07356b8fac7d
R 5604f99b6885eee7b3387abf567432cd
U stephan
Z 6108442ce190e421e8fe73707ba2c0fe
Z 54eb9cf8d86f8180d0b259e57237e3ca
# Remove this line to create a well-formed Fossil manifest.

View File

@@ -1 +1 @@
ab6eb4d3b723107da488770b1849b9f1d1c491348f1eaa544e0e07356b8fac7d
e9a6391b377b6964620285192262a4dc9fe1712799f7aa8a8b37c5f718544ed2