Sign in Join

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

Mailing lists / fpc-devel / 2010-11

revision.inc

7 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Dimitrios Chr. Ioannidis

Hi,

because i compile constantly the trunk i always wished the version string to have the svn revision. Looking at the version.pas i found that the only think i have to do is to define REVINC. But i'm in windows at i have to export the tree before the build effectively loosing all the svn's info.

Does anyone know how to reproduce that file manually ?

regards,

Dimitrios Chr. Ioannidis

Reply by email

Dimitrios Chr. Ioannidis
to Marco van de Voort

Στις 13/11/2010 11:30 πμ, ο/η Marco van de Voort έγραψε:

Show quoted text 10 lines
In our previous episode, Dimitrios Chr. Ioannidis said: > But i'm in windows at i > have to export the tree before the build effectively loosing all the > svn's info. http://www.stack.nl/~marcov/buildfaq/#toc-Section-2.4 and then specially http://www.stack.nl/~marcov/buildfaq/#toc-Subsection-2.4.2

Thx, but this wasn't the problem.

The problem was that it doesn't exists a svnversion executable in TortoiseSVN. I had to look at the makefile in compiler dir to find out that i needed a svnversion executable for this to work. So i downloaded the CollabNet command line tools.

So, i updated my tree. Got inside the compiler dir and run 'make revision FPC={some path}\ppc386.exe'.
Unfortunattely the revision.inc is still has 'exported' in it and the 'ppc386.exe -iW' gives me '2.5.1-rexported'.
Running 'svnversion' i got '16332'.

In the {fpc svn dir}\compiler\Makefile at the 363, there is :
'SVNVERSION:=$(wildcard $(addsuffix /svnversion$(SRCEXEEXT),$(SEARCHPATH)))'

As i'm not familiar with the Makefile files, any help is much appreciated ...

regards,

Dimitrios Chr. Ioannidis

Reply by email

Marco van de Voort
to Dimitrios Chr. Ioannidis

In our previous episode, Dimitrios Chr. Ioannidis said:

Show quoted text 7 lines

(it is about avoid exporting all together)

The problem was that it doesn't exists a svnversion executable in TortoiseSVN. I had to look at the makefile in compiler dir to find out that i needed a svnversion executable for this to work. So i downloaded the CollabNet command line tools.

That require registration, I use these:

https://sourceforge.net/projects/win32svn/

Show quoted text 11 lines
So, i updated my tree. Got inside the compiler dir and run 'make revision FPC={some path}\ppc386.exe'. Unfortunattely the revision.inc is still has 'exported' in it and the 'ppc386.exe -iW' gives me '2.5.1-rexported'. Running 'svnversion' i got '16332'. In the {fpc svn dir}\compiler\Makefile at the 363, there is : 'SVNVERSION:=$(wildcard $(addsuffix /svnversion$(SRCEXEEXT),$(SEARCHPATH)))' As i'm not familiar with the Makefile files, any help is much appreciated ...

Is that binary in the path? If not you have to pass it:

make revision SVNVERSION="c:\Program Files
(x86)\Subversion\bin\svnversion.exe"

I'll see if I can add some about this in the next buildfaq.

Reply by email

Dimitrios Chr. Ioannidis
to Marco van de Voort
Show quoted text 7 lines
> that i needed a svnversion executable for this to work. So i downloaded > the CollabNet command line tools. That require registration, I use these: https://sourceforge.net/projects/win32svn/

Thx, for the tip.But IMHO the majority of the windows users are using TortoiseSVN, so a solution which include the TortoiseSVN's SubWCRev alternative for the svn's 'svnversion' will be better.

> Running 'svnversion' i got '16332'. Is that binary in the path? If not you have to pass it:

I run 'svnversion' at the compiler dir from the command line, so yes it's in the path.AFAIU, the Makefile failed to find the 'svnversion' executable in my Windows 7 64 bit machine. That's why i posted the line from the Makefile.

make revision SVNVERSION="c:\Program Files (x86)\Subversion\bin\svnversion.exe"

Thx, didn't know that i could do it that way.Much appreciated ...

regards,

Dimitrios Chr. Ioannidis

Reply by email

Marco van de Voort
to Dimitrios Chr. Ioannidis

In our previous episode, Dimitrios Chr. Ioannidis said:

For the record: I'm only writing as I discover this functionality. I knew Lazarus did something like this, but not the details and hows.

Show quoted text 9 lines
>> the CollabNet command line tools. > > That require registration, I use these: > > https://sourceforge.net/projects/win32svn/ Thx, for the tip.But IMHO the majority of the windows users are using TortoiseSVN, so a solution which include the TortoiseSVN's SubWCRev alternative for the svn's 'svnversion' will be better.

I put $WCREV$ in a file revision.inc.template and then ran

subwcrev . revision.inc.template revision.inc

in the compiler/ dir. This is doable to do in batch or makefile I'll look into it later.

Show quoted text 8 lines
> Is that binary in the path? If not you have to pass it: I run 'svnversion' at the compiler dir from the command line, so yes it's in the path. AFAIU, the Makefile failed to find the 'svnversion' executable in my Windows 7 64 bit machine. That's why i posted the line from the Makefile.

I think it is a functionality that doesn't auto engage, since it could possibly slow building or put useless suffixes like "exported" in binaries when not properly used. Setting SVNVERSION makefile param activates it.

It should be easy to make something similar for subwcrev, I'll have a look at that later.

Reply by email

Marco van de Voort
to Dimitrios Chr. Ioannidis: On Sat, 13 Nov 2010 13:17:49 +0100 (CET), (Marco van de Thx, for the tip.But IMHO the…

In our previous episode, Dimitrios Chr. Ioannidis said:

Show quoted text 6 lines
> > https://sourceforge.net/projects/win32svn/ Thx, for the tip.But IMHO the majority of the windows users are using TortoiseSVN, so a solution which include the TortoiseSVN's SubWCRev alternative for the svn's 'svnversion' will be better.

I've played with both systems a bit. The problem seems to be that "make" can't properly resolve exes in directories with spaces.

With the below patch, "make revision" does something if I copy subwcrev.exe to a dir without spaces in the PATH (don't forget to run fpcmake -Tall -w after applying this patch)

Index: Makefile.fpc
=================================================================== --- Makefile.fpc (revision 16341)
+++ Makefile.fpc (working copy)
@@ -162,7 +162,7 @@
# Default message file
MSGFILE=msg/error$(FPCLANG).msg

-
+SUBWCREV:=$(wildcard $(addsuffix /subwcrev$(SRCEXEEXT),$(SEARCHPATH)))
 SVNVERSION:=$(wildcard $(addsuffix /svnversion$(SRCEXEEXT),$(SEARCHPATH)))
 # Check if revision.inc is present
 REVINC:=$(wildcard revision.inc)
@@ -412,13 +412,24 @@

# revision.inc rule
revision.inc :
+ $(ECHO) $(SUBWCREV)
+ $(ECHO) $(REVSTR)
+ $(ECHO) $(SVNVERSION)
+ $(ECHO) $(SRCEXEEXT)
+ $(ECHO) $(SEARCHPATH)))
ifneq ($(REVSTR),)
ifdef USEZIPWRAPPER
+ifeq ($(REVSTR),exported)
+ifneq ($(SUBWCREV),)
+ $(SUBWCREV) .. revision.inc.template revision.inc +else
ifneq ($(ECHOREDIR),echo)
$(ECHOREDIR) "'$(REVSTR)'" > revision.inc
else
$(ECHOREDIR) '$(REVSTR)' > revision.inc
endif
+endif
+endif
else
$(ECHOREDIR) "'$(REVSTR)'" > revision.inc
endif

Reply by email