forked from bmatsuo/lmdb-go
-
Notifications
You must be signed in to change notification settings - Fork 7
/
update-lmdb.sh
executable file
·50 lines (38 loc) · 1.34 KB
/
update-lmdb.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
#!/bin/sh
#
# Script to update our copy of the LMDB library and headers
# Releases can be found here: https://github.com/LMDB/lmdb/releases
#
function get_define {
grep "^#define $1" lmdb/lmdb.h | head -1 | awk '{print $3}'
}
function get_version {
echo "$(get_define MDB_VERSION_MAJOR).$(get_define MDB_VERSION_MINOR).$(get_define MDB_VERSION_PATCH)"
}
cur_version="$(get_version)"
echo "Current LMDB version: $cur_version"
echo
version="$1"
if [ -z "$version" ]; then
echo "USAGE: $0 <desired-version>"
echo "Check https://github.com/LMDB/lmdb/releases for available versions"
exit 1
fi
set -ex
tmp_dir=$(mktemp -d -t lmdb-update)
echo "Temp dir: $tmp_dir"
curl -L "https://github.com/LMDB/lmdb/archive/refs/tags/LMDB_${version}.tar.gz" | tar -C "$tmp_dir" -xvz
cp "$tmp_dir/lmdb-LMDB_${version}/libraries/liblmdb/mdb.c" lmdb/mdb.c
cp "$tmp_dir/lmdb-LMDB_${version}/libraries/liblmdb/lmdb.h" lmdb/lmdb.h
cp "$tmp_dir/lmdb-LMDB_${version}/libraries/liblmdb/CHANGES" CHANGES.lmdb.txt
if [ ! -z "$tmp_dir" ]; then
echo "Removing temp dir: $tmp_dir"
rm -rf "$tmp_dir"
fi
set +ex
echo
new_version="$(get_version)"
echo "New LMDB version: $new_version"
echo
echo "NOTE: Do not forget to include the upstream changelog from $cur_version to $new_version from"
echo " CHANGES.lmdb.txt in our CHANGES.md, and do not forget to test!"