|
1 | 1 | #!/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. |
3 | 5 | # Install libdb4.8 (Berkeley DB). |
4 | | - |
5 | 6 | export LC_ALL=C |
6 | 7 | set -e |
7 | 8 |
|
| 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 | + |
8 | 21 | if [ -z "${1}" ]; then |
9 | 22 | echo "Usage: $0 <base-dir> [<ci-mode>] [<extra-bdb-configure-flag> ...]" |
10 | 23 | echo |
@@ -37,16 +50,17 @@ check_exists() { |
37 | 50 | sha256_check() { |
38 | 51 | # Args: <sha256_hash> <filename> |
39 | 52 | # |
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 |
42 | 60 | 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 |
48 | 62 | else |
49 | | - echo "${1} ${2}" | shasum -a 256 -c |
| 63 | + echo "${1} ${2}" | shasum -a 256 -c |
50 | 64 | fi |
51 | 65 | } |
52 | 66 |
|
|
0 commit comments