Drop hard dependency on bash from git_version_gen.sh again

I can't seem to find a reason why the shell interpreter needs to be bash
and not just sh here. Needed to replace `BASH_SOURCE[0]` with the legacy
`$0` supported by sh, but otherwise it seems to still work.

Many non-Linux platforms do not ship with bash out-of-the-box (and as a
shell, I don't think we need to encourage the further proliferation of
bash ;-), this lets fish build on a clean install of FreeBSD, which does
not have bash.
This commit is contained in:
Mahmoud Al-Qudsi 2018-06-01 12:48:03 -05:00
parent e26d5418af
commit f741968d6d

View file

@ -1,11 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env sh
# Originally from the git sources (GIT-VERSION-GEN) # Originally from the git sources (GIT-VERSION-GEN)
# Presumably (C) Junio C Hamano <junkio@cox.net> # Presumably (C) Junio C Hamano <junkio@cox.net>
# Reused under GPL v2.0 # Reused under GPL v2.0
# Modified for fish by David Adam <zanchey@ucc.gu.uwa.edu.au> # Modified for fish by David Adam <zanchey@ucc.gu.uwa.edu.au>
set -e
# Find the fish git directory as two levels up from script directory. # Find the fish git directory as two levels up from script directory.
GIT_DIR="$( cd "$( dirname $( dirname "${BASH_SOURCE[0]}" ) )" && pwd )" GIT_DIR="$( cd "$( dirname $( dirname "$0" ) )" && pwd )"
FBVF=FISH-BUILD-VERSION-FILE FBVF=FISH-BUILD-VERSION-FILE
DEF_VER=unknown DEF_VER=unknown
@ -26,7 +28,7 @@ else
VC=unset VC=unset
fi fi
# Output the FBVF. # Maybe output the FBVF
# It looks like FISH_BUILD_VERSION="2.7.1-621-ga2f065e6" # It looks like FISH_BUILD_VERSION="2.7.1-621-ga2f065e6"
test "$VN" = "$VC" || { test "$VN" = "$VC" || {
echo >&2 "FISH_BUILD_VERSION=$VN" echo >&2 "FISH_BUILD_VERSION=$VN"