Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds the ability to enable SQLite features (at this point only
fts5
) via build system options and in doing so allows customising SQLite features without resorting to vendoring (as per https://github.com/vrischmann/zig-sqlite?tab=readme-ov-file#using-the-bundled-sqlite-source-code-file).This means for example you can take the example of installation via the official package manager (https://github.com/vrischmann/zig-sqlite?tab=readme-ov-file#official-package-manager) and simply add, e.g.,
.fts5 = true
to the options to enable full text search:A
EnableOptions
struct
is added enumerating boolean options and instead of a static array with only-std=c99
as an option, we make the flags anArrayList
with the same initial content but use a comptimeinline for
to iterate over each field ofEnableOptions
to create ab.option
and add to theflags
ArrayList
when the given flag has been enabled. As reference this is the approach taken in https://github.com/mitchellh/zig-build-libxml2/blob/main/build.zig.As it stands this PR makes it easy to any
SQLITE_ENABLE_*
options by adding to theEnableOptions
struct
. This could be expanded to handle other options and indeed non-boolean options.Also updates
std.rand
->std.Random
as introduced in recent zigmaster
.