sqlite is part of the program: #import c unit replaces the Makefile cc build

src/db/sqlite.sx declares the vendored amalgamation as a named
'#import c' unit (pinned defines + -O2 + #source); every #foreign
binding resolves against it with UNPREFIXED sqlite3_* names. sx
compiles the unit through its content-addressed object cache — once
per checkout — links the objects into 'sx build' binaries, and loads
them as a priority symbol target under 'sx run', so the OS libsqlite3
can never shadow the vendored copy (the version pin in sqlite_smoke
proves it).

Retired: the Makefile vendor targets (cc -> .a + jit/.dylib), the
GENERATED dist_sqlite3_* rename.h (the JIT no longer resolves
program-owned symbols through the process images, so the rename's
reason is gone), and the -L plumbing in make build + tests/run.sh.
make test 22/22; otool -L build/dist carries no libsqlite3.
This commit is contained in:
agra
2026-06-12 17:27:21 +03:00
parent a1f13c4356
commit 06f99b3606
6 changed files with 154 additions and 172 deletions

View File

@@ -8,15 +8,14 @@
#
# Locate the compiler via SX (overridable); defaults to the sibling sx repo.
#
# `-L build/vendor/jit` lets the JIT dlopen the VENDORED libsqlite3.dylib
# (built by `make build`) instead of falling back to the OS copy — the
# version assert in tests/sqlite_smoke.sx depends on it.
# The vendored SQLite needs no flags here: src/db/sqlite.sx declares it
# as a `#import c` unit, so `sx run` compiles (cached) and loads it as a
# priority symbol target — the version assert in tests/sqlite_smoke.sx
# proves the OS copy never shadows it.
set -u
SX="${SX:-/Users/agra/projects/sx/zig-out/bin/sx}"
TESTS_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
REPO_DIR=$(CDPATH= cd -- "$TESTS_DIR/.." && pwd)
SX_RUN_FLAGS="-L $REPO_DIR/build/vendor/jit"
pass=0
fail=0
@@ -26,7 +25,7 @@ fail=0
# pass/fail counters survive).
for t in $(find "$TESTS_DIR" -name '*.sx' -type f | sort); do
name=${t#"$TESTS_DIR"/}
if "$SX" run "$t" $SX_RUN_FLAGS >/dev/null 2>&1; then
if "$SX" run "$t" >/dev/null 2>&1; then
printf ' %-44s ok\n' "$name"
pass=$((pass + 1))
else