Skip to content

Commit 71e3d98

Browse files
committed
test new macos shasum
1 parent aea3be5 commit 71e3d98

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

contrib/install_db4.sh

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
#!/bin/sh
2-
2+
# Copyright (c) 2017-2021 The Bitcoin Core developers
3+
# Distributed under the MIT software license, see the accompanying
4+
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
35
# Install libdb4.8 (Berkeley DB).
4-
56
export LC_ALL=C
67
set -e
78

9+
# Set C_FLAG for Mac OS version > 11.0.0
10+
11+
if [[ "$OSTYPE" == "darwin"* ]]; then
12+
os_ver_str=$(sw_vers -productVersion)
13+
os_ver=${os_ver_str//.}
14+
required_ver=1100
15+
16+
if (($os_ver > $required_ver)); then
17+
export CFLAGS="-Wno-error=implicit-function-declaration"
18+
fi
19+
fi
20+
821
if [ -z "${1}" ]; then
922
echo "Usage: $0 <base-dir> [<ci-mode>] [<extra-bdb-configure-flag> ...]"
1023
echo
@@ -37,16 +50,17 @@ check_exists() {
3750
sha256_check() {
3851
# Args: <sha256_hash> <filename>
3952
#
40-
if check_exists sha256sum; then
41-
echo "${1} ${2}" | sha256sum -c
53+
if [ "$(uname)" = "FreeBSD" ]; then
54+
# sha256sum exists on FreeBSD, but takes different arguments than the GNU version
55+
sha256 -c "${1}" "${2}"
56+
elif [ "$(uname)" = "Darwin" ]; then
57+
echo "${1} ${2}" | shasum -a 256 -c
58+
elif check_exists sha256sum; then
59+
echo "${1} ${2}" | sha256sum -c
4260
elif check_exists sha256; then
43-
if [ "$(uname)" = "FreeBSD" ]; then
44-
sha256 -c "${1}" "${2}"
45-
else
46-
echo "${1} ${2}" | sha256 -c
47-
fi
61+
echo "${1} ${2}" | sha256 -c
4862
else
49-
echo "${1} ${2}" | shasum -a 256 -c
63+
echo "${1} ${2}" | shasum -a 256 -c
5064
fi
5165
}
5266

0 commit comments

Comments
 (0)