Difference between revisions of "Install Packages/pt"

From Free Pascal wiki
Jump to navigationJump to search
Line 24: Line 24:
  
  
Para instalar o pacote vá a Componentes > Abrir Arquivo de Pacote (LPK). Na caixa de diálogo seguinte vá a '''/usr/share/lazarus/components/sqldb''' ou ao diretório correspondente no Windows e escolha o arquivo '''sqldblaz.lpk'''. Se tudo for bem pode-se ver o Gerenciador de Pacotes. Ele está mostrando uma treeview com os arquivos do pacote e os pacotes requeridos. Pressione '''Compilar''' se você não quer instalar o componente no IDE, ou '''Instalar''' para o caso de querer.  
+
Para instalar o pacote vá a Componentes > Abrir Arquivo de Pacote (LPK). Na caixa de diálogo seguinte vá a '''/usr/share/lazarus/components/sqldb''' ou ao diretório correspondente no Windows e escolha o arquivo '''sqldblaz.lpk'''. Se tudo for bem pode-se ver o Gerenciador de Pacotes. Ele está mostrando uma treeview com os arquivos do pacote e os pacotes requeridos. Pressione '''Compilar''' se você não quiser instalar o componente no IDE ou '''Instalar''' se quiser.  
  
 
If everything went well you'll see a new tab called '''SQLdb'''. This tab will contain <strike>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 everything went well you'll see a new tab called '''SQLdb'''. This tab will contain <strike>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. :)

Revision as of 21:03, 8 March 2007

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

Devido à grande demanda, eis aqui uma primeira tentativa de um pequeno How-To de instalação de pacotes. Depois da instalação do Lazarus um grande número de iniciantes gostaria de saber onde estão os componentes de banco de dados. Pode-se ver um datasource e alguns componentes data aware, mas onde estão os componentes para conectar ao servidor de banco de dados e receber dados do servidor?

Arquivos instalados com o Lazarus

No Linux o Lazarus é instalado por padrão em /usr/share/lazarus, em Windows o instalador permite ao usuário escolher onde instalar os arquivos, desde que não haja espaços no caminho do arquivo. No meu Lazarus no Windows, está instalado em G:/Lazarus. Qualquer que seja o caminho de instalação do Lazarus, vão-se encontrar ali alguns subdiretórios. Neste caso, o primeiro subdiretório em ordem alfabética é o subdiretório Components.

Como se pode ver existem alguns subdiretórios nele que se referem a bancos de dados: Interbase, mysql, a sqlite e sqldb. Os 3 primeiros contêm componentes de conexão a bancos de dados e descendentes de TDataSet para o respectivo banco de dados. O último é o sqldb, que é mais genérico pois consistem de TSQLQuery (um TDataset) e TSQLTransaction, que são usados em todos os tipos de bancos de dados e T??Connection para fazer a conexão com o banco de dados. Neste artigo nós vamos instalar o pacote sqldb, junto com a conexão para Interbase.

O porquê

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 does not support dynamic linking, all libraries have to be compiled into the IDE. As you cannot expect every developer to have all databases installed it is not possible to install the connection components by default.

Mas Delphi ...?

Delphi also only installs 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.

Instalando alguma coisa

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. Press now Compile if you don't want to install the component into the IDE, otherwise you should 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 rebuilt, and depending on your configuration restarted.


Para instalar o pacote vá a Componentes > Abrir Arquivo de Pacote (LPK). Na caixa de diálogo seguinte vá a /usr/share/lazarus/components/sqldb ou ao diretório correspondente no Windows e escolha o arquivo sqldblaz.lpk. Se tudo for bem pode-se ver o Gerenciador de Pacotes. Ele está mostrando uma treeview com os arquivos do pacote e os pacotes requeridos. Pressione Compilar se você não quiser instalar o componente no IDE ou Instalar se quiser.

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. :)

Next time Lazarus is started the SQLdb tab also contains a component TIBConnection.

in the meantime all supported components.

Anything else?

Well that is all there is to it. You're now set to make your first program connecting to an Interbase server. See this sources to download with a small example. If you have any questions, go to the lazarus forum or post it to the lazarus mailing list.

Compile an IDE with packages at command line

There is no command line tool yet, to configure and setup the IDE config files to add/remove packages. You must setup this with an IDE, copy the configs and adapt the path. But the rest can be done on command line:

First build a normal IDE and LCL

 make clean all

Then compile the packages

The IDE can create a Makefile for a package (package editor -> compiler options -> compilation). The Makefile is updated on every compile of the package. Once you have this Makefile, go to every package directory and type 'make'.

Finally compile the IDE with the packages

 make idepkg