[Lazarus] embed git version info

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Thu Mar 28 13:41:33 CET 2013


Mark Morgan Lloyd 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). 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.

Was reported as http://mantis.freepascal.org/view.php?id=18068&history=1 
Fix sorted out (back)slashes in paths, but not other cases in the 
command line (which, in fairness, are probably non-portable). I see that 
you (Mattias) suggested InstantFPC at the time, seems like an excellent 
idea since a specialist program could do its job without needing any 
parameters.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list