[Lazarus] embed git version info

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Mar 28 12:53:47 CET 2013


On Thu, 28 Mar 2013 11:14:19 +0000
Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk> wrote:

> Mattias Gaertner wrote:
> > On Thu, 28 Mar 2013 09:19:06 +0000
> > Mark Morgan Lloyd <markMLl.lazarus at telemetry.co.uk> wrote:
> > 
> >> [...]
> >> This can be a bit tricky, since it needs something like tr on all 
> >> platforms and Lazarus has problems with \ in the ExecuteBefore...Command 
> >> Value setting.
> > 
> > What problems?
> 
> The original command I used was
> 
> /bin/sh -c "echo -n \'`svnversion -n `\' >project_svnrevision.inc"
> 
> but at some point (if my memory is correct) Lazarus started trying to 
> convert \ to / even on unix (I'm pretty sure we discussed it at the 
> time). 

The IDE converts \,/ in all paths when for example a project saved under
Windows is opened under Linux.
You can define OS dependent paths via the project macros. See project
options / compiler options / IDE Macros / Conditionals.


> Thanks to somebody on CIX, I'm now using
> 
> /bin/sh -c "echo -n C`svnversion -n`C |tr A-G %-+ >project_svnrevision.inc"
> 
> I don't think that counts as "doing all the work for the OP" since he's 
> still got to figure out why it works :-)
> 
> I remember that under certain conditions I've had problems compiling 
> Lazarus where the FPC command to filter the SVN version hasn't yet been 
> built (I forget the detail, but this was probably when trying to get it 
> running on Solaris/SPARC). It does occur to me that a generic program to 
> munge an svn or git version string into a quoted literal would be a good 
> candidate for InstantFPC.

Or maybe an IDE plugin.

Mattias
 




More information about the Lazarus mailing list