[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Dev Build System: Include Revision Number

From: Christopher Ness <chris_at_nesser.org>
Date: 2006-07-18 20:04:16 CEST

On Tue, July 18, 2006 12:33 pm, Greg Hudson said:
> On Mon, 2006-07-17 at 21:34 +0100, Max Bowsher wrote:
>> It's deliberately not done to avoid needing to run 'svnversion', and
>> relink everything from libsvn_subr on upwards, on *every* invocation of
>> 'make'.
>
> versionfile:
> svnversion . >> versionfile.new
> cmp versionfile versionfile.new || mv versionfile.new versionfile
>
> I believe that should work with every modern version of make (I've seen
> versions which won't re-check the timestamp on versionfile after
> executing the rebuild rule, but I think that's ancient history).
> svnversion would run on every build, but that's it, and repeated
> invocations of svnversion should be quite fast for a Subversion project
> tree.

Thanks for the "make magic" Greg. I think you wanted to overwrite
versionfile.new instead of append to it though.

Once the version number is segregated into it's own file, it would still
need to be updated in the source header to reflect the version number when
the `cmp` command returned non-zero.

I've been writing a python script to do this - which is not the greatest
implimentation as I wouldn't want to add a requirement for python to
subversion. A proper C program could be written for cross platform
implimentations if this is seen as useful.

The python script is attached, just use the above make commands and put
the python script in after the || (or) command.
You would want to `cat` the contents of the version file instead of
running `svnversion` again as I show in the usage of the script.

Or just run the script in the ./subversion/include/ directory and build
the source.
Please let me know if you find any bugs in the python script.

I think the 'svn_version.h' target would have to depend on the
'versionfile' target in the Makefile so things get built in the right
order. But I'm not sure of that one.

Relinking is non-trivial as originally pointed out. After changing the
source header file make reports that 234 commands need to execute to build
the executable.

[cgness@servicesvn dev-rev-devel]$ make -n | wc -l
234

Thanks for the chatter, I received more of a response than I expected.

Cheers,
Chris

-- 
http://www.nesser.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Received on Tue Jul 18 20:05:02 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.