scmversion: Fix generation on Macs

This commit is contained in:
Connor McLaughlin 2022-08-07 01:28:52 +10:00
parent b581cc4777
commit 73a80d3a1d

View file

@ -3,7 +3,12 @@
VERSION_FILE="scmversion.cpp" VERSION_FILE="scmversion.cpp"
CURDIR=$(pwd) CURDIR=$(pwd)
if [ "$(uname -s)" == "Darwin" ]; then
cd "$(dirname $(python -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$0"))"
else
cd $(dirname $(readlink -f $0)) cd $(dirname $(readlink -f $0))
fi
HASH=$(git rev-parse HEAD) HASH=$(git rev-parse HEAD)
BRANCH=$(git rev-parse --abbrev-ref HEAD | tr -d '\r\n') BRANCH=$(git rev-parse --abbrev-ref HEAD | tr -d '\r\n')