From bbaca4bb5cc3c7ccc45e745b8e04d20a7b897cdf Mon Sep 17 00:00:00 2001 From: Nalin Bhardwaj Date: Mon, 21 Jun 2021 15:32:19 +0530 Subject: [PATCH] tools/mockup: Fix macOS bash 3 syntax error Changelog-Fixed: Fixes `make` with `--enable-developer` option on macOS. --- tools/mockup.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/mockup.sh b/tools/mockup.sh index f1e8ac047..81d798e61 100755 --- a/tools/mockup.sh +++ b/tools/mockup.sh @@ -8,10 +8,8 @@ fi UPDIRNAME=$(dirname "$(dirname "$1")") shift -if [ $# -eq 0 ]; then - # With no args, read stdin to scrape compiler output. - # shellcheck disable=SC2046 - set -- $(while read -r LINE; do +function process_line { + LINE=$1 case "$LINE" in *undefined\ reference\ to*) # file.cc:(.text+0x10): undefined reference to `foo()' @@ -29,9 +27,16 @@ if [ $# -eq 0 ]; then echo "${LINE%\"*}" ;; *) - continue + return ;; - esac; done | LC_ALL=C sort -u) + esac +} + +if [ $# -eq 0 ]; then + # With no args, read stdin to scrape compiler output. + # shellcheck disable=SC2046 + set -- $(while read -r LINE; do + process_line "$LINE"; done | LC_ALL=C sort -u) fi for SYMBOL; do