diff options
author | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2017-11-26 00:31:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-11-26 00:31:01 +0100 |
commit | 466d074200e4893f57c4c716c746e8549af65339 (patch) | |
tree | dce2b3013e63b295c14af90d62f9acbd908c2ac7 /utils/irssi-version.sh | |
parent | 8dfeca57ede1e726de07522a87203ce13676882d (diff) | |
parent | 3792bc9ba95b8b9fd12ad60b86b8bbb06e913dc1 (diff) | |
download | irssi-466d074200e4893f57c4c716c746e8549af65339.zip |
Merge branch 'master' into hide-lines
Diffstat (limited to 'utils/irssi-version.sh')
-rwxr-xr-x | utils/irssi-version.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/utils/irssi-version.sh b/utils/irssi-version.sh new file mode 100755 index 00000000..1fc6a558 --- /dev/null +++ b/utils/irssi-version.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +DATE=`GIT_DIR=$1/.git git log -1 --pretty=format:%ai HEAD` + +VERSION_DATE=`echo $DATE | cut -f 1 -d ' ' | tr -d -` +VERSION_TIME=`echo $DATE | cut -f 2 -d ' ' | awk -F: '{printf "%d", $1$2}'` + +if test -z "$VERSION_DATE"; then + exec>&2 + echo "**Error**: `basename "$0"` must be run in a git clone, cannot proceed." + exit 1 +fi + +echo "#define IRSSI_VERSION_DATE $VERSION_DATE" +echo "#define IRSSI_VERSION_TIME $VERSION_TIME" + +if echo "${VERSION}" | grep -q -- -head; then + # -head version, get extra details from git if we can + git_version=$(GIT_DIR=$1/.git git describe --dirty --long --always --tags) + if [ $? = 0 ]; then + new_version="$(echo "${VERSION}" | sed 's/-head//')" + # Because the git tag won't yet include the next release we modify the git + # describe output using the version defined from configure.ac. + version="${new_version}-$(echo "${git_version}" | sed 's/^.*-[0-9]\+-//')" + echo "#undef PACKAGE_VERSION" + echo "#define PACKAGE_VERSION \"${version}\"" + fi +fi |