[widgets/graph] offset fixed now.
[awesome.git] / build-utils / package-version
blob6c8bc35430a8548d11f9cef7cd58b74ed68a7b1b
1 #!/bin/sh
2 # Syntax:
3 # $0 <path-to-top_srcdir> <version-stamp-file>
5 # <path-to-top_srcdir> may be relative
6 # <version-stamp-file> is relative to src/build topdir
8 top_srcdir="${1-.}"
9 test -d "$top_srcdir" || { \
10 echo "Could not change to top_srcdir '$1'" >&2; \
11 exit 1; \
13 version_stamp="${2-version-stamp}"
15 # If GIT_DIR is set, use it. If not, try top_srcdir/.git.
16 if test -n "$GIT_DIR"; then :;
17 else GIT_DIR="$top_srcdir/.git"; export GIT_DIR
20 if test -f "$top_srcdir/$version_stamp"; then # dist source tree
21 cat "$top_srcdir/$version_stamp" | ${TR-tr} -d '\012'
22 elif test -d "$GIT_DIR"; then # git source tree
23 git_describe=`${GIT-git} describe 2>/dev/null || echo devel`
24 echo "$git_describe" | ${SED-sed} -e 's/^v//' -e 's/-/./g' | ${TR-tr} -d '\012'
25 else # ???
26 echo "devel" | ${TR-tr} -d '\012'