[Lazarus] Creating packages - what to include?

Bo Berglund bo.berglund at gmail.com
Mon Dec 28 21:27:06 CET 2020

On Mon, 28 Dec 2020 18:31:54 +0100, Werner Pamler via lazarus
<lazarus at lists.lazarus-ide.org> wrote:

>You are talking of runtime code only. Here are instructions how to 
>create a Lazarus runtime package (I never created an FPC package...): Go 
>to "Package" > "New package", specify name and location of the new 
>package, an empty package will be created automatically. In the package 
>editor which opens right-click on "Files" and add all the files which 
>are supposed to be contained in the package. When the units that you 
>need depend on other units found in other packages you must add these 
>other packages to the node "Required Packages" (right-click, "Add"). 
>Then click "Compile". When everything is correct, go to "options" in the 
>package editor, and in "IDE Integration" select "Runtime package". This 
>means that the package is not installed into the IDE. Save, of course.
>In order to use this runtime package in a project, open the Project 
>Inspector, right-click on "Required Packages" and select your new 
>package to be added to the project tree. Now you can "use" all units of 
>this package.
>When you are on a new Lazarus installation the IDE does not yet know 
>your package. Go to "Package" > "Open Package File (*.lpk)". That's all 
>to be done so that the IDE knows the path to the package. When you 
>compile your project the package will be compiled as well. Of course you 
>can click "Compile" also in the Package Editor to make sure that your 
>package is correct in the new installation. There is no need to click 
>"Use" > "Install" for a runtime package.
>Coming from Delphi you may be tempted to extend the unit path by the 
>path to your package units. Do not do this - you will have lots of 
>trouble. The Lazarus package concept does not require you to set any paths.

I already have a subversion project "cmplaz" which contains a few
visual components. These are stored each in separate subdirectories as
different packages.
The cmplaz project is checked out from svn into the pcp config
directory just like onlinepackagemanager does.
And the visual components for lazarus are then installed in Lazarus

So now I added a new directory below cmplaz where I stored my first
runtime package (a serial port component based on the built-in serial
unit) with the pas file defining the class.

This worked fine so I am now going over the projects where it is used
and changing the usage to the package and removing the copied

Hopefully this will in the end reduce headaches with tracking changes.

Bo Berglund
Developer in Sweden

More information about the lazarus mailing list