diff --git a/embed/README.md b/embed/README.md index 2d94da3..8003043 100644 --- a/embed/README.md +++ b/embed/README.md @@ -1,6 +1,6 @@ # Embeddable WASM build of SQLite -This folder includes an embeddable WASM build of SQLite 3.41.1 for use with +This folder includes an embeddable WASM build of SQLite 3.41.2 for use with [`github.com/ncruces/go-sqlite3`](https://pkg.go.dev/github.com/ncruces/go-sqlite3). The following optional features are compiled in: diff --git a/embed/build.sh b/embed/build.sh index 59a2c70..f99d560 100755 --- a/embed/build.sh +++ b/embed/build.sh @@ -4,17 +4,11 @@ set -eo pipefail cd -P -- "$(dirname -- "$0")" # build SQLite -zig cc --target=wasm32-wasi -flto -g0 -Os \ +zig cc --target=wasm32-wasi -flto -g0 -O2 \ -o sqlite3.wasm ../sqlite3/main.c \ -I../sqlite3/ \ -mmutable-globals \ -mbulk-memory -mreference-types \ -mnontrapping-fptoint -msign-ext \ -D_HAVE_SQLITE_CONFIG_H \ - $(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 \ No newline at end of file + $(awk '{print "-Wl,--export="$0}' exports.txt) \ No newline at end of file diff --git a/embed/sqlite3.wasm b/embed/sqlite3.wasm old mode 100644 new mode 100755 index 3f2ed8e..4353beb Binary files a/embed/sqlite3.wasm and b/embed/sqlite3.wasm differ diff --git a/sqlite3/download.sh b/sqlite3/download.sh index c032ec8..3797447 100755 --- a/sqlite3/download.sh +++ b/sqlite3/download.sh @@ -3,29 +3,29 @@ set -eo pipefail cd -P -- "$(dirname -- "$0")" -curl -#OL "https://sqlite.org/2023/sqlite-amalgamation-3410100.zip" +curl -#OL "https://sqlite.org/2023/sqlite-amalgamation-3410200.zip" unzip -d . sqlite-amalgamation-*.zip mv sqlite-amalgamation-*/sqlite3* . rm -rf sqlite-amalgamation-* cd ext/ -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/ext/misc/decimal.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/ext/misc/uint.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/ext/misc/uuid.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/ext/misc/base64.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/ext/misc/regexp.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/ext/misc/series.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/ext/misc/decimal.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/ext/misc/uint.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/ext/misc/uuid.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/ext/misc/base64.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/ext/misc/regexp.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/ext/misc/series.c" cd ~- cd ../tests/mptest/testdata/ -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/mptest/mptest.c" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/mptest/config01.test" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/mptest/config02.test" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/mptest/crash01.test" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/mptest/crash02.subtest" -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/mptest/multiwrite01.test" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/mptest/mptest.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/mptest/config01.test" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/mptest/config02.test" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/mptest/crash01.test" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/mptest/crash02.subtest" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/mptest/multiwrite01.test" cd ~- cd ../tests/speedtest1/testdata/ -curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.1/test/speedtest1.c" +curl -#OL "https://github.com/sqlite/sqlite/raw/version-3.41.2/test/speedtest1.c" cd ~- \ No newline at end of file diff --git a/sqlite3/main.c b/sqlite3/main.c index 813d8e0..755e9e0 100644 --- a/sqlite3/main.c +++ b/sqlite3/main.c @@ -25,24 +25,11 @@ int main() { int rc = sqlite3_initialize(); if (rc != SQLITE_OK) return 1; - rc = sqlite3_auto_extension((void (*)(void))sqlite3_base_init); - if (rc != SQLITE_OK) return 1; - - rc = sqlite3_auto_extension((void (*)(void))sqlite3_decimal_init); - if (rc != SQLITE_OK) return 1; - - rc = sqlite3_auto_extension((void (*)(void))sqlite3_regexp_init); - if (rc != SQLITE_OK) return 1; - - rc = sqlite3_auto_extension((void (*)(void))sqlite3_series_init); - if (rc != SQLITE_OK) return 1; - - rc = sqlite3_auto_extension((void (*)(void))sqlite3_uint_init); - if (rc != SQLITE_OK) return 1; - - rc = sqlite3_auto_extension((void (*)(void))sqlite3_uuid_init); - if (rc != SQLITE_OK) return 1; - - rc = sqlite3_auto_extension((void (*)(void))sqlite3_time_init); - if (rc != SQLITE_OK) return 1; + sqlite3_auto_extension((void (*)(void))sqlite3_base_init); + sqlite3_auto_extension((void (*)(void))sqlite3_decimal_init); + sqlite3_auto_extension((void (*)(void))sqlite3_regexp_init); + sqlite3_auto_extension((void (*)(void))sqlite3_series_init); + sqlite3_auto_extension((void (*)(void))sqlite3_uint_init); + sqlite3_auto_extension((void (*)(void))sqlite3_uuid_init); + sqlite3_auto_extension((void (*)(void))sqlite3_time_init); } diff --git a/tests/mptest/testdata/build.sh b/tests/mptest/testdata/build.sh index ae6e9d1..292eca7 100755 --- a/tests/mptest/testdata/build.sh +++ b/tests/mptest/testdata/build.sh @@ -3,7 +3,7 @@ set -eo pipefail cd -P -- "$(dirname -- "$0")" -zig cc --target=wasm32-wasi -flto -g0 -Os \ +zig cc --target=wasm32-wasi -flto -g0 -O2 \ -o mptest.wasm main.c \ -I../../../sqlite3/ \ -mmutable-globals \ @@ -14,9 +14,4 @@ zig cc --target=wasm32-wasi -flto -g0 -Os \ -DSQLITE_DEFAULT_LOCKING_MODE=0 \ -DHAVE_USLEEP -DSQLITE_NO_SYNC \ -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION \ - -D_WASI_EMULATED_GETPID -lwasi-emulated-getpid - -if which wasm-opt; then - wasm-opt -g -O -o mptest.tmp mptest.wasm - mv mptest.tmp mptest.wasm -fi \ No newline at end of file + -D_WASI_EMULATED_GETPID -lwasi-emulated-getpid \ No newline at end of file diff --git a/tests/mptest/testdata/mptest.wasm b/tests/mptest/testdata/mptest.wasm old mode 100644 new mode 100755 index 0114f0a..8e0f152 --- a/tests/mptest/testdata/mptest.wasm +++ b/tests/mptest/testdata/mptest.wasm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:af307c3555fcf5f78e07a079d8f099400c3e013508f30f5efbe3b7f259be2092 -size 969309 +oid sha256:eaf30c1ff0cf5acc241c9f7c1ae4c71401ea2be1bd565d67ca913449ef81e542 +size 1630832 diff --git a/tests/speedtest1/testdata/build.sh b/tests/speedtest1/testdata/build.sh index 5daa5fc..8043a1f 100755 --- a/tests/speedtest1/testdata/build.sh +++ b/tests/speedtest1/testdata/build.sh @@ -3,15 +3,10 @@ set -eo pipefail cd -P -- "$(dirname -- "$0")" -zig cc --target=wasm32-wasi -flto -g0 -Os \ +zig cc --target=wasm32-wasi -flto -g0 -O2 \ -o speedtest1.wasm main.c \ -I../../../sqlite3/ \ -mmutable-globals \ -mbulk-memory -mreference-types \ -mnontrapping-fptoint -msign-ext \ - -D_HAVE_SQLITE_CONFIG_H - -if which wasm-opt; then - wasm-opt -g -O -o speedtest1.tmp speedtest1.wasm - mv speedtest1.tmp speedtest1.wasm -fi \ No newline at end of file + -D_HAVE_SQLITE_CONFIG_H \ No newline at end of file diff --git a/tests/speedtest1/testdata/speedtest1.wasm b/tests/speedtest1/testdata/speedtest1.wasm old mode 100644 new mode 100755 index 7440683..b29deb5 --- a/tests/speedtest1/testdata/speedtest1.wasm +++ b/tests/speedtest1/testdata/speedtest1.wasm @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2058b59b052ce9e3ed74c241f06122e8acfe0b5d4a18f36130e625b34eecd161 -size 1001469 +oid sha256:20619ab46d578da689d08c2e6b1d08b7d4919eb7de20f8220bf3a49014083c87 +size 1676135