-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathgenerate-bindings.sh
executable file
·51 lines (42 loc) · 1.06 KB
/
generate-bindings.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env bash
set -euo pipefail
script_dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
export LIBSQL_RS_VERSION="0.5.0"
bindings_dir="${script_dir}/rust-bindings"
force=false
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case "$1" in
--force)
force=true
shift
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
function run_if_force {
if [[ "${force}" == "true" ]];then
"$@"
fi
}
run_if_force rm -rf "${bindings_dir}/libsql"
run_if_force rm -rf "${bindings_dir}/target"
mkdir -p "${bindings_dir}/libsql"
cd "${bindings_dir}/libsql"
git init 2> /dev/null
if ! git config remote.origin.url &> /dev/null;then
git remote add --no-fetch origin "https://github.com/tursodatabase/libsql.git"
fi
# git sparse-checkout init
# git sparse-checkout set bindings/c bindings/wasm libsql libsql-sys
# -----
# git fetch --quiet origin
# git checkout fb85262
# -----
git fetch --depth 1 origin tag libsql-rs-v${LIBSQL_RS_VERSION}
git reset --hard tags/libsql-rs-v${LIBSQL_RS_VERSION}
cd ..
cargo build --release