From e174b8a8008d95730f3f73e0c2bf99a9120a4588 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Wed, 25 Oct 2017 15:57:36 -0500 Subject: [PATCH] Fix build on platforms without bash Build script build_tools/git_version_gen.sh had a hard dependency on bash that was causing the build to fail on systems without bash. Closes #4491 --- build_tools/git_version_gen.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/build_tools/git_version_gen.sh b/build_tools/git_version_gen.sh index 791ac8ff7..b7faccbf4 100755 --- a/build_tools/git_version_gen.sh +++ b/build_tools/git_version_gen.sh @@ -1,11 +1,14 @@ -#!/bin/bash +#!/bin/sh # Originally from the git sources (GIT-VERSION-GEN) # Presumably (C) Junio C Hamano # Reused under GPL v2.0 # Modified for fish by David Adam +# Obtain directory containing this script in POSIX-compatible manner +# See https://stackoverflow.com/a/43919044/17027 (public domain) +a="/$0"; a="${a%/*}"; a="${a:-.}"; a="${a#/}/"; BASEDIR=$(cd "$a"; pwd) # Find the fish git directory as two levels up from this directory. -GIT_DIR=$(dirname $(dirname "${BASH_SOURCE[0]}")) +GIT_DIR=$(dirname $(dirname "$a")) FBVF=FISH-BUILD-VERSION-FILE DEF_VER=unknown