From ae0d0333b67ab790fca2f3ff4b3ead193e177ecd Mon Sep 17 00:00:00 2001 From: Remy Lebeau Date: Fri, 26 Apr 2024 14:13:51 -0700 Subject: [PATCH] Adding Lazarus package generator --- Builder/Package Generator/Package.pas | 2 +- .../Package Generator/PackageProtocols.pas | 10 +++++----- Builder/Package Generator/PackageVersInc.pas | 18 +++++++++++------- Builder/Package Generator/PkgGen.dpr | 19 +++++++++++++------ 4 files changed, 30 insertions(+), 19 deletions(-) diff --git a/Builder/Package Generator/Package.pas b/Builder/Package Generator/Package.pas index fa1625e34..534ce0ef6 100644 --- a/Builder/Package Generator/Package.pas +++ b/Builder/Package Generator/Package.pas @@ -232,7 +232,7 @@ function iif(ATest: Boolean; const ATrue: Boolean; const AFalse: Boolean): Boole IndyVersion_Major = 10; IndyVersion_Minor = 6; IndyVersion_Release = 3; - IndyVersion_Build = 1; + IndyVersion_Build = 2; implementation diff --git a/Builder/Package Generator/PackageProtocols.pas b/Builder/Package Generator/PackageProtocols.pas index b75b2940c..54526469c 100644 --- a/Builder/Package Generator/PackageProtocols.pas +++ b/Builder/Package Generator/PackageProtocols.pas @@ -392,24 +392,24 @@ procedure TPackageProtocols.GenerateRC(ACompiler: TCompiler; const AFlags: TGene FDesc := 'Protocols Run-Time'; FExt := '.rc.tmpl'; - inherited GenerateRC(ACompiler, AFlags - [gfDesignTime] + [gfTemplate]); + inherited GenerateRC(ACompiler, LFlags - [gfDesignTime] + [gfTemplate]); WriteFile; FExt := '.rc'; - inherited GenerateRC(ACompiler, AFlags - [gfDesignTime, gfTemplate]); + inherited GenerateRC(ACompiler, LFlags - [gfDesignTime, gfTemplate]); WriteFile; end; - if gfDesignTime in AFlags then begin + if gfDesignTime in LFlags then begin FName := 'dclIndyProtocols' + GCompilerID[ACompiler]; FDesc := 'Protocols Design-Time'; FExt := '.rc.tmpl'; - inherited GenerateRC(ACompiler, AFlags - [gfRunTime] + [gfTemplate]); + inherited GenerateRC(ACompiler, LFlags - [gfRunTime] + [gfTemplate]); WriteFile; FExt := '.rc'; - inherited GenerateRC(ACompiler, AFlags - [gfRunTime, gfTemplate]); + inherited GenerateRC(ACompiler, LFlags - [gfRunTime, gfTemplate]); WriteFile; end; end; diff --git a/Builder/Package Generator/PackageVersInc.pas b/Builder/Package Generator/PackageVersInc.pas index a3a851b0e..494baa39a 100644 --- a/Builder/Package Generator/PackageVersInc.pas +++ b/Builder/Package Generator/PackageVersInc.pas @@ -144,10 +144,14 @@ procedure TVersInc.Generate(ACompiler: TCompiler; const AFlags: TGenerateFlags); procedure TVersInc.GenIdVers; var FileVersion : string; - BuildStr: String; + MajorStr, MinorStr, ReleaseStr, BuildStr: String; begin FCode.Clear; + MajorStr := IntToStr(IndyVersion_Major); + MinorStr := IntToStr(IndyVersion_Minor); + ReleaseStr := IntToStr(IndyVersion_Release); + if FTemplate then BuildStr := '$WCREV$' else @@ -155,18 +159,18 @@ procedure TVersInc.GenIdVers; FileVersion := FProductVersion + '.' + BuildStr; - Code(' gsIdVersionMajor = ' + IntToStr(IndyVersion_Major) + ';'); + Code(' gsIdVersionMajor = ' + MajorStr + ';'); Code(' {$NODEFINE gsIdVersionMajor}'); - Code(' gsIdVersionMinor = ' + IntToStr(IndyVersion_Minor) + ';'); + Code(' gsIdVersionMinor = ' + MinorStr + ';'); Code(' {$NODEFINE gsIdVersionMinor}'); - Code(' gsIdVersionRelease = ' + IntToStr(IndyVersion_Release) + ';'); + Code(' gsIdVersionRelease = ' + ReleaseStr + ';'); Code(' {$NODEFINE gsIdVersionRelease}'); Code(' gsIdVersionBuild = ' + BuildStr + ';'); Code(' {$NODEFINE gsIdVersionBuild}'); Code(''); - Code(' (*$HPPEMIT ''#define gsIdVersionMajor ' + IntToStr(IndyVersion_Major) + '''*)'); - Code(' (*$HPPEMIT ''#define gsIdVersionMinor ' + IntToStr(IndyVersion_Minor) + '''*)'); - Code(' (*$HPPEMIT ''#define gsIdVersionRelease ' + IntToStr(IndyVersion_Release) + '''*)'); + Code(' (*$HPPEMIT ''#define gsIdVersionMajor ' + MajorStr + '''*)'); + Code(' (*$HPPEMIT ''#define gsIdVersionMinor ' + MinorStr + '''*)'); + Code(' (*$HPPEMIT ''#define gsIdVersionRelease ' + ReleaseStr + '''*)'); Code(' (*$HPPEMIT ''#define gsIdVersionBuild ' + BuildStr + '''*)'); Code(' (*$HPPEMIT ''''*)'); Code(''); diff --git a/Builder/Package Generator/PkgGen.dpr b/Builder/Package Generator/PkgGen.dpr index fd089ad2a..bfe2ff95e 100644 --- a/Builder/Package Generator/PkgGen.dpr +++ b/Builder/Package Generator/PkgGen.dpr @@ -98,6 +98,7 @@ uses PackageBuildRes in 'PackageBuildRes.pas', PackageVersInc in 'PackageVersInc.pas', PackageCleanCmd in 'PackageCleanCmd.pas', + PackageLazarus in 'PackageLazarus.pas', DModule in 'DModule.pas'; procedure Main; @@ -114,6 +115,11 @@ begin Exit; end; + LDebugFlag := []; + if FindCmdLineSwitch('debugPkgs') then begin + Include(LDebugFlag, gfDebug); + end; + WriteLn('Generating Visual Studio Package...'); with TPackageVisualStudio.Create do try @@ -121,15 +127,16 @@ begin Generate(ctDotNet); Load('DotNet=True, DesignUnit=False', True); - Generate(ctDotNet, [gfDebug]); + Generate(ctDotNet, [gfDebug]{LDebugFlag}); finally Free; end; - // TODO: Add a package generator for FreePascal/Lazarus packages and makefiles... + WriteLn('Generating Lazarus Package...'); - LDebugFlag := []; - if FindCmdLineSwitch('debugPkgs') then begin - Include(LDebugFlag, gfDebug); - end; + with TPackageLazarus.Create do try + // nothing to load from the database... + //Load('FPC=True, FPCListInPkg=True'); + Generate(ctUnversioned, []{LDebugFlag}); + finally Free; end; WriteLn('Generating D8 Master Package...');