Files
sqlite3/embed/build.sh

22 lines
493 B
Bash
Raw Normal View History

2023-01-12 06:19:06 +00:00
#!/usr/bin/env bash
set -eo pipefail
2023-01-11 14:58:20 +00:00
2023-01-12 06:19:06 +00:00
cd -P -- "$(dirname -- "$0")"
# download SQLite
2023-01-21 00:33:46 +00:00
../sqlite3/download.sh
2023-01-12 06:19:06 +00:00
# build SQLite
2023-01-26 00:05:52 +00:00
zig cc --target=wasm32-wasi -flto -g0 -Os \
-o sqlite3.wasm ../sqlite3/main.c \
2023-01-12 11:06:17 +00:00
-mmutable-globals \
-mbulk-memory -mreference-types \
-mnontrapping-fptoint -msign-ext \
2023-01-24 11:17:30 -08:00
-D_HAVE_SQLITE_CONFIG_H \
2023-03-15 13:29:09 +00:00
$(awk '{print "-Wl,--export="$0}' exports.txt)
# optimize SQLite
if which wasm-opt; then
wasm-opt -g -O -o sqlite3.tmp sqlite3.wasm
mv sqlite3.tmp sqlite3.wasm
fi