epoll: allow :CLOEXEC instead of the long constant
[sleepy_penguin.git] / GIT-VERSION-GEN
blobca0e578d648286fe021911e3363e8d191d58c20a
1 #!/bin/sh
3 GVF=GIT-VERSION-FILE
4 DEF_VER=v3.4.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