2020-04-15 07:22:35 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-02-10 18:04:02 +08:00
|
|
|
SCRIPT_DIR=$(cd "$(dirname "$_")" && pwd)
|
2020-04-15 07:22:35 +08:00
|
|
|
echo "$SCRIPT_DIR"
|
|
|
|
cd "$SCRIPT_DIR" || { echo "fatal error"; exit 1; }
|
2018-09-18 00:42:19 +08:00
|
|
|
export SQLITE3_LIB_DIR=$SCRIPT_DIR/sqlite3
|
2018-02-10 18:04:02 +08:00
|
|
|
|
|
|
|
# Download and extract amalgamation
|
2020-04-10 20:32:46 +08:00
|
|
|
SQLITE=sqlite-amalgamation-3310100
|
2020-01-27 03:44:03 +08:00
|
|
|
curl -O https://sqlite.org/2020/$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
|
|
|
|
|
|
|
# Regenerate bindgen file
|
2020-04-15 07:22:35 +08:00
|
|
|
rm -f "$SQLITE3_LIB_DIR/bindgen_bundled_version.rs"
|
2018-09-18 00:42:19 +08:00
|
|
|
export SQLITE3_INCLUDE_DIR=$SQLITE3_LIB_DIR
|
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 {} \;
|
2020-04-10 16:38:55 +08:00
|
|
|
env LIBSQLITE3_SYS_BUNDLING=1 cargo build --features "buildtime_bindgen" --no-default-features
|
2020-04-15 07:22:35 +08:00
|
|
|
find "$SCRIPT_DIR/../target" -type f -name bindgen.rs -exec cp {} "$SQLITE3_LIB_DIR/bindgen_bundled_version.rs" \;
|
2018-02-10 18:04:02 +08:00
|
|
|
# Sanity check
|
2020-04-15 07:22:35 +08:00
|
|
|
cd "$SCRIPT_DIR/.." || { echo "fatal error"; 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"
|
2018-02-10 18:04:02 +08:00
|
|
|
echo 'You should increment the version in libsqlite3-sys/Cargo.toml'
|