mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
SQLite 3.41.2, prefer speed over size.
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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
|
||||
$(awk '{print "-Wl,--export="$0}' exports.txt)
|
||||
BIN
embed/sqlite3.wasm
Normal file → Executable file
BIN
embed/sqlite3.wasm
Normal file → Executable file
Binary file not shown.
@@ -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 ~-
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
9
tests/mptest/testdata/build.sh
vendored
9
tests/mptest/testdata/build.sh
vendored
@@ -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
|
||||
-D_WASI_EMULATED_GETPID -lwasi-emulated-getpid
|
||||
4
tests/mptest/testdata/mptest.wasm
vendored
Normal file → Executable file
4
tests/mptest/testdata/mptest.wasm
vendored
Normal file → Executable file
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:af307c3555fcf5f78e07a079d8f099400c3e013508f30f5efbe3b7f259be2092
|
||||
size 969309
|
||||
oid sha256:eaf30c1ff0cf5acc241c9f7c1ae4c71401ea2be1bd565d67ca913449ef81e542
|
||||
size 1630832
|
||||
|
||||
9
tests/speedtest1/testdata/build.sh
vendored
9
tests/speedtest1/testdata/build.sh
vendored
@@ -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
|
||||
-D_HAVE_SQLITE_CONFIG_H
|
||||
4
tests/speedtest1/testdata/speedtest1.wasm
vendored
Normal file → Executable file
4
tests/speedtest1/testdata/speedtest1.wasm
vendored
Normal file → Executable file
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2058b59b052ce9e3ed74c241f06122e8acfe0b5d4a18f36130e625b34eecd161
|
||||
size 1001469
|
||||
oid sha256:20619ab46d578da689d08c2e6b1d08b7d4919eb7de20f8220bf3a49014083c87
|
||||
size 1676135
|
||||
|
||||
Reference in New Issue
Block a user