aports/community/nim/nim-gdb-fix-posix-and-sysroot.patch

29 lines
917 B
Diff

From: Jakub Jirutka <jakub@jirutka.cz>
Date: Tue, 02 Apr 2024 23:28:26 +0200
Subject: [PATCH] Fix nim-gdb to be POSIX-sh and fix sysroot
--- a/bin/nim-gdb
+++ b/bin/nim-gdb
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# Exit if anything fails
set -e
@@ -7,11 +7,10 @@
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 || $(uname -s) == *BSD ]]; then
- NIM_SYSROOT=$(dirname $(dirname $(readlink -f $(which nim))))
-else
- NIM_SYSROOT=$(dirname $(dirname $(readlink -e $(which nim))))
-fi
+case "$(uname -s)" in
+ Darwin | *BSD) NIM_SYSROOT="$(dirname $(dirname $(readlink -f $(which nim))))";;
+ *) NIM_SYSROOT="$(dirname $(dirname $(readlink -f $(which nim))))/lib/nim";;
+esac
# Find out where the pretty printer Python module is
GDB_PYTHON_MODULE_PATH="$NIM_SYSROOT/tools/debug/nim-gdb.py"