github.com/ncruces/go-sqlite3@v0.15.1-0.20240520133447-53eef1510ff0/vfs/tests/mptest/testdata/build.sh (about)

     1  #!/usr/bin/env bash
     2  set -euo pipefail
     3  
     4  cd -P -- "$(dirname -- "$0")"
     5  
     6  ROOT=../../../../
     7  BINARYEN="$ROOT/tools/binaryen-version_117/bin"
     8  WASI_SDK="$ROOT/tools/wasi-sdk-22.0/bin"
     9  
    10  "$WASI_SDK/clang" --target=wasm32-wasi -std=c17 -flto -g0 -O2 \
    11  	-o mptest.wasm main.c \
    12  	-I"$ROOT/sqlite3" \
    13  	-msimd128 -mmutable-globals \
    14  	-mbulk-memory -mreference-types \
    15  	-mnontrapping-fptoint -msign-ext \
    16  	-fno-stack-protector -fno-stack-clash-protection \
    17  	-Wl,--stack-first \
    18  	-Wl,--import-undefined \
    19  	-D_HAVE_SQLITE_CONFIG_H -DSQLITE_USE_URI \
    20  	-DSQLITE_DEFAULT_SYNCHRONOUS=0 \
    21  	-DSQLITE_DEFAULT_LOCKING_MODE=0 \
    22  	-DSQLITE_NO_SYNC -DSQLITE_THREADSAFE=0 \
    23  	-DSQLITE_OMIT_LOAD_EXTENSION -DHAVE_USLEEP \
    24  	-DSQLITE_CUSTOM_INCLUDE=sqlite_opt.h \
    25  	-D_WASI_EMULATED_GETPID -lwasi-emulated-getpid \
    26  	$(awk '{print "-Wl,--export="$0}' exports.txt)
    27  
    28  "$BINARYEN/wasm-opt" -g --strip --strip-producers -c -O3 \
    29  	mptest.wasm -o mptest.tmp \
    30  	--enable-simd --enable-mutable-globals --enable-multivalue \
    31  	--enable-bulk-memory --enable-reference-types \
    32  	--enable-nontrapping-float-to-int --enable-sign-ext
    33  mv mptest.tmp mptest.wasm
    34  bzip2 -9f mptest.wasm