From 4180b5873d9c92b6b02ec72486c2349559f65553 Mon Sep 17 00:00:00 2001 From: Keith Stellyes Date: Thu, 10 Oct 2019 12:21:37 -0700 Subject: [PATCH] Fix for tools/zasm.sh being dependent on readlink -f (an issue on macOS, preventing builds) (#28) * Fix for tools/zasm.sh being dependent on readlink -f (an issue on macOS, preventing builds) * Wrap zasm.sh shebang in /usr/bin/env ; remove comment about BSDs --- tools/zasm.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/zasm.sh b/tools/zasm.sh index 574f91b..ca93458 100755 --- a/tools/zasm.sh +++ b/tools/zasm.sh @@ -1,7 +1,11 @@ -#!/bin/sh +#!/usr/bin/env bash + +# readlink -f doesn't work with macOS's implementation +# so, if we can't get readlink -f to work, try python with a realpath implementation +ABS_PATH=$(readlink -f "$0" || python -c "import sys, os; print(os.path.realpath('$0'))") # wrapper around ./emul/zasm/zasm that prepares includes CFS prior to call -DIR=$(dirname $(readlink -f "$0")) +DIR=$(dirname "${ABS_PATH}") ZASMBIN="${DIR}/emul/zasm/zasm" CFSPACK="${DIR}/cfspack/cfspack" INCCFS=$(mktemp)