[Lazarus] Installing packages using lazbuild - am I on the right path?

Mattias Gaertner nc-gaertnma at netcologne.de
Mon May 21 11:37:01 CEST 2012


On Mon, 21 May 2012 09:58:36 +0200
Reinier Olislagers <reinierolislagers at gmail.com> wrote:

> Hi all,
> 
> I'm trying to figure out how to set packages for
> installation/compilation in Lazbuild.
> 
> Goal: add packages to user IDE from command line using lazbuild.
> 
> I've looked around the code and started a rough hack to try and install
> the rx component when rebuilding the IDE.
> 
> I added this in TLazBuildApplication.BuildLazarusIDE:
> var
> ..
>   raotestpackage: TLazPackage;
>   PkgName: string;
>   APackage: TLazPackage;
>   ConflictDep: TPkgDependency;
> ...
> 

If the parameter is a file name, open the package.
If the parameter is a name, check it with IsValidIdent.

Add the package name to the list:

BuildLazProfiles.StaticAutoInstallPackages.Add('rx');


>   // try loading install packages
> PackageGraph.LoadAutoInstallPackages(BuildLazProfiles.StaticAutoInstallPackages);

This searches the lpk files and loads them.
The rest should already work.


>[...]
> While the code runs, nothing happens... and I'm sure just copy/pasting
> code from other parts without understanding what's going on isn't the
> fastest/surest way of getting things working.
> 
> Questions:
> 1. Am I on the right track?

It is easier than you think.

> 2. Is packagegraph a representation of all packages present in the IDE?

Yes. All loaded packages.
Additionally there are some lists of all lpk files the IDE has
ever seen. So it can load more if needed.


> 3. What do the package .AutoInstall types mean?

How the package is installed in the IDE.
At the moment you can only link a package statically. I hope
eventually fpc supports dynamic packages. So currently you can only use
"none" and "static".

> None: not installed,
> dynamic: needed as a dependency for other packages, static: always
> installed in IDE (e.g. because it is selected by the user)? Am I right
> in manipulating this property?

Not needed here.

Mattias




More information about the Lazarus mailing list