forked from emqx/erlang-rocksdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdo_rocksdb.sh
executable file
·56 lines (46 loc) · 1.14 KB
/
do_rocksdb.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
52
53
54
55
56
#!/bin/sh
set -eu
set -x
if ./do_prebuilt.sh; then
exit 0
else
echo "No prebuilt artifacts, building from source"
fi
cd _build/cmake
if type cmake3 > /dev/null 2>&1 ; then
CMAKE=cmake3
else
CMAKE=cmake
fi
case "$@" in
*-j*)
${CMAKE} --build . -- "$@" || exit 1
;;
*)
CORES=$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)
if [ "x$CORES" = "x" ]; then
PAR=""
else
PAR="-- -j $CORES"
fi
${CMAKE} --build . $PAR $@ || exit 1
;;
esac
cd ../../
PKGNAME="$(./pkgname.sh)"
if [ "${BUILD_RELEASE:-}" = 1 ]; then
if [ -z "$PKGNAME" ]; then
echo "unable_to_resolve_release_package_name"
exit 1
fi
mkdir -p _packages
TARGET="_packages/${PKGNAME}"
gzip -c 'priv/liberocksdb.so' > "$TARGET"
# use openssl but not sha256sum command because in some macos env it does not exist
if command -v openssl; then
openssl dgst -sha256 "${TARGET}" | cut -d ' ' -f 2 > "${TARGET}.sha256"
else
sha256sum "${TARGET}" | cut -d ' ' -f 1 > "${TARGET}.sha256"
fi
fi
echo done_building_rocksdb