mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 11:31:37 +08:00
Split upgrade script
Such as we can upgrade SQLite / SQLCipher without regenerating SQLCipher / SQLite files
This commit is contained in:
parent
c5b96241f1
commit
4ec670edeb
@ -5,11 +5,9 @@ CUR_DIR=$(pwd -P)
|
||||
echo "$SCRIPT_DIR"
|
||||
cd "$SCRIPT_DIR" || { echo "fatal error" >&2; exit 1; }
|
||||
cargo clean
|
||||
mkdir -p "$SCRIPT_DIR/../target" "$SCRIPT_DIR/sqlite3" "$SCRIPT_DIR/sqlcipher"
|
||||
mkdir -p "$SCRIPT_DIR/../target" "$SCRIPT_DIR/sqlite3"
|
||||
export SQLITE3_LIB_DIR="$SCRIPT_DIR/sqlite3"
|
||||
export SQLITE3_INCLUDE_DIR="$SQLITE3_LIB_DIR"
|
||||
export SQLCIPHER_LIB_DIR="$SCRIPT_DIR/sqlcipher"
|
||||
export SQLCIPHER_INCLUDE_DIR="$SQLCIPHER_LIB_DIR"
|
||||
|
||||
# Download and extract amalgamation
|
||||
SQLITE=sqlite-amalgamation-3370000
|
||||
@ -27,31 +25,8 @@ find "$SCRIPT_DIR/../target" -type f -name bindgen.rs -exec rm {} \;
|
||||
env LIBSQLITE3_SYS_BUNDLING=1 cargo build --features "buildtime_bindgen session" --no-default-features
|
||||
find "$SCRIPT_DIR/../target" -type f -name bindgen.rs -exec mv {} "$SQLITE3_LIB_DIR/bindgen_bundled_version.rs" \;
|
||||
|
||||
SQLCIPHER_VERSION="4.4.3"
|
||||
# Download and generate sqlcipher amalgamation
|
||||
mkdir -p $SCRIPT_DIR/sqlcipher.src
|
||||
[ -e "v${SQLCIPHER_VERSION}.tar.gz" ] || curl -sfL -O "https://github.com/sqlcipher/sqlcipher/archive/v${SQLCIPHER_VERSION}.tar.gz"
|
||||
tar xzf "v${SQLCIPHER_VERSION}.tar.gz" --strip-components=1 -C "$SCRIPT_DIR/sqlcipher.src"
|
||||
cd "$SCRIPT_DIR/sqlcipher.src"
|
||||
./configure --with-crypto-lib=none
|
||||
make sqlite3.c
|
||||
cp sqlite3.c sqlite3.h sqlite3ext.h "$SCRIPT_DIR/sqlcipher/"
|
||||
cd "$SCRIPT_DIR"
|
||||
rm -rf "v${SQLCIPHER_VERSION}.tar.gz" sqlcipher.src
|
||||
|
||||
# Regenerate bindgen file for sqlcipher
|
||||
rm -f "$SQLCIPHER_LIB_DIR/bindgen_bundled_version.rs"
|
||||
|
||||
# cargo update
|
||||
find "$SCRIPT_DIR/../target" -type f -name bindgen.rs -exec rm {} \;
|
||||
env LIBSQLITE3_SYS_BUNDLING=1 cargo build --features "sqlcipher buildtime_bindgen session"
|
||||
find "$SCRIPT_DIR/../target" -type f -name bindgen.rs -exec mv {} "$SQLCIPHER_LIB_DIR/bindgen_bundled_version.rs" \;
|
||||
|
||||
# Sanity checks
|
||||
cd "$SCRIPT_DIR/.." || { echo "fatal error" >&2; exit 1; }
|
||||
cargo update
|
||||
cargo test --features "backup blob chrono functions limits load_extension serde_json trace vtab bundled"
|
||||
printf ' \e[35;1mFinished\e[0m bundled sqlite3 tests\n'
|
||||
cargo test --features "backup blob chrono functions limits load_extension serde_json trace vtab bundled-sqlcipher-vendored-openssl"
|
||||
printf ' \e[35;1mFinished\e[0m bundled-sqlcipher-vendored-openssl/sqlcipher tests\n'
|
||||
echo 'You should increment the version in libsqlite3-sys/Cargo.toml'
|
||||
|
36
libsqlite3-sys/upgrade_sqlcipher.sh
Executable file
36
libsqlite3-sys/upgrade_sqlcipher.sh
Executable file
@ -0,0 +1,36 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
SCRIPT_DIR=$(cd "$(dirname "$_")" && pwd)
|
||||
CUR_DIR=$(pwd -P)
|
||||
echo "$SCRIPT_DIR"
|
||||
cd "$SCRIPT_DIR" || { echo "fatal error" >&2; exit 1; }
|
||||
cargo clean
|
||||
mkdir -p "$SCRIPT_DIR/../target" "$SCRIPT_DIR/sqlcipher"
|
||||
export SQLCIPHER_LIB_DIR="$SCRIPT_DIR/sqlcipher"
|
||||
export SQLCIPHER_INCLUDE_DIR="$SQLCIPHER_LIB_DIR"
|
||||
|
||||
SQLCIPHER_VERSION="4.4.3"
|
||||
# Download and generate sqlcipher amalgamation
|
||||
mkdir -p $SCRIPT_DIR/sqlcipher.src
|
||||
[ -e "v${SQLCIPHER_VERSION}.tar.gz" ] || curl -sfL -O "https://github.com/sqlcipher/sqlcipher/archive/v${SQLCIPHER_VERSION}.tar.gz"
|
||||
tar xzf "v${SQLCIPHER_VERSION}.tar.gz" --strip-components=1 -C "$SCRIPT_DIR/sqlcipher.src"
|
||||
cd "$SCRIPT_DIR/sqlcipher.src"
|
||||
./configure --with-crypto-lib=none
|
||||
make sqlite3.c
|
||||
cp sqlite3.c sqlite3.h sqlite3ext.h "$SCRIPT_DIR/sqlcipher/"
|
||||
cd "$SCRIPT_DIR"
|
||||
rm -rf "v${SQLCIPHER_VERSION}.tar.gz" sqlcipher.src
|
||||
|
||||
# Regenerate bindgen file for sqlcipher
|
||||
rm -f "$SQLCIPHER_LIB_DIR/bindgen_bundled_version.rs"
|
||||
|
||||
# cargo update
|
||||
find "$SCRIPT_DIR/../target" -type f -name bindgen.rs -exec rm {} \;
|
||||
env LIBSQLITE3_SYS_BUNDLING=1 cargo build --features "sqlcipher buildtime_bindgen session"
|
||||
find "$SCRIPT_DIR/../target" -type f -name bindgen.rs -exec mv {} "$SQLCIPHER_LIB_DIR/bindgen_bundled_version.rs" \;
|
||||
|
||||
# Sanity checks
|
||||
cd "$SCRIPT_DIR/.." || { echo "fatal error" >&2; exit 1; }
|
||||
cargo update
|
||||
cargo test --features "backup blob chrono functions limits load_extension serde_json trace vtab bundled-sqlcipher-vendored-openssl"
|
||||
printf ' \e[35;1mFinished\e[0m bundled-sqlcipher-vendored-openssl/sqlcipher tests\n'
|
Loading…
Reference in New Issue
Block a user