2022-01-15 17:35:30 +08:00
|
|
|
#!/bin/sh -e
|
2020-04-15 07:22:35 +08:00
|
|
|
|
2022-01-15 17:35:30 +08:00
|
|
|
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
2020-04-15 07:22:35 +08:00
|
|
|
echo "$SCRIPT_DIR"
|
2021-06-03 03:07:56 +08:00
|
|
|
cd "$SCRIPT_DIR" || { echo "fatal error" >&2; exit 1; }
|
|
|
|
cargo clean
|
2021-11-28 18:09:37 +08:00
|
|
|
mkdir -p "$SCRIPT_DIR/../target" "$SCRIPT_DIR/sqlite3"
|
2021-06-03 03:07:56 +08:00
|
|
|
export SQLITE3_LIB_DIR="$SCRIPT_DIR/sqlite3"
|
|
|
|
export SQLITE3_INCLUDE_DIR="$SQLITE3_LIB_DIR"
|
2018-02-10 18:04:02 +08:00
|
|
|
|
|
|
|
# Download and extract amalgamation
|
2023-05-31 16:30:58 +08:00
|
|
|
SQLITE=sqlite-amalgamation-3420000
|
2023-02-25 02:40:34 +08:00
|
|
|
curl -O https://sqlite.org/2023/$SQLITE.zip
|
2020-04-15 07:22:35 +08:00
|
|
|
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.c" > "$SQLITE3_LIB_DIR/sqlite3.c"
|
|
|
|
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.h" > "$SQLITE3_LIB_DIR/sqlite3.h"
|
|
|
|
unzip -p "$SQLITE.zip" "$SQLITE/sqlite3ext.h" > "$SQLITE3_LIB_DIR/sqlite3ext.h"
|
|
|
|
rm -f "$SQLITE.zip"
|
2018-02-10 18:04:02 +08:00
|
|
|
|
2021-06-03 03:07:56 +08:00
|
|
|
# Regenerate bindgen file for sqlite3
|
2020-04-15 07:22:35 +08:00
|
|
|
rm -f "$SQLITE3_LIB_DIR/bindgen_bundled_version.rs"
|
2018-02-10 18:04:02 +08:00
|
|
|
cargo update
|
2018-03-24 10:48:09 +08:00
|
|
|
# Just to make sure there is only one bindgen.rs file in target dir
|
2020-04-15 07:22:35 +08:00
|
|
|
find "$SCRIPT_DIR/../target" -type f -name bindgen.rs -exec rm {} \;
|
2021-07-03 07:48:18 +08:00
|
|
|
env LIBSQLITE3_SYS_BUNDLING=1 cargo build --features "buildtime_bindgen session" --no-default-features
|
2021-06-03 03:07:56 +08:00
|
|
|
find "$SCRIPT_DIR/../target" -type f -name bindgen.rs -exec mv {} "$SQLITE3_LIB_DIR/bindgen_bundled_version.rs" \;
|
|
|
|
|
|
|
|
# Sanity checks
|
|
|
|
cd "$SCRIPT_DIR/.." || { echo "fatal error" >&2; exit 1; }
|
2018-02-10 18:04:02 +08:00
|
|
|
cargo update
|
2018-12-15 17:51:02 +08:00
|
|
|
cargo test --features "backup blob chrono functions limits load_extension serde_json trace vtab bundled"
|
2021-06-03 03:07:56 +08:00
|
|
|
printf ' \e[35;1mFinished\e[0m bundled sqlite3 tests\n'
|