Changeset 70ec7ab


Ignore:
Timestamp:
2015-05-03T22:43:33Z (9 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
5ca1416
Parents:
40cfbc5
git-author:
dequis <dx@…> (03-05-15 21:03:00)
git-committer:
dequis <dx@…> (03-05-15 22:43:33)
Message:

configure: change version number format, add --dump-version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure

    r40cfbc5 r70ec7ab  
    5656GLIB_MIN_VERSION=2.16
    5757
    58 echo BitlBee configure
    59 
    6058# Cygwin and Darwin don't support PIC/PIE
    6159case "$arch" in
     
    6563                pie=0;;
    6664esac
     65
     66get_version() {
     67        REAL_BITLBEE_VERSION=$(grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/')
     68        BITLBEE_VERSION=$REAL_BITLBEE_VERSION
     69
     70        if [ -d $srcdir/.git ] && type git > /dev/null 2> /dev/null; then
     71                timestamp=$(cd $srcdir; git show -s --format=%ci HEAD | sed 's/ .*$//; s/-//g')
     72                branch=$(cd $srcdir; git rev-parse --abbrev-ref HEAD)
     73
     74                search="(.+)-([0-9]+)-(g[0-9a-f]+)"
     75                replace="\1+$timestamp+$branch+\2-\3-git"
     76
     77                BITLBEE_VERSION=$(cd $srcdir; git describe --long --tags | sed -r "s/$search/$replace/")
     78
     79                unset timestamp branch search replace
     80        fi
     81}
     82
     83if [ "$1" = "--dump-version" ]; then
     84        srcdir=$(cd $(dirname $0);pwd)
     85        get_version
     86        echo $BITLBEE_VERSION
     87        exit
     88fi
     89
     90echo BitlBee configure
    6791
    6892while [ -n "$1" ]; do
     
    672696fi
    673697
    674 REAL_BITLBEE_VERSION=`grep '^#define BITLBEE_VERSION ' $srcdir/bitlbee.h | sed 's/.*\"\(.*\)\".*/\1/'`
    675 echo
    676 if [ -z "$BITLBEE_VERSION" -a -d .bzr ] && type bzr > /dev/null 2> /dev/null; then
    677         nick=`bzr nick`
    678         if [ -n "$nick" -a "$nick" != "bitlbee" ]; then
    679                 nick="-$nick"
    680         else
    681                 nick=""
    682         fi
    683         rev=`bzr revno`
    684         echo 'Using bzr revision #'$rev' as version number'
    685         BITLBEE_VERSION=$REAL_BITLBEE_VERSION-bzr$nick-$rev
    686 fi
    687 
    688 if [ -z "$BITLBEE_VERSION" -a -d .git ] && type git > /dev/null 2> /dev/null; then
    689         rev=`git describe --long --tags`-`git rev-parse --abbrev-ref HEAD`
    690         echo 'Using '$rev' as git version number'
    691         BITLBEE_VERSION=$rev-git
    692 fi
    693 
    694 if [ -n "$BITLBEE_VERSION" ]; then
     698get_version
     699
     700if [ "$BITLBEE_VERSION" != "$REAL_BITLBEE_VERSION" ]; then
    695701        echo 'Spoofing version number: '$BITLBEE_VERSION
    696702        echo '#undef BITLBEE_VERSION' >> config.h
    697703        echo '#define BITLBEE_VERSION "'$BITLBEE_VERSION'"' >> config.h
    698704        echo
    699 else
    700         # for pkg-config
    701         BITLBEE_VERSION=$REAL_BITLBEE_VERSION
    702705fi
    703706
Note: See TracChangeset for help on using the changeset viewer.