From 5b84e714f25ce90846b7a69b74e7516b8e94ac6a Mon Sep 17 00:00:00 2001 From: SomberNight Date: Tue, 11 Feb 2020 16:06:32 +0100 Subject: [PATCH] build: workaround for 'realpath' missing on macOS --- contrib/build_tools_util.sh | 6 ++++++ contrib/make_libsecp256k1.sh | 4 ++-- contrib/osx/base.sh | 4 ---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/contrib/build_tools_util.sh b/contrib/build_tools_util.sh index 5210f0f3a..be25fd2f6 100755 --- a/contrib/build_tools_util.sh +++ b/contrib/build_tools_util.sh @@ -107,6 +107,12 @@ function host_strip() fi } +# on MacOS, there is no realpath by default +if ! [ -x "$(command -v realpath)" ]; then + function realpath() { + [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" + } +fi export SOURCE_DATE_EPOCH=1530212462 diff --git a/contrib/make_libsecp256k1.sh b/contrib/make_libsecp256k1.sh index 06d63cb9e..8b602f34f 100755 --- a/contrib/make_libsecp256k1.sh +++ b/contrib/make_libsecp256k1.sh @@ -4,12 +4,12 @@ LIBSECP_VERSION="b408c6a8b287003d1ade5709e6f7bc3c7f1d5be7" set -e +. $(dirname "$0")/build_tools_util.sh || (echo "Could not source build_tools_util.sh" && exit 1) + here=$(dirname $(realpath "$0" 2> /dev/null || grealpath "$0")) CONTRIB="$here" PROJECT_ROOT="$CONTRIB/.." -. "$here"/build_tools_util.sh || (echo "Could not source build_tools_util.sh" && exit 1) - pkgname="secp256k1" info "Building $pkgname..." diff --git a/contrib/osx/base.sh b/contrib/osx/base.sh index c11e270a4..c2e3527c0 100644 --- a/contrib/osx/base.sh +++ b/contrib/osx/base.sh @@ -21,7 +21,3 @@ function DoCodeSignMaybe { # ARGS: infoName fileOrDirName codesignIdentity info "Code signing ${infoName}..." codesign -f -v $deep -s "$identity" "$file" || fail "Could not code sign ${infoName}" } - -function realpath() { - [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" -}