Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-03

embed git version info

29 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys
to Xiangrong Fang
Xiangrong Fang wrote
How can I embed git version info AUTOMATICALLY while I compile my program in lazarus, just like {$I %DATE%} ?

Use a pre-compile script (Project Options|Compiler Options|Compilation|Execute Before) in combination with a include file.

Attached is what I use in my projects. You will need to modify the script slightly to fit your project.

If you want something slightly less complex, simply output the 'git describe' results to a include file, and use that in your project. You can also use the 'git describe --abbrev=4' to get a slightly shorter output.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -------------- next part -------------- #!/bin/sh if test -f AUTHORS.txt then VF=src/VERSION_FILE.inc else VF=../../VERSION_FILE.inc fi DEF_VER=v0.6 LF=' ' # First see if there is a version file (included in release tarballs), # then try git-describe, then default. if test -f version then VN=$(cat version) || VN="$DEF_VER" elif test -d .git -o -f .git && VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && case "$VN" in *$LF*) (exit 1) ;; v[0-9]*) git update-index -q --refresh test -z "$(git diff-index --name-only HEAD --)" || VN="$VN-dirty" ;; esac then VN=$(echo "$VN" | sed -e 's/-/./g'); else VN="$DEF_VER" fi VN=$(expr "$VN" : v*'\(.*\)') if test -r $VF then VC=$(sed -e 's/^FPGUI_VERSION = //' <$VF) else VC=unset fi test "$VN" = "$VC" || { echo >&2 "FPGUI_VERSION = '$VN';" echo "FPGUI_VERSION = '$VN';" >$VF }
Xiangrong Fang
to Graeme Geldenhuys
How can I embed git version info AUTOMATICALLY while I compile my

program

Show quoted text 5 lines
> in lazarus, just like {$I %DATE%} ? Use a pre-compile script (Project Options|Compiler Options|Compilation|Execute Before) in combination with a include file.

Thanks.

I realized that this may not work for me. Because I need to compile the project under both Linux and Windows, and then I need 2 scripts in the same place :-(

Anyway, I tested with the simplest pre-build script:

git describe --always > REVISION.INC

Then in my program I added:

msgs.Lines.Add('GIT HASH: ' + {$I REVISION.INC});

Unfortunately, it does not compile, the error I got is:

unit1.pas(831,50) Error: Identifier not found "c25d546"

It seems that this directive does not load the include file as simple string??
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130327/9e00dbec/attachment.html>

Lukasz Sokol
to Xiangrong Fang
Xiangrong Fang wrote 28 lines
> How can I embed git version info AUTOMATICALLY while I compile my program > in lazarus, just like {$I %DATE%} ? Use a pre-compile script (Project Options|Compiler Options|Compilation|Execute Before) in combination with a include file. Thanks. I realized that this may not work for me. Because I need to compile the project under both Linux and Windows, and then I need 2 scripts in the same place :-( Anyway, I tested with the simplest pre-build script: git describe --always > REVISION.INC Then in my program I added: msgs.Lines.Add('GIT HASH: ' + {$I REVISION.INC}); Unfortunately, it does not compile, the error I got is: unit1.pas(831,50) Error: Identifier not found "c25d546" It seems that this directive does not load the include file as simple string??

maybe have your script do :

echo "constgithashfrominc : string = \'" > REVISION.INC git describe --always >> REVISION.INC
echo "\';" >> REVISION.INC

at the implementation section, under const directive do:

{$I REVISION.INC}

and then

msgs.Lines.Add('Git HASH: '+constgithashfrominc);

(i.e. so that you are going to have
const githashfrominc : string = 'whatever';
)

Or have it as resource string (it was mentioned on this list once upon a time).

L.

Graeme Geldenhuys
to Xiangrong Fang: program Thanks. I realized that this may not work for me. Because I need to compile the…
Xiangrong Fang wrote
I realized that this may not work for me. Because I need to compile the project under both Linux and Windows, and then I need 2 scripts in the same place :-(

Yeah, compared to MSEide, Lazarus project build settings are a bit historic or limited.

To get around problems with scripts vs batch files for cross-platform use, I found it is better to implement my "scripts" as FPC console applications. Then simply execute the console application where I would have used a script. I found that creating such console apps are actually a lot more powerful that batch files or bash scripts, because I have full use of the Free Pascal RTL, FCL and whatever else I need.

Anyway, I tested with the simplest pre-build script: git describe --always > REVISION.INC

If you run the 'git describe' from the command line, you would see the output is simply the "version information" (no constant definition or string quotes). So you need to place it in your source code with an identifier as the Pascal language requires. So you need to do something like the following in your code.

const
  cGitRevision = '{$revision.inc}';

Then in your program, use the constant instead.

  msgs.Lines.Add('GIT HASH: ' + cGitRevision);

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/
Sven Barth
to Graeme Geldenhuys
"Graeme Geldenhuys" wrote 12 lines
> Anyway, I tested with the simplest pre-build script: > > git describe --always > REVISION.INC If you run the 'git describe' from the command line, you would see the output is simply the "version information" (no constant definition or string quotes). So you need to place it in your source code with an identifier as the Pascal language requires. So you need to do something like the following in your code. const cGitRevision = '{$revision.inc}';

This won't work, because the string takes precedance over the directive.

But you could use the data2inc tool that cones with FPC to convert the returned data to a include file with constant.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130327/28546b06/attachment.html>

Graeme Geldenhuys
to Sven Barth
Sven Barth wrote 5 lines
> > const > cGitRevision = '{$revision.inc}'; This won't work, because the string takes precedance over the directive.

Probably why my original version build script generates the whole line with identifier.

What about the following...

 const
   cGitRevision = '''' + {$revision.inc} + '''';

Or are expressions not allowed in constant declarations either? Anyway, I think we gave enough hints for the original poster to find a suitable solution. I was never pro to spoon-feeding programmers. ;-)

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/
Xiangrong Fang
to Lukasz Sokol: maybe have your script do : echo "constgithashfrominc : string = \'" > REVISION.INC git…

2013/3/27 Lukasz Sokol

Show quoted text 10 lines
On 27/03/2013 14:18, Xiangrong Fang wrote: > > How can I embed git version info AUTOMATICALLY while I compile my program > > > in lazarus, just like {$I %DATE%} ? > > Use a pre-compile script (Project Options|Compiler > Options|Compilation|Execute Before) in combination with a include file.

I thought {$I revision.inc} is similar as {$I %DAT%}, but apparently they have different semantic.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130328/fae89102/attachment.html>

Sven Barth
to Graeme Geldenhuys: Probably why my original version build script generates the whole line with identifier.…
Graeme Geldenhuys wrote 11 lines
On 2013-03-27 17:59, Sven Barth wrote: >> const >> cGitRevision = '{$revision.inc}'; > This won't work, because the string takes precedance over the directive. Probably why my original version build script generates the whole line with identifier. What about the following... const cGitRevision = '''' + {$revision.inc} + '''';

That should work :)

Or are expressions not allowed in constant declarations either? Anyway, I think we gave enough hints for the original poster to find a suitable solution. I was never pro to spoon-feeding programmers. ;-)

Me neither...

Regards,
Sven

Mark Morgan Lloyd
to Graeme Geldenhuys: Probably why my original version build script generates the whole line with identifier.…
Graeme Geldenhuys wrote 16 lines
On 2013-03-27 17:59, Sven Barth wrote: >> const >> cGitRevision = '{$revision.inc}'; > This won't work, because the string takes precedance over the directive. Probably why my original version build script generates the whole line with identifier. What about the following... const cGitRevision = '''' + {$revision.inc} + ''''; Or are expressions not allowed in constant declarations either? Anyway, I think we gave enough hints for the original poster to find a suitable solution. I was never pro to spoon-feeding programmers. ;-)

Another approach- which I use for svn- is to generate the version string with quotes. At the point of use you can simply have something like

(*$IFDEF USE_SVN *)
   (*$IFDEF UNIX   *)
           rev= (*$I project_svnrevision.inc *) ;
   (*$ELSE         *)
           rev= 'unimplemented';
   (*$ENDIF        *)

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. I'm sure somebody wants to tell us that MSEide handles them without complaint.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Graeme Geldenhuys
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote
Another approach- which I use for svn- is to generate the version string with quotes.

My first reply suggested that, but Xiangrong didn't like the idea of platform specific scripts.

I'm sure somebody wants to tell us that MSEide handles them without complaint.

That goes without saying. ;-) But MSEide isn't perfect either. Session information mixed with project settings, and the solution is a bit of a pain to use. It doesn't officially support 64-bit system (though it does work under Linux), and it doesn't work at all under FreeBSD. :-/

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/
Graeme Geldenhuys
to Xiangrong Fang: 2013/3/27 Lukasz Sokol I thought {$I revision.inc} is similar as {$I %DAT%}, but…
Xiangrong Fang wrote 5 lines
I thought {$I revision.inc} is similar as {$I %DATE%}, but apparently they have different semantic. From the Free Pascal Programmer's Guide (section 1.1.41), there are 9

hard-coded compiler values that can be used in the format %xxx%. If it is not any of those 9 hard-coded values, it is assumed to be an environment variable, and will go fetch the value of that. If the environment variable doesn't exist, an empty string is inserted.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/
Mark Morgan Lloyd
to Mattias Gaertner: On Thu, 28 Mar 2013 09:19:06 +0000 What problems? Mattias
Mattias Gaertner wrote 9 lines
On Thu, 28 Mar 2013 09:19:06 +0000 Mark Morgan Lloyd 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.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Mattias Gaertner
to Mark Morgan Lloyd: The original command I used was /bin/sh -c "echo -n \'`svnversion -n `\'…
Show quoted text 18 lines
Mattias Gaertner wrote: > On Thu, 28 Mar 2013 09:19:06 +0000 > Mark Morgan Lloyd 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.

Show quoted text 13 lines
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

Xiangrong Fang
to Mark Morgan Lloyd: The original command I used was /bin/sh -c "echo -n \'`svnversion -n `\'…
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 may leave some of you a wrong impression that I need spoon-feeding. Let me explain what I mean clearly:

While using {$I %DATE%}, I can write:

WriteLn('COMPILED: ' + {$I %DATE%});

i.e. the $I above returned a string without trying to parse it. But with {$I revision.inc} the file is parsed! I just realized this after my first reply to Graeme. After think about the logic, I think this makes sense. However, before I searched the forum for this problem, I didn't realize $I has such usage (I used to use that for $I- or $I+).

I am a programmer, but I only write apps, not compiler or OS related stuff. So sometime I may seem naive to "hardcore" or "real" programmers. Just like I asked why SIGFPE happend on random places. I don't think answer such questions are spoon-feeding, just like the sigfpe question.

Sometime I have other considerations as to what is worth to do, e.g. after I remembered I have to compile my program under windows, I hesitated whether I need to embed git rev into my program, because I don't want to install git on my windows virtual machine, not that I ask step by step help for how to do it, or write the script.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130328/11777158/attachment.html>

Mark Morgan Lloyd
to Mattias Gaertner: On Thu, 28 Mar 2013 11:14:19 +0000 The IDE converts \,/ in all paths when for example a…
Mattias Gaertner wrote 24 lines
On Thu, 28 Mar 2013 11:14:19 +0000 Mark Morgan Lloyd wrote: > Mattias Gaertner wrote: >> On Thu, 28 Mar 2013 09:19:06 +0000 >> Mark Morgan Lloyd 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.

Show quoted text 15 lines
> 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]
Mattias Gaertner
to Mark Morgan Lloyd
Show quoted text 7 lines
[...] > 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.

Under Windows backslashes are typically directory separators, and often parameters contain file names.
There is no simple way to tell what is what. The IDE must use a simple and consistent way.
Maybe if both path delimiters are in a path, do not switch them.

[...]

Mattias

Mark Morgan Lloyd
to Mark Morgan Lloyd: The original command I used was /bin/sh -c "echo -n \'`svnversion -n `\'…
Mark Morgan Lloyd wrote 30 lines
Mattias Gaertner wrote: > On Thu, 28 Mar 2013 09:19:06 +0000 > Mark Morgan Lloyd 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]
Mark Morgan Lloyd
to Mattias Gaertner: On Thu, 28 Mar 2013 12:11:19 +0000 Under Windows backslashes are typically directory…
Mattias Gaertner wrote 15 lines
On Thu, 28 Mar 2013 12:11:19 +0000 Mark Morgan Lloyd wrote: > [...] >> 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. Under Windows backslashes are typically directory separators, and often parameters contain file names. There is no simple way to tell what is what. The IDE must use a simple and consistent way. Maybe if both path delimiters are in a path, do not switch them.

I don't think that there's a 100% reliable heuristic, and there probably aren't many cases where this sort of thing has to be embedded in a Lazarus command. I'm happy enough with the hack that I've got, although I might be rather less so if I were using Windows regularly and it turned out that there wasn't a readily-available tr utility.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Graeme Geldenhuys
to Xiangrong Fang: That does not work. -------------- next part -------------- An HTML attachment was…
Xiangrong Fang wrote 10 lines
> > What about the following... >> >> const >> cGitRevision = '''' + {$revision.inc} + ''''; >> > That should work :) > That does not work.

Indeed, I just tested it (which I didn't before). Anyway, ignore my "spoon feeding" comment....email humour fails 99.9% of the times.

Whatever you choose to use... scripts, InstantFPC, console app etc, just make sure that the include file contains the full declaration of a constant, or a string in quotes. I tested the attached program, and it works 100%.

I now consider your question answered.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ -------------- next part -------------- program test; {$mode objfpc}{$H+} const cGitRevision = {$i revision.inc}; begin Writeln(cGitRevision); end. -------------- next part -------------- 'v1.0-123'
Graeme Geldenhuys
to Xiangrong Fang: still got to figure I may leave some of you a wrong impression that I need spoon-feeding.…
Xiangrong Fang wrote
WriteLn('COMPILED: ' + {$I %DATE%}); i.e. the $I above returned a string without trying to parse it.

It just returns a string.... string + string = string. Hence the Writeln() statements works. As I said in another reply. The compiler has some special cases regarding %xxx% format, and for everything else it returns an environment variable as a string.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/
Graeme Geldenhuys
to Mark Morgan Lloyd: I don't think that there's a 100% reliable heuristic, and there probably aren't many…
Mark Morgan Lloyd wrote
I don't think that there's a 100% reliable heuristic, and there probably

Under MSEide and Maximus, I use the different compiler build modes for this, and it works perfectly. eg: I use Build Mode 1 for Linux, and Build Mode 2 is used for Windows. By default MSEide has six available build modes. In Maximus there are the same, but I plan to make that amount user definable.

Back to the point. You can define as many Before and After commands as you want, and simply tick which build modes they apply to. Simple, elegant and it works! A much better design than what you get in Lazarus IDE.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/
Sven Barth
to Xiangrong Fang: That does not work. -------------- next part -------------- An HTML attachment was…
Xiangrong Fang wrote 11 lines
What about the following... const cGitRevision = '''' + {$revision.inc} + ''''; That should work :) That does not work.

Eh, right. Sorry... I thought a bit too much here (or too less depending on the perspective ^^).

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20130328/f55fcce4/attachment.html>

Alexander Klenin
to Graeme Geldenhuys: Indeed, I just tested it (which I didn't before). Anyway, ignore my "spoon feeding"…
Graeme Geldenhuys wrote 8 lines
On 2013-03-28 11:52, Xiangrong Fang wrote: >> >> That should work :) > > That does not work. Indeed, I just tested it (which I didn't before).

This problem is relatively frequent.
See
http://bugs.freepascal.org/view.php?id=15560
http://bugs.freepascal.org/view.php?id=21848
for a solution (which, unfortunately, is still not applied).

Alexander S. Klenin
Mark Morgan Lloyd
to Alexander Klenin
Alexander Klenin wrote 15 lines
On Thu, Mar 28, 2013 at 9:04 PM, Graeme Geldenhuys wrote: > On 2013-03-28 11:52, Xiangrong Fang wrote: >>> That should work :) >> That does not work. > > Indeed, I just tested it (which I didn't before). This problem is relatively frequent. See http://bugs.freepascal.org/view.php?id=15560 http://bugs.freepascal.org/view.php?id=21848 for a solution (which, unfortunately, is still not applied). > AConst = {$INCLUDESTRINGFILE filename.inc};

As an alternative hack which avoids the creation of a new directive, would it be possible to do

AStringConst = {$INCLUDE 'filename.inc'};

or for that matter

AnIntegerConst = {$INCLUDE $filename.inc};

i.e. the directive specifies quoting style or radix prefix?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Dimitri Smits
to Alexander Klenin: On Thu, Mar 28, 2013 at 9:04 PM, Graeme Geldenhuys This problem is relatively frequent.…

A bit late to the party, but why not use git attributes and clean/smudge scripts? see "keyword expansion" part

http://git-scm.com/book/ch7-2.html

or
http://chillibear.org/2010/04/git-and-cvs-like-keyword-expansion-idents.html

kind regards,
Dimitri Smits

----- Oorspronkelijk e-mail -----

Show quoted text 31 lines
Van: "Alexander Klenin" Aan: "Lazarus mailing list" Verzonden: Vrijdag 29 maart 2013 04:45:14 Onderwerp: Re: [Lazarus] embed git version info On Thu, Mar 28, 2013 at 9:04 PM, Graeme Geldenhuys wrote: > On 2013-03-28 11:52, Xiangrong Fang wrote: >>> >>> That should work :) >> >> That does not work. > > > Indeed, I just tested it (which I didn't before). This problem is relatively frequent. See http://bugs.freepascal.org/view.php?id=15560 http://bugs.freepascal.org/view.php?id=21848 for a solution (which, unfortunately, is still not applied). -- Alexander S. Klenin -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus