From 0b84440e0f7371ee0f1db92faa43aceb8f9c2509 Mon Sep 17 00:00:00 2001 From: Christian Drappi Date: Mon, 19 Apr 2021 15:05:46 -0400 Subject: [PATCH] cargo-install-all.sh: on Mac OS X, use greadlink instead of readlink (#16642) * on Mac OS X, use greadlink when building from source * this is a cleaner way to do it * we want to keep the cargo install comment at the top of the script --- scripts/cargo-install-all.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/cargo-install-all.sh b/scripts/cargo-install-all.sh index 944fed6bc..910582698 100755 --- a/scripts/cargo-install-all.sh +++ b/scripts/cargo-install-all.sh @@ -3,7 +3,13 @@ # |cargo install| of the top-level crate will not install binaries for # other workspace crates or native program crates. here="$(dirname "$0")" -cargo="$(readlink -f "${here}/../cargo")" +readlink_cmd="readlink" +if [[ $OSTYPE == darwin* ]]; then + # Mac OS X's version of `readlink` does not support the -f option, + # But `greadlink` does, which you can get with `brew install coreutils` + readlink_cmd="greadlink" +fi +cargo="$("${readlink_cmd}" -f "${here}/../cargo")" set -e