Skip to content

Commit

Permalink
sqlite3: add options to enable/disable built-in extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
bgilbert authored and jpakkane committed Jan 4, 2025
1 parent 47c606e commit a960bb0
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 5 deletions.
37 changes: 32 additions & 5 deletions subprojects/packagefiles/sqlite3/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ sources = files('sqlite3.c')
sqlite_args = [
'-DSQLITE_ENABLE_COLUMN_METADATA',
'-DSQLITE_ENABLE_DBSTAT_VTAB',
'-DSQLITE_ENABLE_FTS3',
'-DSQLITE_ENABLE_FTS3_PARENTHESIS',
'-DSQLITE_ENABLE_FTS3_TOKENIZER',
'-DSQLITE_ENABLE_FTS4',
'-DSQLITE_ENABLE_FTS5',
'-DSQLITE_ENABLE_UNLOCK_NOTIFY',
'-DSQLITE_SECURE_DELETE',
]
Expand All @@ -35,6 +30,38 @@ if get_option('strict')
]
endif

extensions = [
['fts34', true, [
'-DSQLITE_ENABLE_FTS3',
'-DSQLITE_ENABLE_FTS3_PARENTHESIS',
'-DSQLITE_ENABLE_FTS3_TOKENIZER',
]],
['fts5', true, '-DSQLITE_ENABLE_FTS5'],
['geopoly', false, '-DSQLITE_ENABLE_GEOPOLY'],
['rbu', false, '-DSQLITE_ENABLE_RBU'],
['rtree', false, '-DSQLITE_ENABLE_RTREE'],
['session', false, [
'-DSQLITE_ENABLE_SESSION',
'-DSQLITE_ENABLE_PREUPDATE_HOOK'
]],
]
extension_default = get_option('all-extensions')
foreach extension : extensions
option = get_option(extension[0])
if option.auto()
if extension_default.auto()
enabled = extension[1]
else
enabled = extension_default.enabled()
endif
else
enabled = option.enabled()
endif
if enabled
sqlite_args += extension[2]
endif
endforeach

if host_machine.system() == 'windows'
if get_option('default_library') != 'static'
sqlite_args += ['-DSQLITE_API=__declspec(dllexport)']
Expand Down
44 changes: 44 additions & 0 deletions subprojects/packagefiles/sqlite3/meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,47 @@ option(
type: 'boolean',
value: true
)

# extensions
option(
'all-extensions',
description: 'Enable or disable all known extensions by default',
type: 'feature',
value: 'auto'
)
option(
'fts34',
description: 'Enable FTS3 and FTS4',
type: 'feature',
value: 'auto'
)
option(
'fts5',
description: 'Enable FTS5',
type: 'feature',
value: 'auto'
)
option(
'geopoly',
description: 'Enable Geopoly extension',
type: 'feature',
value: 'auto'
)
option(
'rbu',
description: 'Enable Resumable Bulk Update extension',
type: 'feature',
value: 'auto'
)
option(
'rtree',
description: 'Enable R*Tree index extension',
type: 'feature',
value: 'auto'
)
option(
'session',
description: 'Enable session extension',
type: 'feature',
value: 'auto'
)

0 comments on commit a960bb0

Please sign in to comment.