Skip to content

Commit e749655

Browse files
committed
hooks: Document custom SQLite builds
1 parent 4203291 commit e749655

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

sqlite3/doc/hook.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,36 @@ These options behave as follows:
8686

8787
## Custom SQLite builds
8888

89-
Custom SQLite builds are not currently supported, but will be in a future version of this package.
89+
If you want to customize the SQLite build to use with `package:sqlite3`, you can
90+
also use user defines for that.
91+
92+
First, download the `sqlite3.c` file you want to use into your workspace. Then,
93+
add this section to your pubspec:
94+
95+
```yaml
96+
hooks:
97+
user_defines:
98+
sqlite3:
99+
source: source
100+
path: path/to/sqlite3.c # relative to your workspace root
101+
defines: # optional
102+
default_options: false # optional, to disable default compile-time options used by package:sqlite3
103+
defines:
104+
- SQLITE_THREADSAFE=1
105+
- SQLITE_LIKE_DOESNT_MATCH_BLOBS
106+
```
107+
108+
### Alternatives
109+
110+
Using the `source` mode to compile SQLite from sources in build hook can't
111+
cover all customization needs you may have. When building SQLCipher for
112+
instance, you may want to pass custom linker options to the build process.
113+
114+
There is no good way to support arbitrary customization in build hooks today.
115+
However, `package:sqlite3` will work with all SQLite builds that are ABI-compatible
116+
with standard SQLite (it also runs checks at runtime before using methods that
117+
are not commonly enabled on all builds).
118+
If you control the build process of your application, you can use an external
119+
build system (like SwiftPM or CMake) to statically link SQLite into your application.
120+
Then, use `source: executable` to make `package:sqlite3` use that copy instead
121+
of building its own.

0 commit comments

Comments
 (0)