pkg.mk: use dark216 theme for Earth Day 2019
[sleepy_penguin.git] / GIT-VERSION-GEN
blob1f140692689f50f981a32038a0bf69708a2269ff
1 #!/bin/sh
3 GVF=GIT-VERSION-FILE
4 DEF_VER=v3.5.1
5 GVH=ext/sleepy_penguin/git_version.h
7 LF='
10 # First see if there is a version file (included in release tarballs),
11 # then try git-describe, then default.
12 if test -f version
13 then
14 VN=$(cat version) || VN="$DEF_VER"
15 elif test -d .git -o -f .git &&
16 VN=$(git describe --abbrev=4 HEAD 2>/dev/null) &&
17 case "$VN" in
18 *$LF*) (exit 1) ;;
19 v[0-9]*)
20 git update-index -q --refresh
21 test -z "$(git diff-index --name-only HEAD --)" ||
22 VN="$VN-dirty" ;;
23 esac
24 then
25 VN=$(echo "$VN" | sed -e 's/-/./g');
26 else
27 VN="$DEF_VER"
30 VN=$(expr "$VN" : v*'\(.*\)')
32 if test -r $GVF
33 then
34 VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
35 else
36 VC=unset
38 test "$VN" = "$VC" || {
40 echo '#ifndef MY_GIT_VERSION'
41 echo '#define MY_GIT_VERSION "'$VN'"'
42 echo '#endif /* MY_GIT_VERSION */'
43 } >$GVH.tmp.$$
44 mv $GVH.tmp.$$ $GVH
45 echo >&2 "GIT_VERSION = $VN"
46 echo "GIT_VERSION = $VN" >$GVF