[Lazarus] embed git version info
Mark Morgan Lloyd
markMLl.lazarus at telemetry.co.uk
Thu Mar 28 13:11:19 CET 2013
Mattias Gaertner wrote:
> 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.
Yes, but the backslashes in that command aren't paths.
>> 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.
I certainly find it very reassuring being able to get compiler and LCL
version info for a program, even if it does mean that it might have to
know more about the FPC/Lazarus tree structure than is desirable.
$ ./*gtk2 --version
Built 2013-01-10 16:14:49 revision 45
Lazarus IDE v1.0 revision 38513
Lazarus Class Library v1.0.1.3
Free Pascal v2.6.0 for sparc Linux
Linked with the GTK v2 widget set
Screen 0, displaying 1280x1024 at 96 dpi
--
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