Difference between revisions of "Install Packages"

From Lazarus wiki
Jump to navigationJump to search
 
(34 intermediate revisions by 13 users not shown)
Line 1: Line 1:
==Overview==
+
{{Install Packages}}
  
Due to popular demand a first attempt to create a small "Install package HOW-TO"
+
== Adding packages using the IDE ==
After installation of Lazarus a lot of starters wonder where the components for Database manipulation are. You can see a datasource and some data aware component, but where are the compontents to connect to a database (server) and to retreive data from this server.
+
=== Adding known packages ===
Well lets have a look if we can find some of this stuff.
+
Open "Package -> Install/Uninstall Packages".
 +
The list on the left shows already installed packages or packages marked for installation (which have a green plus sign in their icon). The list to the right shows packages that you can install.
 +
Simply double-click on a package in either list to move them to the other - and mark them for installation/uninstall.
  
==Files installed with Lazarus==
+
Finally, click "Save and Rebuild" to rebuild the IDE and the packages.
  
Under Linux Lazarus gets installed by default in '''/usr/share/lazarus''', in Windows the installer gives you the choice where to install the files, as long as there are no spaces in its path. On my Windows PC Lazarus got installed in '''G:/Lazarus'''. Whatever the base path of your Lazarus installation is, you will find some subdirectories. In this case the first (alphabetically) sub directory looks rather promising to our goal as it is called '''components'''.
+
You can also compile and install packages the IDE knows nothing about. See below.
  
As you can see there are a few subdirectories here, which remind us of databases. One sees an '''Interbase''', a '''mysql''', a '''sqlite''' and a '''sqldb''' directory. The first three contain database connection components and TDataset descendants for the respectiv databases. The last one '''sqldb''' is more generic, as it consists of TQuery (a TDataset) and TSQLTransaction which are used for all types of databases and a T??Connection to make the connection to the database.
+
=== Adding new packages ===
In this article we will install the sqldb-package together with the connection for Interbase.
+
The package should have come with a number of source files, especially one with a .lpk extension. To install this package one goes to "Package -> Open Package File (.lpk)".
 +
Navigate to the folder containing the .lpk file and open it.  If everything works out as planned you will see the Package Manager. The Package Manager shows a treeview with the files in the package and the required packages.
  
==The real work==
+
If you don't want to install the component into the IDE, e.g. because it is a non graphical component, press '''Compile'''.
===First: the why===
+
Otherwise you should press '''Use >>''' and then choose '''Install'''. Next we get a warning about Lazarus only supporting static linked libraries and the question if you want to rebuild Lazarus. Just press Yes and sit back. Lazarus will be rebuilt, and depending on your configuration restarted.
Before we start installing a package I like to discuss the why of Lazarus not installing database connection components. Database connection components need the client libraries to be available on the PC where the components are used. Because of the fact that at the moment Lazarus doesnot support dynamic linking all libraries have to be compiled into the IDE. As you cannot expect every developper to have all databases installed it is not possible to install the connection components by default.
 
===Second: But Delphi ...?===
 
Delphi also installs only the database components which are readily available on the computer (ADO components) and components which do not need any client libraries (BDE: Paradox, DBase) to be installed.
 
===Third: Lets install some stuff===
 
To install a package one goes to Components -> Open Package File (.lpk)
 
In the following dialog you navigate to '''/usr/share/lazarus/components/sqldb''' or the corresponding directory under Windows and choose the '''sqldblaz.lpk''' file. If everything works out as planned you will see the Package Manager. The Package Manager is showing a treeview with the files in the package and the Required Packages. Nothing to worry about lets just press '''Compile''' and when the compilation is finished press '''Install'''. Next we get a warning about Lazarus only supporting static linked libraries and the question if you want to rebuild Lazarus. Just press Yes and sit back. Lazarus will be rebuild and depending on your configuration restarted.
 
  
If everything went well you'll see a new tab called '''SQLdb'''. This tab will contain two components a TSQLConnection and a TSQLQuery. What we need next is a Connection component. Once again go to Components -> Open Package File and navigate to '''/usr/share/lazarus/components/sqldb/interbase'''. Open the ibconnectionlaz.lpk file and again press Compile and Install and Yes. :)
+
If the package was a graphical component, and you selected the '''Use >>''' option, you should now have a new tab in your IDE by which you can add that component to your project.
  
Next time Lazarus is started the SQLdb tab also contains a component TIBConnection.  
+
=== New versions ===
 +
When receiving a new source version of an already installed package, you must
 +
#overwrite the previous source version with the new version
 +
#either open the new .lpk and press '''Use >>''' and then choose '''Install''' as above,<br>or rebuild the IDE using the menu "Tools" -> "Build Lazarus with Profile [...]" if you want more control on how the package is compiled.
  
==Anything else?==
+
== Compile an IDE with packages at command line ==
Well that is all there is to it. You're now set to make your first program connecting to an Interbase server. I'll try and get some sources to download with a small example. For now if you have any questions, use the lazarus [http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=index forum] or the lazarus mailing list.
+
You can use [[lazbuild]] to compile and install your package, and add --build-ide to rebuild the IDE.
  
==Originbal contributors and changes==
+
== Questions ==
* Initial creation 20050328 by [[user:Matthijs Matthijs Willemstein]]
+
If you have any questions, go to the lazarus [http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=index forum] or post it to the Lazarus mailing list.
 +
 
 +
==See also==
 +
 
 +
* [[Lazarus Packages]]
 +
* [[Install IDE packages without the IDE]]
 +
 
 +
[[Category:Lazarus]]
 +
[[Category:Tutorials]]

Latest revision as of 17:08, 13 April 2017

Deutsch (de) English (en) español (es) français (fr) magyar (hu) 日本語 (ja) português (pt) русский (ru) slovenčina (sk) 中文(中国大陆)‎ (zh_CN) 中文(台灣)‎ (zh_TW)

Adding packages using the IDE

Adding known packages

Open "Package -> Install/Uninstall Packages". The list on the left shows already installed packages or packages marked for installation (which have a green plus sign in their icon). The list to the right shows packages that you can install. Simply double-click on a package in either list to move them to the other - and mark them for installation/uninstall.

Finally, click "Save and Rebuild" to rebuild the IDE and the packages.

You can also compile and install packages the IDE knows nothing about. See below.

Adding new packages

The package should have come with a number of source files, especially one with a .lpk extension. To install this package one goes to "Package -> Open Package File (.lpk)". Navigate to the folder containing the .lpk file and open it. If everything works out as planned you will see the Package Manager. The Package Manager shows a treeview with the files in the package and the required packages.

If you don't want to install the component into the IDE, e.g. because it is a non graphical component, press Compile. Otherwise you should press Use >> and then choose Install. Next we get a warning about Lazarus only supporting static linked libraries and the question if you want to rebuild Lazarus. Just press Yes and sit back. Lazarus will be rebuilt, and depending on your configuration restarted.

If the package was a graphical component, and you selected the Use >> option, you should now have a new tab in your IDE by which you can add that component to your project.

New versions

When receiving a new source version of an already installed package, you must

  1. overwrite the previous source version with the new version
  2. either open the new .lpk and press Use >> and then choose Install as above,
    or rebuild the IDE using the menu "Tools" -> "Build Lazarus with Profile [...]" if you want more control on how the package is compiled.

Compile an IDE with packages at command line

You can use lazbuild to compile and install your package, and add --build-ide to rebuild the IDE.

Questions

If you have any questions, go to the lazarus forum or post it to the Lazarus mailing list.

See also