Vendor custom SQLite build with tamerye enabled #93
Notifications
Due Date
No due date set.
Blocks
#23 word search: fuzzy kana search
mugiten/jadb
Reference: mugiten/jadb#93
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Needed for #23
See usage: https://ytyaru.hatenablog.com/entry/2021/03/09/000000
Note that we'll need to crossbuild it for android and bundle it with mugiten as well.
It would be nice if this could be done in a way so that interactively running
flutter runin the devshell just worksWe can use
pkgs.pkgsCross.aarch64-android.sqliteTurns out that the builtin ICU won't do it, as mentioned in ytyaru's article
LIKEdoes not work across the kana boundary.Consider building https://hg.sr.ht/~cwt/fts5-icu-tokenizer
See also chapter 6 about static linkage: https://sqlite.org/loadext.html
I built https://hg.sr.ht/~cwt/fts5-icu-tokenizer and did some interactive testing, but it seemingly only helps with word splitting - not kana transliteration 🫤
Vendor custom SQLite build with ICU extension enabledto Vendor custom SQLite build with tamerye enabledIt doesn't seem like it will be any easy to vendor a fully custom built static sqlite with tamerye embedded until android cross compilation is fixed in nixpkgs. However, until then, we could use the natively compiled counterpart for building jadb, and use a dynamically loaded extension in the app. How bout that?
See also: https://github.com/tekartik/sqflite/issues/1149
The relevant branch for jadb just works now, hijacking this issue for figuring out how to embed a custom sqlite into mugiten.
There seems to be a split between mobile platforms + mac vs everything else, where the previous have 1st grade support and prebuilt binaries that will be baked into the app by
sqfliteitself, while the other ones depend on thesqflite_common_ffipackage. The ffi package earlier used something calledsqlite3_flutter_libs, but after dart 3.10.0 we use thesqlite3package instead.The sqlite3 is an early adopter of dart hooks, which lets you customize the build. However, it seems like the options available assume that you want to either use the hook to compile a new version from an amalgamation, or find a system version of sqlite3 via dlopen, dynamic linking or static linking. I don't think the two last options are an alternative with APK an java bytecode, but maybe we can somehow teach dlopen a full path to a sqlite.so packed out from the assets?
For now, it might also be possible to do a custom compile with the flags required to enable extension loading, and just bundle the extension in assets and pack it out before opening the sqlite database, so we can instantly load the extension.
https://github.com/tekartik/sqflite/blob/master/sqflite_common_ffi/doc/using_ffi_instead_of_sqflite.md
https://github.com/tekartik/sqflite/blob/master/sqflite/doc/qa.md#cross-platform-support
https://github.com/simolus3/sqlite3.dart
https://github.com/simolus3/sqlite3.dart/tree/main/sqlite3
https://github.com/simolus3/sqlite3.dart/blob/main/sqlite3/doc/hook.md
https://github.com/simolus3/sqlite3.dart/blob/main/sqlite3/doc/hook.md#default-binaries claims that the binaries are compiled without setting
SQLITE_OMIT_LOAD_EXTENSION, maybe loading the extension already from assets already just works?https://github.com/sqliteai/sqlite-extensions-guide
👀
https://github.com/simolus3/sqlite3.dart/blob/main/sqlite3/example/custom_extension/README.md
🎉🎉🎉