From 99ad65fdd616e2bc21a688acffb9f5f310b70066 Mon Sep 17 00:00:00 2001 From: BarrOff <58253563+BarrOff@users.noreply.github.com> Date: Thu, 18 Jun 2020 20:48:55 +0200 Subject: [PATCH] make nim-gdb compatible with BSD systems (#14700) --- bin/nim-gdb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bin/nim-gdb b/bin/nim-gdb index b9956073bd..1486b6dce3 100755 --- a/bin/nim-gdb +++ b/bin/nim-gdb @@ -5,17 +5,15 @@ set -e which nim > /dev/null || (echo "nim not in PATH"; exit 1) which gdb > /dev/null || (echo "gdb not in PATH"; exit 1) +which readlink > /dev/null || (echo "readlink not in PATH."; exit 1) -if [[ "$(uname -s)" == "Darwin" ]]; then - which greadlink > /dev/null || (echo "readlink not in PATH. Please install coreutils from homebrew."; exit 1) - READLINK=greadlink +if [[ "$(uname -s)" == "Darwin" || "(uname -s)" == *"BSD" ]]; then + NIM_SYSROOT=$(dirname $(dirname $($READLINK -f $(which nim)))) else - which readlink > /dev/null || (echo "readlink not in PATH."; exit 1) - READLINK=readlink + NIM_SYSROOT=$(dirname $(dirname $($READLINK -e $(which nim)))) fi # Find out where the pretty printer Python module is -NIM_SYSROOT=$(dirname $(dirname $($READLINK -e $(which nim)))) GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/nim-gdb.py" # Run GDB with the additional arguments that load the pretty printers