|
| 1 | +#!/bin/sh |
| 2 | +# Regenerate the bundled SQLite amalgamation and Rust bindings used by |
| 3 | +# libsql-ffi from the libsql-sqlite3 source tree. |
| 4 | +# |
| 5 | +# Outputs (relative to libsql-ffi/): |
| 6 | +# bundled/src/sqlite3.c |
| 7 | +# bundled/src/sqlite3.h |
| 8 | +# bundled/bindings/bindgen.rs |
| 9 | +# bundled/bindings/session_bindgen.rs |
| 10 | +# bundled/SQLite3MultipleCiphers/src/sqlite3.c |
| 11 | +# bundled/SQLite3MultipleCiphers/src/sqlite3.h |
| 12 | +# |
| 13 | +# The CI job in .github/workflows/c-bindings.yml validates the bundle by |
| 14 | +# running `cargo xtask build-bundled` and failing if it produces any diff. |
| 15 | +# That xtask only regenerates the C amalgamation (and copies it into both |
| 16 | +# bundled/src/ and bundled/SQLite3MultipleCiphers/src/); it does NOT |
| 17 | +# regenerate the bindgen files. So we do both here: |
| 18 | +# |
| 19 | +# 1. The LIBSQL_DEV builds regenerate the Rust bindings (bindgen.rs / |
| 20 | +# session_bindgen.rs) via build.rs. |
| 21 | +# 2. `cargo xtask build-bundled` produces the canonical sqlite3.{c,h} in |
| 22 | +# both bundled locations, byte-for-byte matching what CI checks. |
| 23 | +# |
| 24 | +# Run xtask last so the committed sqlite3.{c,h} are exactly the CI output. |
| 25 | + |
| 26 | +set -eux |
| 27 | + |
| 28 | +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" |
| 29 | + |
| 30 | +# Step 1: regenerate the Rust bindings. |
| 31 | +cd "$REPO_ROOT/libsql-ffi" |
| 32 | +LIBSQL_DEV=1 cargo build |
| 33 | +LIBSQL_DEV=1 cargo build --features session |
| 34 | +LIBSQL_DEV=1 cargo build --features multiple-ciphers |
| 35 | +LIBSQL_DEV=1 cargo build --features session,multiple-ciphers |
| 36 | + |
| 37 | +# Step 2: regenerate the C amalgamation in both bundled locations using the |
| 38 | +# exact command CI validates against. |
| 39 | +cd "$REPO_ROOT" |
| 40 | +cargo xtask build-bundled |
0 commit comments