#! /bin/sh # Run ./bootstrap to generate the boilerplate scripts such as ./configure. if autoreconf --version 2>&1 > /dev/null ;then autoreconf -f -v -i else set -x aclocal --force -I m4 \ && autoconf --force \ && automake --add-missing --copy --force-missing fi # Print a version into .version # The tags follow SVN tags, which are empty commits that branch off. # This means git describe only works if on such a commit, otherwise # we'll use this workaround to populate .version. # Traverse all tags, # Find common ancestor of HEAD and tag, # Count number of commits between this ancestor and HEAD # Find tag with mininum count # Produce a --g string a la git describe if test "x`git describe 2>/dev/null`" = x ;then TAGS=`git tag -l 2>/dev/null` if test "x$TAGS" != x ;then HD=`git describe --always --dirty` for TAG in $TAGS ;do MB=`git merge-base $TAG HEAD` C=`git rev-list ${MB}..HEAD | wc -l` # Count cannot be 0, git describe would have worked. if test $C -gt 0 ;then echo "$C $TAG-$C-g$HD" fi done | sort -n | head -n1 | cut -d' ' -f2 > .version echo .version: `cat .version` cp -v .version .tarball-version fi fi