]> jfr.im git - irc/irssi/irssi.git/blob - irssi-version.sh
.travis.yml: Coverity stuff.
[irc/irssi/irssi.git] / irssi-version.sh
1 #!/bin/sh
2
3 DATE=`GIT_DIR=$1/.git git log -1 --pretty=format:%ai HEAD`
4
5 VERSION_DATE=`echo $DATE | cut -f 1 -d ' ' | tr -d -`
6 VERSION_TIME=`echo $DATE | cut -f 2 -d ' ' | awk -F: '{printf "%d", $1$2}'`
7
8 if test -z "$VERSION_DATE"; then
9 exec>&2
10 echo "**Error**: `basename "$0"` must be run in a git clone, cannot proceed."
11 exit 1
12 fi
13
14 echo "#define IRSSI_VERSION_DATE $VERSION_DATE"
15 echo "#define IRSSI_VERSION_TIME $VERSION_TIME"
16
17 if echo "${VERSION}" | grep -q -- -head; then
18 # -head version, get extra details from git if we can
19 git_version=$(GIT_DIR=$1/.git git describe --dirty --long --always --tags)
20 if [ $? = 0 ]; then
21 new_version="$(echo "${VERSION}" | sed 's/-head//')"
22 # Because the git tag won't yet include the next release we modify the git
23 # describe output using the version defined from configure.ac.
24 version="${new_version}-$(echo "${git_version}" | sed 's/^.*-[0-9]\+-//')"
25 echo "#undef PACKAGE_VERSION"
26 echo "#define PACKAGE_VERSION \"${version}\""
27 fi
28 fi