PackageLazarus.pas 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. {
  2. $Project$
  3. $Workfile$
  4. $Revision$
  5. $DateUTC$
  6. $Id$
  7. This file is part of the Indy (Internet Direct) project, and is offered
  8. under the dual-licensing agreement described on the Indy website.
  9. (http://www.indyproject.org/)
  10. Copyright:
  11. (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved.
  12. }
  13. {
  14. $Log$
  15. }
  16. {
  17. { Rev 1.0 4/17/2024 5:22:00 PM RLebeau
  18. { indylaz.lpk generation.
  19. }
  20. unit PackageLazarus;
  21. interface
  22. uses
  23. Package;
  24. type
  25. TPackageLazarus = class(TPackage)
  26. private
  27. procedure GenLaz;
  28. public
  29. constructor Create; override;
  30. procedure Generate(ACompiler: TCompiler; const AFlags: TGenerateFlags); override;
  31. end;
  32. implementation
  33. uses
  34. SysUtils, DModule;
  35. { TBuildRes }
  36. constructor TPackageLazarus.Create;
  37. begin
  38. inherited;
  39. FName := 'indylaz';
  40. FOutputSubDir := 'Lib';
  41. end;
  42. procedure TPackageLazarus.Generate(ACompiler: TCompiler; const AFlags: TGenerateFlags);
  43. begin
  44. //We don't call many of the inherited Protected methods because
  45. //those are for Packages while I'm making a unit.
  46. //inherited;
  47. FCompiler := ACompiler;
  48. FDesignTime := False;
  49. FTemplate := True;
  50. FExt := '.lpk.tmpl';
  51. GenLaz;
  52. WriteFile;
  53. FTemplate := False;
  54. FExt := '.lpk';
  55. GenLaz;
  56. WriteFile;
  57. end;
  58. procedure TPackageLazarus.GenLaz;
  59. var
  60. BuildStr: String;
  61. begin
  62. FCode.Clear;
  63. if FTemplate then
  64. BuildStr := '$WCREV$'
  65. else
  66. BuildStr := IndyVersion_Build_Str;
  67. Code('<?xml version="1.0" encoding="UTF-8"?>');
  68. Code('<CONFIG>');
  69. Code(' <Package Version="5">');
  70. Code(' <PathDelim Value="\"/>');
  71. Code(' <Name Value="indylaz"/>');
  72. Code(' <Type Value="RunAndDesignTime"/>');
  73. Code(' <AddToProjectUsesSection Value="True"/>');
  74. Code(' <Author Value="Chad Z. Hower (Kudzu) and the Indy Pit Crew - http://www.indyproject.org/"/>');
  75. Code(' <CompilerOptions>');
  76. Code(' <Version Value="11"/>');
  77. Code(' <PathDelim Value="\"/>');
  78. Code(' <SearchPaths>');
  79. Code(' <IncludeFiles Value=".;Core;Protocols;System"/>');
  80. Code(' <OtherUnitFiles Value=".;Core;Protocols;System"/>');
  81. Code(' <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>');
  82. Code(' </SearchPaths>');
  83. Code(' <Parsing>');
  84. Code(' <SyntaxOptions>');
  85. Code(' <SyntaxMode Value="Delphi"/>');
  86. Code(' <UseAnsiStrings Value="False"/>');
  87. Code(' </SyntaxOptions>');
  88. Code(' </Parsing>');
  89. Code(' <Other>');
  90. Code(' <CustomOptions Value="$(IDEBuildOptions)');
  91. Code('-dDEBUG"/>');
  92. Code(' </Other>');
  93. Code(' </CompilerOptions>');
  94. Code(' <Description Value="Components for networking, Web services, protocols (SMTP, POP3, IMAP, NNTP, HTTP, FTP), sockets."/>');
  95. Code(' <License Value="Duel License');
  96. Code('');
  97. Code('MPL ');
  98. Code('');
  99. Code('Indy Modified BSD License');
  100. Code('Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:');
  101. Code('Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. ');
  102. Code('');
  103. Code('Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation, about box and/or other materials provided with the distribution. ');
  104. Code('');
  105. Code('No personal names or organizations names associated with the Indy project may be used to endorse or promote products derived from this software without specific prior written permission of the specific individual or organization. ');
  106. Code('');
  107. Code('THIS SOFTWARE IS PROVIDED BY Chad Z. Hower (Kudzu) and the Indy Pit Crew &amp;quot;AS IS&apos;&apos; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.');
  108. Code('"/>');
  109. Code(' <Version Major="' + IndyVersion_Major_Str + '" Minor="' + IndyVersion_Minor_Str + '" Release="' + IndyVersion_Release_Str + '" Build="' + BuildStr + '"/>');
  110. { TODO: update the DB And then uncomment this...
  111. var TotalCount := FUnits.Count;
  112. for I := 0 to FUnits.Count-1 do
  113. begin
  114. if DB.Ini.ReadBool(FUnits[I], 'FPCHasLRSFile', False) then begin
  115. Inc(TotalCount);
  116. end;
  117. end;
  118. Code(' <Files Count="' + IntToStr(TotalCount) + '">');
  119. var ItemNum := 1;
  120. for I := 0 to FUnits.Count-1 do
  121. begin
  122. var LDir := IncludeTrailingPathDelimiter(FDirs[i]);
  123. Code(' <Item' + IntToStr(ItemNum) + '>');
  124. Code(' <Filename Value="' + LDir + FUnits[I] + '.pas"/>');
  125. if LFiles[I].FPCHasRegProc then begin
  126. Code(' <HasRegisterProc Value="True"/>');
  127. end;
  128. Code(' <UnitName Value="' + FUnits[I] + '"/>');
  129. Code(' </Item' + IntToStr(ItemNum) + '>');
  130. Inc(ItemNum);
  131. if DB.Ini.ReadBool(FUnits[I], 'FPCHasLRSFile', False) then begin
  132. Code(' <Item' + IntToStr(ItemNum) + '>');
  133. Code(' <Filename Value="' + LDir + FUnits[I] + '.lrs"/>');
  134. Code(' <Type Value="LRS"/>');
  135. Code(' </Item' + IntToStr(ItemNum) + '>');
  136. Inc(ItemNum);
  137. end;
  138. end;
  139. Code(' </Files>');
  140. }
  141. Code(' <Files Count="16">');
  142. Code(' <Item1>');
  143. Code(' <Filename Value="Core\IdAboutVCL.pas"/>');
  144. Code(' <UnitName Value="IdAboutVCL"/>');
  145. Code(' </Item1>');
  146. Code(' <Item2>');
  147. Code(' <Filename Value="Core\IdAboutVCL.lrs"/>');
  148. Code(' <Type Value="LRS"/>');
  149. Code(' </Item2>');
  150. Code(' <Item3>');
  151. Code(' <Filename Value="Core\IdAntiFreeze.pas"/>');
  152. Code(' <UnitName Value="IdAntiFreeze"/>');
  153. Code(' </Item3>');
  154. Code(' <Item4>');
  155. Code(' <Filename Value="Core\IdCoreDsnRegister.pas"/>');
  156. Code(' <HasRegisterProc Value="True"/>');
  157. Code(' <UnitName Value="IdCoreDsnRegister"/>');
  158. Code(' </Item4>');
  159. Code(' <Item5>');
  160. Code(' <Filename Value="Core\IdDsnCoreResourceStrings.pas"/>');
  161. Code(' <UnitName Value="IdDsnCoreResourceStrings"/>');
  162. Code(' </Item5>');
  163. Code(' <Item6>');
  164. Code(' <Filename Value="Core\IdDsnPropEdBindingVCL.pas"/>');
  165. Code(' <UnitName Value="IdDsnPropEdBindingVCL"/>');
  166. Code(' </Item6>');
  167. Code(' <Item7>');
  168. Code(' <Filename Value="Protocols\IdDsnRegister.pas"/>');
  169. Code(' <HasRegisterProc Value="True"/>');
  170. Code(' <UnitName Value="IdDsnRegister"/>');
  171. Code(' </Item7>');
  172. Code(' <Item8>');
  173. Code(' <Filename Value="Protocols\IdDsnResourceStrings.pas"/>');
  174. Code(' <UnitName Value="IdDsnResourceStrings"/>');
  175. Code(' </Item8>');
  176. Code(' <Item9>');
  177. Code(' <Filename Value="Protocols\IdDsnSASLListEditorFormVCL.pas"/>');
  178. Code(' <UnitName Value="IdDsnSASLListEditorFormVCL"/>');
  179. Code(' </Item9>');
  180. Code(' <Item10>');
  181. Code(' <Filename Value="Protocols\IdDsnSASLListEditorFormVCL.lrs"/>');
  182. Code(' <Type Value="LRS"/>');
  183. Code(' </Item10>');
  184. Code(' <Item11>');
  185. Code(' <Filename Value="Protocols\IdRegister.pas"/>');
  186. Code(' <HasRegisterProc Value="True"/>');
  187. Code(' <UnitName Value="IdRegister"/>');
  188. Code(' </Item11>');
  189. Code(' <Item12>');
  190. Code(' <Filename Value="Protocols\IdRegister.lrs"/>');
  191. Code(' <Type Value="LRS"/>');
  192. Code(' </Item12>');
  193. Code(' <Item13>');
  194. Code(' <Filename Value="Core\IdRegisterCore.pas"/>');
  195. Code(' <HasRegisterProc Value="True"/>');
  196. Code(' <UnitName Value="IdRegisterCore"/>');
  197. Code(' </Item13>');
  198. Code(' <Item14>');
  199. Code(' <Filename Value="Core\IdRegisterCore.lrs"/>');
  200. Code(' <Type Value="LRS"/>');
  201. Code(' </Item14>');
  202. Code(' <Item15>');
  203. Code(' <Filename Value="System\IdStreamVCL.pas"/>');
  204. Code(' <UnitName Value="IdStreamVCL"/>');
  205. Code(' </Item15>');
  206. Code(' <Item16>');
  207. Code(' <Filename Value="System\IdStream.pas"/>');
  208. Code(' <UnitName Value="IdStream"/>');
  209. Code(' </Item16>');
  210. Code(' </Files>');
  211. Code(' <CompatibilityMode Value="True"/>');
  212. Code(' <RequiredPkgs Count="3">');
  213. Code(' <Item1>');
  214. Code(' <PackageName Value="LCL"/>');
  215. Code(' </Item1>');
  216. Code(' <Item2>');
  217. Code(' <PackageName Value="IDEIntf"/>');
  218. Code(' </Item2>');
  219. Code(' <Item3>');
  220. Code(' <PackageName Value="FCL"/>');
  221. Code(' <MinVersion Major="1" Valid="True"/>');
  222. Code(' </Item3>');
  223. Code(' </RequiredPkgs>');
  224. Code(' <UsageOptions>');
  225. Code(' <UnitPath Value="$(PkgOutDir)"/>');
  226. Code(' </UsageOptions>');
  227. Code(' <PublishOptions>');
  228. Code(' <Version Value="2"/>');
  229. Code(' </PublishOptions>');
  230. Code(' </Package>');
  231. Code('</CONFIG>');
  232. end;
  233. end.