Files
sqlite3/util/sql3util/wasm/build.sh

30 lines
1.0 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
set -euo pipefail
cd -P -- "$(dirname -- "$0")"
ROOT=../../../
2024-07-20 00:43:34 +01:00
BINARYEN="$ROOT/tools/binaryen/bin"
WASI_SDK="$ROOT/tools/wasi-sdk/bin"
2024-08-09 12:45:19 +01:00
trap 'rm -f sql3parse_table.tmp' EXIT
2024-08-03 00:13:06 +01:00
"$WASI_SDK/clang" --target=wasm32-wasi -std=c23 -g0 -Oz \
2025-04-07 12:49:01 +01:00
-Wall -Wextra -Wno-unused-parameter -Wno-unused-function \
-o sql3parse_table.wasm main.c \
2025-04-17 13:55:44 +01:00
-I"$ROOT/sqlite3/libc" -I"$ROOT/sqlite3" \
-mexec-model=reactor \
2025-05-13 14:27:26 +01:00
-mmutable-globals -mnontrapping-fptoint \
-msimd128 -mbulk-memory -msign-ext \
-mreference-types -mmultivalue \
-fno-stack-protector -fno-stack-clash-protection \
-Wl,--stack-first \
-Wl,--import-undefined \
2024-07-03 14:06:07 +01:00
-Wl,--export=sql3parse_table
2024-07-03 14:06:07 +01:00
"$BINARYEN/wasm-ctor-eval" -c _initialize sql3parse_table.wasm -o sql3parse_table.tmp
"$BINARYEN/wasm-opt" --strip --strip-debug --strip-producers -c -Oz \
sql3parse_table.tmp -o sql3parse_table.wasm --low-memory-unused \
2025-05-13 14:27:26 +01:00
--enable-mutable-globals --enable-nontrapping-float-to-int \
--enable-simd --enable-bulk-memory --enable-sign-ext \
--enable-reference-types --enable-multivalue