[mythtv] [mythtv-commits] Ticket #885: Add source revision number to version information

Ivor Hewitt ivor at ivor.org
Sun Jan 15 10:43:30 UTC 2006

On Sunday 15 January 2006 10:07, MythTV wrote:
> #885: Add source revision number to version information
Just FYI, I'm using the following to version stamp in openchrome at the 

In makefile:-

all:: svnversion.h
        @if [ -f svnrelease.h ]; then \
        echo '#include "svnrelease.h"' > $@.tmp; \
        elif [ -d .svn ]; then \
        echo '#define BUILDCOMMENT "(development build, at svn revision '\
        "`svnversion -nc . | sed -e s/^[^:]*://`"')\n"' > $@.tmp; \
        else date +'#define BUILDCOMMENT "(development build, compiled on 
%c)\n"' > $@.tmp; fi

        @(chmod 666 $@.tmp 2> /dev/null || /bin/true)
        @cmp -s $@ $@.tmp || (mv $@.tmp $@ ; echo created $@)
.PHONY: svnversion.h

To stamp the current svn version and whether modified or not into 
svnversion.h, if it isn't an svn repo, then it stamps the datestamp instead. 
If it's a release package (denoted by the presence of an svnrelease.h file) 
then it uses that version number instead. 
And then just #include the header into wherever it makes sense to include 
it... and into a file you don't mind recompiling on each make.

Ivor Hewitt.

More information about the mythtv-dev mailing list