Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 7 additions & 33 deletions util/build-gnu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,11 @@

set -e

# Use GNU version for make, nproc, readlink and sed on *BSD
case "$OSTYPE" in
*bsd*)
MAKE="gmake"
NPROC="gnproc"
READLINK="greadlink"
SED="gsed"
;;
*)
MAKE="make"
NPROC="nproc"
READLINK="readlink"
SED="sed"
;;
esac
# Use system's GNU version for make, nproc, readlink and sed on *BSD
MAKE=$(command -v gmake||command -v make)
NPROC=$(command -v gnproc||command -v nproc)
READLINK=$(command -v greadlink||command -v readlink)
SED=$(command -v gsed||command -v sed)

ME="${0}"
ME_dir="$(dirname -- "$("${READLINK}" -fm -- "${ME}")")"
Expand All @@ -49,24 +39,8 @@ path_GNU="$("${READLINK}" -fm -- "${path_GNU:-${path_UUTILS}/../gnu}")"

###

# On MacOS there is no system /usr/bin/timeout
# and trying to add it to /usr/bin (with symlink of copy binary) will fail unless system integrity protection is disabled (not ideal)
# ref: https://support.apple.com/en-us/102149
# On MacOS the Homebrew coreutils could be installed and then "sudo ln -s /opt/homebrew/bin/timeout /usr/local/bin/timeout"
# Set to /usr/local/bin/timeout instead if /usr/bin/timeout is not found
SYSTEM_TIMEOUT="timeout"
if [ -x /usr/bin/timeout ]; then
SYSTEM_TIMEOUT="/usr/bin/timeout"
elif [ -x /usr/local/bin/timeout ]; then
SYSTEM_TIMEOUT="/usr/local/bin/timeout"
fi

SYSTEM_YES="yes"
if [ -x /usr/bin/yes ]; then
SYSTEM_YES="/usr/bin/yes"
elif [ -x /usr/local/bin/yes ]; then
SYSTEM_YES="/usr/local/bin/yes"
fi
SYSTEM_TIMEOUT=$(command -v timeout)
SYSTEM_YES=$(command -v yes)

###

Expand Down
9 changes: 1 addition & 8 deletions util/show-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,7 @@
# spell-checker:ignore (jq) deps startswith

# Use GNU version for realpath on *BSD
case "$OSTYPE" in
*bsd*)
REALPATH="grealpath"
;;
*)
REALPATH="realpath"
;;
esac
REALPATH=$(command -v grealpath||command -v realpath)

ME="${0}"
ME_dir="$(dirname -- "${ME}")"
Expand Down
Loading