-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Lazarus Package file support to Indy 10.7 #576
base: Indy-10.7
Are you sure you want to change the base?
Conversation
Lib/System/IdWinsock2.pas
Outdated
@@ -158,6 +158,8 @@ interface | |||
|
|||
} | |||
|
|||
{$IFDEF WINDOWS} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IdWinsock2 is a Windows-only unit. It should not be compiled in other platforms. This check is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lazarus/fpc is a cross-platform write once environment and has a substantial number of Windows users. It is wrong to exclude a unit from a Lazarus package on the grounds that it can only be used in Windows.
Conditional compilation within the unit is the simplest way of allowing platform specific code to be part of a unit. The Lazarus IDE maintains package units automatically and platform specific units cannot be readily included in a package whilst compiling them only when the package is compiled on their target platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, you can edit the package's .pas file and defines for platforms.
See: https://wiki.lazarus.freepascal.org/Lazarus_Packages#Platform_specific_units
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True - but I've had the IDE overwrite my changes to the package's .pas file before now and I would not be comfortable publishing a package that relied on conditional defines in the package's .pas file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you also have to disable "Use Unit" after selecting it in the package editor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that all "Use Unit" does is to stop a using project from automatically including a dependent package's unit in its list of units.
The underlying problem is that the Lazarus package editor does not have a means of marking a unit as valid only for certain platforms. Hence, you have to include the conditional compilation in the unit itself. On the other hand, this problem does not seem to occur with FPC packages where (manually maintained) Makefiles are able to manage platform dependencies.
Lib/System/IdWship6.pas
Outdated
@@ -34,6 +34,7 @@ interface | |||
|
|||
{$I IdCompilerDefines.inc} | |||
|
|||
{$IFDEF WINDOWS} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IdWship6 is a Windows-only unit. It should not be compiled in other platforms. This check is redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lazarus/fpc is a cross-platform write once environment and has a substantial number of Windows users. It is wrong to exclude a unit from a Lazarus package on the grounds that it can only be used in Windows.
Conditional compilation within the unit is the simplest way of allowing platform specific code to be part of a unit. The Lazarus IDE maintains package units automatically and platform specific units cannot be readily included in a package whilst compiling them only when the package is compiled on their target platform.
lazarus-fpc/indysystem.pas
Outdated
|
||
uses | ||
IdBaseComponent, IdComponent, IdCTypes, IdException, IdGlobal, IdIDN, | ||
IdResourceStrings, IdResourceStringsDotNet11, IdResourceStringsIconv, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FreePascal does not support Dotnet and should not be compiling Indy's Dotnet units. Also, Indy does not use Iconv on Windows and so FreePascal should not compile Indy's Iconv units on Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the dotNet file, but I am confused by the reference to Iconv. I can't find a reference to IdIconv.pas in the lazarus packages - although there is a pointless reference to IdResourceStringsIconv,.
lazarus-fpc/indysystem.pas
Outdated
IdBaseComponent, IdComponent, IdCTypes, IdException, IdGlobal, IdIDN, | ||
IdResourceStrings, IdResourceStringsDotNet11, IdResourceStringsIconv, | ||
IdResourceStringsKylixCompat, IdResourceStringsTextEncoding, | ||
IdResourceStringsUnix, IdResourceStringsVCLPosix, IdStack, IdStackBSDBase, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VCLPosix is for Delphi only. FreePascal should not be compiling Indy's VCLPosix units. Also, FreePascal should not be compiling Unix units on Windows, and vice versa.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm that removing the VCLPosix units does not seem to affect the Lazarus packages on Linux or Windows and have removed them from the lazarus packages on my Indy10-7 branch.
lazarus-fpc/indysystem.pas
Outdated
IdResourceStringsKylixCompat, IdResourceStringsTextEncoding, | ||
IdResourceStringsUnix, IdResourceStringsVCLPosix, IdStack, IdStackBSDBase, | ||
IdStackConsts, IdStream, IdStreamVCL, IdStruct, IdTransactedFileStream, | ||
IdVCLPosixSupplemental, IdWinsock2, IdWship6, IdAntiFreezeBase, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IdWinsock2 and IdWship6 should not be compiled on non-Windows platforms. And Posix units should not be compiled on Windows.
This pull requests removes the out-of-date "getIndy.sh" and replaces it with a set of lazarus packages in the new subdir "lazarus-fpc". This packages have the same structure as the Delphi packages and do not require any changes to the source tree to be
used.
Makefile.fpc files are also provided for use with fpcmake.
See README.lazarus-fpc for more information.
There are also some minor patches to the source files in order to ensure that they can be compiled with FPC.