chore(track-d 5-6): scripts/build-sqlite-with-extensions.sh + fetch-sqlite-vec.sh skeletons
D-5/D-6 are documentation-as-code for environment work the user owns
(custom SQLite build + vec0 fetch). Both scripts capture the full
outline — the curl, the SHA256 verify, the codesign — but require the
user to pin versions and hashes before running. Until those TODOs are
filled, both scripts exit 1 with a clear message rather than
half-running.
D-5 (build-sqlite-with-extensions.sh):
- Captures the clang flags needed for SQLITE_ENABLE_LOAD_EXTENSION=1 +
FTS5 + RTREE + threadsafe=2.
- TODOs: SQLite version, amalgamation URL, SHA256, codesign identity.
- Output: build/sqlite/libsqlite3.dylib (codesigned, ad-hoc by default).
D-6 (fetch-sqlite-vec.sh):
- Pulls the prebuilt vec0.dylib from a pinned sqlite-vec GitHub release
tag, SHA256-verifies, drops into App/Resources/vec0.dylib, codesigns.
- TODOs: release tag, SHA256, codesign identity.
- Asset naming follows sqlite-vec-${VERSION}-loadable-macos-aarch64.tar.gz;
adjust if upstream renames.
Both scripts are mode 755 and verified to fail loudly when run as-is
(stamped TODO message + exit 1). No actual fetches or builds happen
until the user fills in the pins.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
1 parent
c3bd0a5728
commit
6e249eeb76
2 files changed
+137
No files matched your search
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
# Track-D D-5 — skeleton for building a custom libsqlite3.dylib with
|
||||
# SQLITE_ENABLE_LOAD_EXTENSION=1 so vec0.dylib can be loaded at runtime.
|
||||
#
|
||||
# WHY: macOS ships libsqlite3 with extension loading disabled. Memory's
|
||||
# vec0 search path needs SQLite to call sqlite3_load_extension(); the
|
||||
# system library will refuse. Build a vendored libsqlite3.dylib once,
|
||||
# codesign it with the team identity, and bundle under
|
||||
# App/Resources/sqlite/ so MemoryStore's connection initializer can
|
||||
# point SQLITE_LIBRARY_PATH at it.
|
||||
#
|
||||
# THIS IS A SKELETON. It will exit 1 with a clear message until the
|
||||
# user fills in the TODO markers below. The intent is to capture the
|
||||
# steps so the user can pick this up cleanly without re-deriving the
|
||||
# build commands.
|
||||
#
|
||||
# Output: ./build/sqlite/libsqlite3.dylib (codesigned, ad-hoc by default)
|
||||
#
|
||||
# Usage (after TODOs are filled):
|
||||
# bash scripts/build-sqlite-with-extensions.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# TODO: pin SQLite version. Last known-good is 3.45.x; check
|
||||
# https://www.sqlite.org/download.html for the current amalgamation URL.
|
||||
SQLITE_VERSION="" # e.g., 3450200
|
||||
SQLITE_AMALGAMATION_URL="" # e.g., https://www.sqlite.org/2024/sqlite-amalgamation-3450200.zip
|
||||
SQLITE_AMALGAMATION_SHA256="" # pin the SHA256 of the zip
|
||||
|
||||
# TODO: codesign identity. "-" = ad-hoc; for distribution use the
|
||||
# Developer ID Application cert. Per CLAUDE.md "codesign inside-out;
|
||||
# never --deep".
|
||||
CODESIGN_IDENTITY="-"
|
||||
|
||||
if [[ -z "$SQLITE_VERSION" || -z "$SQLITE_AMALGAMATION_URL" || -z "$SQLITE_AMALGAMATION_SHA256" ]]; then
|
||||
echo "[build-sqlite] TODO: fill in SQLITE_VERSION + SQLITE_AMALGAMATION_URL + SQLITE_AMALGAMATION_SHA256 at the top of this script."
|
||||
echo "[build-sqlite] See https://www.sqlite.org/download.html for the latest amalgamation."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- skeleton outline (commented; uncomment when TODOs filled) -------------
|
||||
#
|
||||
# WORK_DIR="build/sqlite"
|
||||
# mkdir -p "$WORK_DIR"
|
||||
# pushd "$WORK_DIR" >/dev/null
|
||||
#
|
||||
# curl -fsSL -o sqlite-amalgamation.zip "$SQLITE_AMALGAMATION_URL"
|
||||
# echo "$SQLITE_AMALGAMATION_SHA256 sqlite-amalgamation.zip" | shasum -a 256 -c -
|
||||
# unzip -q -o sqlite-amalgamation.zip
|
||||
# cd "sqlite-amalgamation-$SQLITE_VERSION"
|
||||
#
|
||||
# clang -O2 -dynamiclib \
|
||||
# -DSQLITE_ENABLE_LOAD_EXTENSION=1 \
|
||||
# -DSQLITE_ENABLE_FTS5=1 \
|
||||
# -DSQLITE_ENABLE_RTREE=1 \
|
||||
# -DSQLITE_THREADSAFE=2 \
|
||||
# -arch arm64 \
|
||||
# -install_name @rpath/libsqlite3.dylib \
|
||||
# -o ../libsqlite3.dylib \
|
||||
# sqlite3.c
|
||||
#
|
||||
# popd >/dev/null
|
||||
# codesign --force --sign "$CODESIGN_IDENTITY" --options runtime --timestamp=none \
|
||||
# "$WORK_DIR/libsqlite3.dylib"
|
||||
#
|
||||
# echo "[build-sqlite] OK: $WORK_DIR/libsqlite3.dylib"
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
echo "[build-sqlite] TODO: implement build steps (uncomment the outline above and tune flags as needed)."
|
||||
exit 1
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
# Track-D D-6 — skeleton for fetching the prebuilt vec0.dylib from
|
||||
# https://github.com/asg017/sqlite-vec/releases/latest, verifying the
|
||||
# SHA256, and dropping it into App/Resources/vec0.dylib so the bundled
|
||||
# libsqlite3 (D-5) can `sqlite3_load_extension()` it at runtime.
|
||||
#
|
||||
# THIS IS A SKELETON. It will exit 1 with a clear message until the
|
||||
# user fills in the TODO markers below. The intent is to capture the
|
||||
# steps so the user can pick this up cleanly without re-deriving the
|
||||
# fetch + verify + sign sequence.
|
||||
#
|
||||
# Output: App/Resources/vec0.dylib (codesigned)
|
||||
#
|
||||
# Usage (after TODOs are filled):
|
||||
# bash scripts/fetch-sqlite-vec.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# TODO: pin sqlite-vec release version. Latest as of writing: v0.1.6
|
||||
# (check https://github.com/asg017/sqlite-vec/releases). Pinning a tag
|
||||
# rather than tracking "latest" is intentional — the SHA256 below must
|
||||
# match this exact tag.
|
||||
SQLITE_VEC_VERSION="" # e.g., v0.1.6
|
||||
|
||||
# TODO: pin the SHA256 of the macOS arm64 .dylib for that release. Find
|
||||
# it from the release's checksums file or by running shasum on a fresh
|
||||
# download. Without a pinned hash this script silently trusts whatever
|
||||
# GitHub serves.
|
||||
SQLITE_VEC_SHA256=""
|
||||
|
||||
# TODO: codesign identity. "-" = ad-hoc; for distribution use the
|
||||
# Developer ID Application cert.
|
||||
CODESIGN_IDENTITY="-"
|
||||
|
||||
DEST="App/Resources/vec0.dylib"
|
||||
|
||||
if [[ -z "$SQLITE_VEC_VERSION" || -z "$SQLITE_VEC_SHA256" ]]; then
|
||||
echo "[fetch-sqlite-vec] TODO: fill in SQLITE_VEC_VERSION + SQLITE_VEC_SHA256 at the top of this script."
|
||||
echo "[fetch-sqlite-vec] Releases: https://github.com/asg017/sqlite-vec/releases"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- skeleton outline (commented; uncomment when TODOs filled) -------------
|
||||
#
|
||||
# # Asset naming: sqlite-vec-${VERSION}-loadable-macos-aarch64.tar.gz
|
||||
# # contains vec0.dylib at the root. Adjust if upstream renames.
|
||||
# ASSET_NAME="sqlite-vec-${SQLITE_VEC_VERSION#v}-loadable-macos-aarch64.tar.gz"
|
||||
# URL="https://github.com/asg017/sqlite-vec/releases/download/${SQLITE_VEC_VERSION}/${ASSET_NAME}"
|
||||
#
|
||||
# WORK_DIR="$(mktemp -d)"
|
||||
# trap 'rm -rf "$WORK_DIR"' EXIT
|
||||
#
|
||||
# curl -fsSL -o "$WORK_DIR/$ASSET_NAME" "$URL"
|
||||
# tar -xzf "$WORK_DIR/$ASSET_NAME" -C "$WORK_DIR"
|
||||
#
|
||||
# echo "$SQLITE_VEC_SHA256 $WORK_DIR/vec0.dylib" | shasum -a 256 -c -
|
||||
#
|
||||
# mkdir -p "$(dirname "$DEST")"
|
||||
# cp "$WORK_DIR/vec0.dylib" "$DEST"
|
||||
#
|
||||
# codesign --force --sign "$CODESIGN_IDENTITY" --options runtime --timestamp=none "$DEST"
|
||||
#
|
||||
# echo "[fetch-sqlite-vec] OK: $DEST"
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
echo "[fetch-sqlite-vec] TODO: implement fetch steps (uncomment the outline above and confirm the asset name for your tag)."
|
||||
exit 1
|
||||
Reference in new issue
Block a user