Sign in Join
Wiki copytemporary

Lazarus Packages/fr: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11# Vue d'ensemble du système de paquet de Lazarus
22
33## Qu'est-ce qu'un paquet de Lazarus ?
44
55Un paquet de Lazarus est une collection d'unités et de composants, contenant de l'information sur comment ils peuvent être compilés et comment ils peuvent être employés par des projets ou d'autres paquets ou l'ide. Contrairement à Delphi, les paquets ne sont pas limités aux bibliothèques et ils peuvent être indépendant de l'OS . ([[packages|Les paquets de Delphi]] sont des bibliothèques spécialement compilées utilisé par des applications, l'ide ou tous les deux. Les paquets Delphi exigent un support interne au compilateur, ce que FPC n'est pas capable de faire en ce moment et naturellement cette prouesse est dépendante du système d'exploitation.)
66
77Actuellement le compilateur [[Free Pascal/fr|Free Pascal]] supporte seulement les paquets statiques. Par conséquent vous devez compiler puis redémarrer l'IDE, chaque fois qu'un paquet est installé ou désinstallé.
88
99Un paquet Lazarus est identifié/distingué par son nom et sa version.
1010
1111## FAQ
1212
1313Q: Dois-je installer un paquet ?\
1414A: Vous devez seulement installer un paquet , s'il contient des items designtime, comme des composants pour la palette de composants de l'IDE. Si vous n'employez pas ces items, vous n'avez pas besoin d'installer le paquet. Si vous voulez seulement employer un paquet dans votre projet, ne l'installer pas.
1515
1616Q: J'ai installé un paquet, mais l'IDE n'a pas trouvé les unités\
1717A: Le fait d'installer un paquet signifie que le paquet est intégré à l'IDE, non votre projet. Ce sont des choses séparées . Pour utiliser un paquet dans votre projet, utilisez Projet -\> Inspecteur de projet -\> Ajouter -\> Nouvelle condition. Et désinstallez le paquet s'il ne contient aucun gadget pour l'IDE.
1818
1919## Quick Start
2020
2121To see the packagesystem in action and to get used to it, do the following:
2222
2323Creating a new package:
2424
2525- File-\>New... -\> Package -\> Standard Package
2626- A package editor opens
2727- Use the Save button at top left.
2828- Depending on your 'naming' setting in the 'environment options', the IDE will ask you to save the file lowercase. Say yes.
2929
3030Congratulations: You have just created your first package!
3131
3232Adding a new component:
3333
3434- Use the Add button -\> New component
3535- Choose a component in the ancestor type combobox. For instance: TBevel.
3636- Click Ok
3737- The file will be added to the package and opened in the editor
3838- Install the package by clicking the 'install' button in the top of the package editor.
3939- Lazarus will save the package and ask you, if the IDE should be rebuilt. Say yes.
4040- The packages are statically linked, so a restart of the IDE is needed.
4141- Restart Lazarus and see your new component in the component palette (For example: A TBevel1 will be on the 'Additional' page).
4242- If you do not see your new component in the component palette, it is most likely that you are not running the re-compiled version of Lazarus. You can set where Lazarus builds to in: Environment -\> Environment options -\> Files -\> Lazarus directory. Instead of calling lazarus directly, you also can use startlazarus, which starts the newly created lazarus, for example the lazarus executable in the ~/.lazarus directory, if you don't have write access to the directory lazarus was installed into.
4343
4444Congratulations: You have just installed your first package with your first package component.
4545
4646## The IDE menu items for packages:
4747
4848- File-\>New... -\> Package -\> Standard Package
4949
5050Creates a new package.
5151
5252- Project -\> Project Inspector
5353
54-` Here you can see, what packages are required by the currently open project.`\
55-` You can add new dependencies and remove unneeded ones.`
54+```text
55+ Here you can see, what packages are required by the currently open project.
56+ You can add new dependencies and remove unneeded ones.
57+```
5658
5759- Run -\> Compiler options -\> Inherited
5860
59-` Here you can see what compiler options are inherited from which package.`
61+``` pascal
62+ Here you can see what compiler options are inherited from which package.
63+```
6064
6165Components -\>
6266
63-` - 'Open package'`\
64-`   A dialog shows all open packages with their state.`\
65-`   `\
66-` - 'Open package file'`\
67-`   Open a .lpk file`
67+```text
68+ - 'Open package'
69+ A dialog shows all open packages with their state.
70+
71+ - 'Open package file'
72+ Open a .lpk file
73+```
6874
69-` - 'Open package of current unit'`\
70-`   Open the .lpk file, that belongs to the file in the source editor`\
71-`   `\
72-` - 'Open recent package'`\
73-`   Open a recently open package file (lpk file)`
75+``` pascal
76+ - 'Open package of current unit'
77+ Open the .lpk file, that belongs to the file in the source editor
78+
79+ - 'Open recent package'
80+ Open a recently open package file (lpk file)
81+```
7482
75-` - 'Add active unit to a package'`\
76-`   Adds the unit in the source editor to a package`\
77-`   `\
78-` - 'Package Graph'`\
79-`   The package graph shows all open packages and their dependencies.`
83+``` pascal
84+ - 'Add active unit to a package'
85+ Adds the unit in the source editor to a package
86+
87+ - 'Package Graph'
88+ The package graph shows all open packages and their dependencies.
89+```
8090
81-` - 'Configure installed packages'`\
82-`   Edit the list of packages installed in the IDE. Install or uninstall several packages at once.`
91+```text
92+ - 'Configure installed packages'
93+ Edit the list of packages installed in the IDE. Install or uninstall several packages at once.
94+```
8395
8496Project -\> Project Inspector
8597
86-` Here you can see and edit all packages used by the project.`
98+```text
99+ Here you can see and edit all packages used by the project.
100+```
87101
88102## The theory
89103
90104Each Lazarus package has a .lpk file. A package is identified by its name and its version. The name must correspond to the lpk filename. For example:
91105
92106Name: Package1, Version: 1.0, Filename: /home/.../package1.lpk.
93107
94108- The IDE automatically creates the main source file (package1.pas). See below. The lpk file contains information about the required packages, the files it uses, how to compile them, and what is needed to use the package by other packages/projects. The directory where the lpk file is, is called the "package directory".
95109- The IDE maintains a list of all package files (\<config directory\>/packagelinks.xml). Everytime a package is opened in the IDE it will be added to this list. When a package is opened, the IDE automatically opens all required packages via this list.
96110- There are three base packages: FCL, LCL and SynEdit. These are parts of the IDE and so they are autocreated, readonly and have no lpk file.
97111- Normally a package has a source directory with some pascal units. And normally the lpk file will be there too. A package has also an output directory. Default is the subdirectory 'lib/\$(TargetCPU)-\$(TargetOS)/' in the package directory.
98112- Before a package is compiled the IDE checks all required packages and if they need update and have the auto update flag, they are compiled first. Then the IDE creates the package main source file. If the lpk file was package1.lpk, then the main source file is package1.pas. This file contains all units in the uses section plus a 'Register' procedure, which is called in the intialization section.
99113
100114For example:
101115
102-`This file was automatically created by Lazarus. Do not edit!`\
103-`This source is only used to compile and install`\
104-`the package GTKOpenGL 1.0.`\
105-` unit GTKOpenGL;`\
106-`interface`\
107-`uses GTKGLArea, GTKGLArea_Int, NVGL, NVGLX, LazarusPackageIntf;`\
108-`implementation`\
109-`procedure Register;`\
110-`begin`\
111-`  RegisterUnit('GTKGLArea', @GTKGLArea.Register);`\
112-`end;`\
113-`initialization`\
114-`  RegisterPackage('GTKOpenGL', @Register)`\
115-`end.`
116+``` pascal
117+This file was automatically created by Lazarus. Do not edit!
118+This source is only used to compile and install
119+the package GTKOpenGL 1.0.
120+unit GTKOpenGL;
121+interface
122+uses GTKGLArea, GTKGLArea_Int, NVGL, NVGLX, LazarusPackageIntf;
123+implementation
124+procedure Register;
125+begin
126+ RegisterUnit('GTKGLArea', @GTKGLArea.Register);
127+end;
128+initialization
129+ RegisterPackage('GTKOpenGL', @Register)
130+end.
131+```
116132
117133- Then the compiler is called and the package is compiled to the output directory.
118134- After successful compilation the state file is created. The state file is put into the output directory. It has the name \<packagename\>.compiled and contains the information, how the package was compiled. This state file is used by the IDE to check if update is needed.
119135
120136For example: gtkopengl.compiled:
121137
122-`<?xml version="1.0"?>`\
123-`<CONFIG>`\
124-`  <Compiler Value="/usr/bin/ppc386" Date="781388725"/>`\
125-`  <Params Value=" -Rintel -S2cgi -CD -Ch8000000 -OG1p1`\
126-`    -Tlinux -gl -vewnhi -l -Fu../../../lcl/units`\
127-`    -Fu../../../lcl/units/gtk -Fu../../../packager/units`\
128-`    -Fu. -FElib/ gtkopengl.pas"/>`\
129-`</CONFIG>`
138+```text
139+<?xml version="1.0"?>
140+<CONFIG>
141+ <Compiler Value="/usr/bin/ppc386" Date="781388725"/>
142+ <Params Value=" -Rintel -S2cgi -CD -Ch8000000 -OG1p1
143+ -Tlinux -gl -vewnhi -l -Fu../../../lcl/units
144+ -Fu../../../lcl/units/gtk -Fu../../../packager/units
145+ -Fu. -FElib/ gtkopengl.pas"/>
146+</CONFIG>
147+```
130148
131149- The IDE opens all needed packages automatically. This means, it opens all installed packages, all packages marked for installation (auto install), all packages with an open Editor, all packages required by the project and all packages required by one of the other packages. Unneeded packages are automatically unloaded, when the IDE becomes idle.
132150- The IDE never opens two packages with the same name at the same time. When the user opens another package file with the same name as an already opened package the IDE will ask to replace the old one.
133151- The IDE maintains two extra sets of packages: The 'installed' packages and the 'auto install' packages. The auto install packages will be linked into the IDE on next compile. It creates two new files in the config directory: staticpackages.inc and idemake.cfg. Then it calls 'make ide OPT=@/path/to/your/config/idemake.cfg' to compile itself.
134152
135153## Hints and Tips
136154
137155Please add any hints, tips or gotchas here.
138156
139157- To rename a package, use 'save as'.
140158
141159Example
142160
143-`I will use the tiOPF framework as an example  The tiOPF has the`\
144-`following directory layout, due to the fact that it compiles for FPC,`\
145-`Delphi 5-7, D2005 and D2006.`\
161+``` pascal
162+I will use the tiOPF framework as an example The tiOPF has the
163+following directory layout, due to the fact that it compiles for FPC,
164+Delphi 5-7, D2005 and D2006.
146165
147-`Source                <= full path \Programming\3rdParty\tiOPF\Source`\
148-` \Compilers`\
149-`    \Delphi7          <= Delphi 7 package files live here`\
150-`    \D2005`\
151-`    \FPC              <= the tiOPF.lpk lived here`\
152-` \Core                <= core unit files`\
153-` \Options             <= optional unit file for extra features`\
154-` \GUI`\
166+Source <= full path \Programming\3rdParty\tiOPF\Source
167+ \Compilers
168+ \Delphi7 <= Delphi 7 package files live here
169+ \D2005
170+ \FPC <= the tiOPF.lpk lived here
171+ \Core <= core unit files
172+ \Options <= optional unit file for extra features
173+ \GUI
155174
156-`Using this example, I included in the "Options - Usage - Units"`\
157-`editbox the following paths:`\
158-`"$(PkgOutDir);..\..\Core;..\..\Options;..\..\GUI" which will be added`\
159-`to whatever project uses this package.`
175+Using this example, I included in the "Options - Usage - Units"
176+editbox the following paths:
177+"$(PkgOutDir);..\..\Core;..\..\Options;..\..\GUI" which will be added
178+to whatever project uses this package.
179+```
160180
161181## Contributors and Comments
162182
163183This page has been converted from the epikwiki [version](http://lazarus-ccr.sourceforge.net/index.php?wiki=LazarusPackages).
164184
165185---
166186*From the Free Pascal wiki, page "Lazarus Packages/fr", as it stood on 2007-07-21 after a change by Paulatreides, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history