Joel Galenson | 610a751 | 2020-07-28 13:41:38 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | SCRIPT_DIR=$(cd "$(dirname "$_")" && pwd) |
| 4 | echo "$SCRIPT_DIR" |
| 5 | cd "$SCRIPT_DIR" || { echo "fatal error"; exit 1; } |
| 6 | export SQLITE3_LIB_DIR=$SCRIPT_DIR/sqlite3 |
| 7 | |
| 8 | # Download and extract amalgamation |
Joel Galenson | 7837fda | 2021-05-19 15:53:50 -0700 | [diff] [blame] | 9 | SQLITE=sqlite-amalgamation-3350400 |
| 10 | curl -O https://sqlite.org/2021/$SQLITE.zip |
Joel Galenson | 610a751 | 2020-07-28 13:41:38 -0700 | [diff] [blame] | 11 | unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.c" > "$SQLITE3_LIB_DIR/sqlite3.c" |
| 12 | unzip -p "$SQLITE.zip" "$SQLITE/sqlite3.h" > "$SQLITE3_LIB_DIR/sqlite3.h" |
| 13 | unzip -p "$SQLITE.zip" "$SQLITE/sqlite3ext.h" > "$SQLITE3_LIB_DIR/sqlite3ext.h" |
| 14 | rm -f "$SQLITE.zip" |
| 15 | |
| 16 | # Regenerate bindgen file |
| 17 | rm -f "$SQLITE3_LIB_DIR/bindgen_bundled_version.rs" |
| 18 | export SQLITE3_INCLUDE_DIR=$SQLITE3_LIB_DIR |
| 19 | cargo update |
| 20 | # Just to make sure there is only one bindgen.rs file in target dir |
| 21 | find "$SCRIPT_DIR/../target" -type f -name bindgen.rs -exec rm {} \; |
| 22 | env LIBSQLITE3_SYS_BUNDLING=1 cargo build --features "buildtime_bindgen" --no-default-features |
| 23 | find "$SCRIPT_DIR/../target" -type f -name bindgen.rs -exec cp {} "$SQLITE3_LIB_DIR/bindgen_bundled_version.rs" \; |
| 24 | # Sanity check |
| 25 | cd "$SCRIPT_DIR/.." || { echo "fatal error"; exit 1; } |
| 26 | cargo update |
| 27 | cargo test --features "backup blob chrono functions limits load_extension serde_json trace vtab bundled" |
| 28 | echo 'You should increment the version in libsqlite3-sys/Cargo.toml' |