Files
sqlite3/embed/build.sh

20 lines
468 B
Bash
Raw Permalink 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")"
# 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-03-21 00:13:12 +00:00
-I../sqlite3/ \
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