Commit a33f852
committed
bazel/sqlite3: link mattn/go-sqlite3 against the shared libsqlite3
Stop compiling the bundled SQLite amalgamation that ships with
github.com/mattn/go-sqlite3 and link the binding against //deps:sqlite3
instead. Removes one full SQLite C compile from every build, keeps a single
.so in the runtime artifacts (already shared by cpython, rpm, openscap).
- .bazelrc: enable the libsqlite3 Go build tag globally so
sqlite3_libsqlite3.go compiles and defines USE_LIBSQLITE3, which makes
the bundled sqlite3-binding.c a no-op TU and switches the cgo preamble
to #include <sqlite3.h>.
- deps/go.MODULE.bazel: add a gazelle_override on github.com/mattn/go-sqlite3
that (a) passes -build_tags=libsqlite3 so Gazelle picks the right sources
in srcs, and (b) maps go_library to the go_sqlite3_library wrapper added
in the previous commit, which injects cgo = True and the libsqlite3_dynamic
cdep so #include <sqlite3.h> and -lsqlite3 resolve against //deps:sqlite3.
Verified by building //pkg/security/resolvers/sbom/collectorv2:collectorv2_test
and confirming via ldd that the binary dynamically links against the
@sqlite3//:sqlite3 shared library (single agent-owned libsqlite3.so) and
go-sqlite3's GoCompilePkg runs in ~0s (no amalgamation recompile).1 parent 953ab4a commit a33f852
2 files changed
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
56 | 70 | | |
57 | 71 | | |
58 | 72 | | |
| |||
0 commit comments