aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordequis <dx@dxzone.com.ar>2015-05-03 18:03:00 -0300
committerdequis <dx@dxzone.com.ar>2015-05-03 19:43:33 -0300
commit70ec7ab33202b933a88e04122140a815a7d2081e (patch)
treec8062fdd2d33f7385d160177b2339343102d8cb5
parent40cfbc54088702d4887ccfb761eafe65b4376d59 (diff)
configure: change version number format, add --dump-version
-rwxr-xr-xconfigure53
1 files changed, 28 insertions, 25 deletions
diff --git a/configure b/configure
index 734c69ba..cf273237 100755
--- a/configure
+++ b/configure
@@ -55,8 +55,6 @@ cpu=`uname -m`
GLIB_MIN_VERSION=2.16
-echo BitlBee configure
-
# Cygwin and Darwin don't support PIC/PIE
case "$arch" in
CYGWIN* )
@@ -65,6 +63,32 @@ case "$arch" in
pie=0;;
esac
+get_version() {
+ REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/')
+ BITLBEE_VERSION=$REAL_BITLBEE_VERSION
+
+ if [ -d $srcdir/.git ] && type git > /dev/null 2> /dev/null; then
+ timestamp=$(cd $srcdir; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g')
+ branch=$(cd $srcdir; git rev-parse --abbrev-ref HEAD)
+
+ search="(.+)-([0-9]+)-(g[0-9a-f]+)"
+ replace="\1+$timestamp+$branch+\2-\3-git"
+
+ BITLBEE_VERSION=$(cd $srcdir; git describe --long --tags | sed -r "s/$search/$replace/")
+
+ unset timestamp branch search replace
+ fi
+}
+
+if [ "$1" = "--dump-version" ]; then
+ srcdir=$(cd $(dirname $0);pwd)
+ get_version
+ echo $BITLBEE_VERSION
+ exit
+fi
+
+echo BitlBee configure
+
while [ -n "$1" ]; do
e="`expr "X$1" : 'X--\(.*=.*\)'`"
if [ -z "$e" ]; then
@@ -671,34 +695,13 @@ if [ "$doc" = "1" ]; then
fi
fi
-REAL_BITLBEE_VERSION=`grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/'`
-echo
-if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
- nick=`bzr nick`
- if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
- nick="-$nick"
- else
- nick=""
- fi
- rev=`bzr revno`
- echo 'Using bzr revision #'$rev' as version number'
- BITLBEE_VERSION=$REAL_BITLBEE_VERSION-bzr$nick-$rev
-fi
-
-if [ -z "$BITLBEE_VERSION" -a -d .git ] && type git > /dev/null 2> /dev/null; then
- rev=`git describe --long --tags`-`git rev-parse --abbrev-ref HEAD`
- echo 'Using '$rev' as git version number'
- BITLBEE_VERSION=$rev-git
-fi
+get_version
-if [ -n "$BITLBEE_VERSION" ]; then
+if [ "$BITLBEE_VERSION" != "$REAL_BITLBEE_VERSION" ]; then
echo 'Spoofing version number: '$BITLBEE_VERSION
echo '#undef BITLBEE_VERSION' >> config.h
echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h
echo
-else
- # for pkg-config
- BITLBEE_VERSION=$REAL_BITLBEE_VERSION
fi
if ! make helloworld > /dev/null 2>&1; then