1
0
mirror of https://github.com/irssi/irssi.git synced 2024-11-03 04:27:19 -05:00
irssi/utils/irssi-version.sh

32 lines
940 B
Bash
Raw Normal View History

2014-05-30 19:13:46 -04:00
#!/bin/sh
2024-02-23 11:04:41 -05:00
DATE=`grep '^v' "$1"/NEWS | head -1`
2022-06-06 06:08:49 -04:00
VERSION_DATE=`echo "$DATE" | cut -f 2 -d ' ' | tr -d -`
case $VERSION_DATE in
*xx)
VERSION_DATE=`date +%Y%m%d`
;;
esac
VERSION_TIME=`echo "$DATE" | cut -f 1 -d ' ' | tr -d v | tr .- ' '`
VERSION_TIME=`printf %d%d%02d $VERSION_TIME 2>/dev/null | cut -c 1-4`
2022-06-06 06:08:49 -04:00
if echo "${VERSION}" | grep -q -- -head; then
# -head version, get extra details from git if we can
DATE=`GIT_DIR=$1/.git git log -1 --pretty=format:%ci HEAD 2>/dev/null`
2014-05-30 19:13:46 -04:00
2022-06-06 06:08:49 -04:00
VERSION_DATE=`echo $DATE | cut -f 1 -d ' ' | tr -d -`
2022-06-06 06:08:49 -04:00
if test -z "$VERSION_DATE"; then
VERSION_DATE=`date +%Y%m%d`
fi
2022-06-06 15:11:30 -04:00
git_version=`GIT_DIR=$1/.git git describe --dirty --long --tags --match '[0-9]*.[0-9]*' 2>/dev/null`
if [ $? = 0 ]; then
echo "#undef PACKAGE_VERSION"
echo "#define PACKAGE_VERSION \"${git_version}\""
fi
fi
2022-06-06 06:08:49 -04:00
echo "#define IRSSI_VERSION_DATE $VERSION_DATE"
echo "#define IRSSI_VERSION_TIME $VERSION_TIME"