Skip to content

Commit 323bd6e

Browse files
committed
Tweak options early.
1 parent 5f1c372 commit 323bd6e

File tree

5 files changed

+46
-43
lines changed

5 files changed

+46
-43
lines changed

embed/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ WASI_SDK="$ROOT/tools/wasi-sdk-22.0/bin"
2020
-Wl,--stack-first \
2121
-Wl,--import-undefined \
2222
-D_HAVE_SQLITE_CONFIG_H \
23+
-DSQLITE_CUSTOM_INCLUDE=sqlite_opt.h \
2324
$(awk '{print "-Wl,--export="$0}' exports.txt)
2425

2526
trap 'rm -f sqlite3.tmp' EXIT

sqlite3/sqlite_cfg.h

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -33,52 +33,10 @@
3333
#define HAVE_MALLOC_H 1
3434
#define HAVE_MALLOC_USABLE_SIZE 1
3535

36-
// Recommended Options
37-
38-
#define SQLITE_DQS 0
39-
#define SQLITE_THREADSAFE 0
40-
#define SQLITE_DEFAULT_MEMSTATUS 0
41-
#define SQLITE_DEFAULT_WAL_SYNCHRONOUS 1
42-
#define SQLITE_LIKE_DOESNT_MATCH_BLOBS
43-
#define SQLITE_MAX_EXPR_DEPTH 0
44-
#define SQLITE_STRICT_SUBTYPE 1
45-
#define SQLITE_USE_ALLOCA
46-
#define SQLITE_OMIT_DEPRECATED
47-
#define SQLITE_OMIT_SHARED_CACHE
48-
#define SQLITE_OMIT_AUTOINIT
49-
// #define SQLITE_OMIT_DECLTYPE
50-
// #define SQLITE_OMIT_PROGRESS_CALLBACK
51-
52-
// Other Options
53-
54-
#define SQLITE_ALLOW_URI_AUTHORITY
55-
#define SQLITE_TRUSTED_SCHEMA 0
56-
#define SQLITE_DEFAULT_FOREIGN_KEYS 1
57-
#define SQLITE_ENABLE_ATOMIC_WRITE
58-
#define SQLITE_ENABLE_BATCH_ATOMIC_WRITE
59-
6036
// Because Wasm does not support shared memory,
6137
// SQLite disables WAL for Wasm builds.
62-
// We patch SQLite to use exclusive locking mode instead.
63-
// https://sqlite.org/wal.html#noshm
38+
// But we want it.
6439
#undef SQLITE_OMIT_WAL
6540

66-
// We have our own memdb VFS.
67-
// To avoid interactions between the two,
68-
// omit sqlite3_serialize/sqlite3_deserialize,
69-
// which we also don't wrap.
70-
#define SQLITE_OMIT_DESERIALIZE
71-
72-
// Amalgamated Extensions
73-
74-
#define SQLITE_ENABLE_MATH_FUNCTIONS 1
75-
#define SQLITE_ENABLE_JSON1 1
76-
#define SQLITE_ENABLE_FTS5 1
77-
#define SQLITE_ENABLE_RTREE 1
78-
#define SQLITE_ENABLE_GEOPOLY 1
79-
80-
#define SQLITE_SOUNDEX
81-
#define SQLITE_UNTESTABLE
82-
8341
// Implemented in vfs.c.
8442
int localtime_s(struct tm *const pTm, time_t const *const pTime);

sqlite3/sqlite_opt.h

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Recommended Options
2+
3+
#define SQLITE_DQS 0
4+
#define SQLITE_THREADSAFE 0
5+
#define SQLITE_DEFAULT_MEMSTATUS 0
6+
#define SQLITE_DEFAULT_WAL_SYNCHRONOUS 1
7+
#define SQLITE_LIKE_DOESNT_MATCH_BLOBS
8+
#define SQLITE_MAX_EXPR_DEPTH 0
9+
#define SQLITE_STRICT_SUBTYPE 1
10+
#define SQLITE_USE_ALLOCA
11+
#define SQLITE_OMIT_DEPRECATED
12+
#define SQLITE_OMIT_SHARED_CACHE
13+
#define SQLITE_OMIT_AUTOINIT
14+
15+
// We need these:
16+
// #define SQLITE_OMIT_DECLTYPE
17+
// #define SQLITE_OMIT_PROGRESS_CALLBACK
18+
19+
// Other Options
20+
21+
#define SQLITE_ALLOW_URI_AUTHORITY
22+
#define SQLITE_TRUSTED_SCHEMA 0
23+
#define SQLITE_DEFAULT_FOREIGN_KEYS 1
24+
#define SQLITE_ENABLE_ATOMIC_WRITE
25+
#define SQLITE_ENABLE_BATCH_ATOMIC_WRITE
26+
27+
// We have our own memdb VFS.
28+
// To avoid interactions between the two,
29+
// omit sqlite3_serialize/sqlite3_deserialize,
30+
// which we also don't wrap.
31+
#define SQLITE_OMIT_DESERIALIZE
32+
33+
// Amalgamated Extensions
34+
35+
#define SQLITE_ENABLE_MATH_FUNCTIONS 1
36+
#define SQLITE_ENABLE_JSON1 1
37+
#define SQLITE_ENABLE_FTS5 1
38+
#define SQLITE_ENABLE_RTREE 1
39+
#define SQLITE_ENABLE_GEOPOLY 1
40+
41+
#define SQLITE_SOUNDEX
42+
#define SQLITE_UNTESTABLE

vfs/tests/mptest/testdata/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ WASI_SDK="$ROOT/tools/wasi-sdk-22.0/bin"
2121
-DSQLITE_DEFAULT_LOCKING_MODE=0 \
2222
-DSQLITE_NO_SYNC -DSQLITE_THREADSAFE=0 \
2323
-DSQLITE_OMIT_LOAD_EXTENSION -DHAVE_USLEEP \
24+
-DSQLITE_CUSTOM_INCLUDE=sqlite_opt.h \
2425
-D_WASI_EMULATED_GETPID -lwasi-emulated-getpid \
2526
$(awk '{print "-Wl,--export="$0}' exports.txt)
2627

vfs/tests/speedtest1/testdata/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ WASI_SDK="$ROOT/tools/wasi-sdk-22.0/bin"
1717
-Wl,--stack-first \
1818
-Wl,--import-undefined \
1919
-D_HAVE_SQLITE_CONFIG_H -DSQLITE_USE_URI \
20+
-DSQLITE_CUSTOM_INCLUDE=sqlite_opt.h \
2021
$(awk '{print "-Wl,--export="$0}' exports.txt)
2122

2223
"$BINARYEN/wasm-opt" -g --strip --strip-producers -c -O3 \

0 commit comments

Comments
 (0)