Page 1 of 1

version check of Freepascal

Posted: 14.09.2012, 11:20
by Stilgar
For freepascal version recognition trouble, try to integrate in zeos.inc this code.
I've used it in lastest version lazarus installation package.
See youFreepascal version check

Code: Select all

{$IFDEF FPC}
  {$MODE DELPHI}
  {$INTERFACES COM}
  {$DEFINE VER140BELOW}
  // We assume 2 levels is sufficient.
  // The higher the third number in a version, the better... (we hope)
  {$IFDEF fpc_version>=5}
    {$MESSAGE 'FPC2_5UP'}
    {$DEFINE FPC2_5UP}
  {$ENDIF}
  {$IFDEF fpc_version>=4}
    {$MESSAGE 'FPC2_4UP'}
    {$DEFINE FPC2_4UP}
  {$ENDIF}
  {$IFDEF fpc_version>=3}
    {$MESSAGE 'FPC2_3UP'}
    {$DEFINE FPC2_3UP}
  {$ENDIF}

  {$IFDEF fpc_version>=2}
    {$MESSAGE 'FPC2_2UP'}
    {$DEFINE FPC2_2UP}
  {$ENDIF}

  {$IFDEF fpc_version>=1}
    {$MESSAGE 'FPC2_1UP'}
    {$DEFINE FPC2_1UP}
  {$ENDIF}

  {$IFDEF VER2}
    {$MESSAGE 'FPC2_UP'}
    {$DEFINE FPC2_UP}
  {$ENDIF}
{$ENDIF}


Posted: 16.09.2012, 16:07
by EgonHugeist
Stilgar,

For which branch is that proposal made? Latest version: http://svn.code.sf.net/p/zeoslib/code-0 ... es/testing

Is this patch for 6.6.6?

Posted: 19.09.2012, 09:22
by Stilgar
Hi EgonHugeist,
this piece of code is for Zeos7.0. (I've change on this version)
I don't if we can call patch.... is so stupid change ... ;)
The 6.6.6 is from long time i don't touch it. I've read that the 7 beta version is only for possible issues with delphi. Isn't so?
PS: now active the replay notification. Sorry for my reply latency

Posted: 19.09.2012, 13:57
by EgonHugeist
Stilgar,

ok stilgar. The actual version check we have was a patch from MarcoV (FPC-Core) so i will point him to your proposal and let him decide which way is better. Can you tell me the advantages? Was somthing wrong?

Yeah Zeos7 has only the Alpha atribute because of the Delphi2009 combat. But this is solved now too. Beta is comming soon.

Posted: 19.09.2012, 20:01
by Stilgar
In few words, PFC 2.6.0 and LCL introduces some new classes and other stuff for enforce the compatibility with delphi. So some code is obsolete or wrong due these changes.
With more precision in the version checking, my lazarus 1.0 and fpc 2.6.0 is able to compile with out errors.
Bye

Posted: 20.09.2012, 12:19
by marcov
I'm totally against this.

The principle of the current codebase (after my mods) is that compiler versions should never be used directly in the code. The new branches should reflect this already for the more core units. (HAVE_XX and WITH_x instead of ver<x>)

The usage with compiler and version checking directly in the sourcecode lead to the mess with 6.6.6 breaking with 2.6.0 needlessly, and that should not be repeated.

Anyways, the "UP" system is from the old days before ways to check version directly, which are versions of Delphi and FPC which are not supported anymore. All current versions support $IF for version systems, and this way of working doesn't make sense anymore.

Anything before 2.4.0 is unsupported. (and that only because some older revisions of popular Linux distros still package that version, 2.6.0 is the norm, with some older users on 2.4.4 versions)

Versions with odd last number are development versions. There is no single FPC 2.5.x, it is a working title that spans nearly 3 years of development, and the whole spectrum of changes between half an year before 2.4.0 and the moment of release 2.6.0.

So only the last odd versions are 2.7. (trunk branch) and the same for the fixes branch (2.6.1) and these versions reflect the current state of the day.

If you have specific problems with FPC related versioning in the Zeos-testing codebase, report them, and I'll fix them.

Posted: 20.09.2012, 12:46
by Stilgar
As you want. Sorry.

Posted: 20.09.2012, 14:53
by EgonHugeist
Stilgar,

Each proposal/patch is better then nothing or bad critics. Don't worry about. But i agree with Marco. It is much better to code/maintain with Property-Based defines. He did a great job there.

Thank you..

marcov,

I had not the time to write you. Thank you for answering this post.
I have a question list for you again. If i have it ready then i'll mail you.

Thank you too, Marco.