Dependencies.

This commit is contained in:
Nuno Cruces
2023-04-04 18:32:56 +01:00
parent c38382fd8e
commit 3a8cfd036d
7 changed files with 11 additions and 14 deletions

View File

@@ -3,7 +3,6 @@ set -eo pipefail
cd -P -- "$(dirname -- "$0")"
# build SQLite
zig cc --target=wasm32-wasi -flto -g0 -O2 \
-o sqlite3.wasm ../sqlite3/main.c \
-I../sqlite3/ \
@@ -12,4 +11,8 @@ zig cc --target=wasm32-wasi -flto -g0 -O2 \
-mnontrapping-fptoint -msign-ext \
-mexec-model=reactor \
-D_HAVE_SQLITE_CONFIG_H \
$(awk '{print "-Wl,--export="$0}' exports.txt)
$(awk '{print "-Wl,--export="$0}' exports.txt)
trap 'rm -f sqlite3.tmp' EXIT
wasm-ctor-eval -g -c _initialize sqlite3.wasm -o sqlite3.tmp
wasm-opt -g -O2 sqlite3.tmp -o sqlite3.wasm

Binary file not shown.

2
go.mod
View File

@@ -6,7 +6,7 @@ require (
github.com/ncruces/julianday v0.1.5
github.com/tetratelabs/wazero v1.0.1
golang.org/x/sync v0.1.0
golang.org/x/sys v0.6.0
golang.org/x/sys v0.7.0
)
retract v0.4.0 // tagged from the wrong branch

4
go.sum
View File

@@ -4,5 +4,5 @@ github.com/tetratelabs/wazero v1.0.1 h1:xyWBoGyMjYekG3mEQ/W7xm9E05S89kJ/at696d/9
github.com/tetratelabs/wazero v1.0.1/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=

View File

@@ -40,7 +40,7 @@ func instantiateModule() (*module, error) {
return nil, sqlite3.err
}
cfg := wazero.NewModuleConfig().WithStartFunctions("_initialize")
cfg := wazero.NewModuleConfig()
mod, err := sqlite3.runtime.InstantiateModule(ctx, sqlite3.compiled, cfg)
if err != nil {

View File

@@ -21,7 +21,7 @@ int sqlite3_os_init() {
return sqlite3_vfs_register(os_vfs(), /*default=*/true);
}
__attribute__((constructor)) void premain() {
__attribute__((constructor)) void init() {
sqlite3_initialize();
sqlite3_auto_extension((void (*)(void))sqlite3_base_init);
sqlite3_auto_extension((void (*)(void))sqlite3_decimal_init);

View File

@@ -29,7 +29,7 @@
#define SQLITE_USE_ALLOCA
// Because WASM does not support shared memory,
// SQLite disables it for WASM builds.
// SQLite disables WAL for WASM builds.
// We set the default locking mode to EXCLUSIVE instead.
// https://www.sqlite.org/wal.html#noshm
#undef SQLITE_OMIT_WAL
@@ -48,15 +48,9 @@
#define SQLITE_ENABLE_RTREE 1
#define SQLITE_ENABLE_GEOPOLY 1
// Snapshot
// #define SQLITE_ENABLE_SNAPSHOT 1
// Session Extension
// #define SQLITE_ENABLE_SESSION 1
// #define SQLITE_ENABLE_PREUPDATE_HOOK 1
// Resumable Bulk Update Extension
// #define SQLITE_ENABLE_RBU 1
// Implemented in Go.
int localtime_s(struct tm *const pTm, time_t const *const pTime);