Difference between revisions of "Getting Lazarus"

From Lazarus wiki
Jump to navigationJump to search
 
(265 intermediate revisions by 44 users not shown)
Line 1: Line 1:
== Via SVN ==
+
{{Getting Lazarus}}
=== Getting SVN ===
 
You may download a SVN Client for Windows in http://tortoisesvn.tigris.org/
 
A SVN command line client is available from the official SVN [http://subversion.tigris.org/| website] for many platforms including Linux and Windows.
 
  
=== Using SVN ===
+
==Download and install Lazarus release version==
To get Lazarus for the first time:
 
  
Open a terminal/command prompt, change to the directory you wish the Lazarus folder to be created in and type:
+
=== From SourceForge ===
  svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus
 
  
To update Lazarus sources:
+
Binary releases for various platforms are available via the [https://sourceforge.net/projects/lazarus/files/ Lazarus Sourceforge download area].
 +
 
 +
For people who are blocked by SF, the Lazarus releases from Sourceforge are mirrored at:
 +
*ftp://ftp.freepascal.org/pub/lazarus/releases/
 +
*and later at (after some time for synchronization) http://michael-ep3.physik.uni-halle.de/Lazarus/releases/
 +
*and http://mirrors.iwi.me/lazarus/
 +
 
 +
=== Specific for platform ===
 +
 
 +
Get Lazarus for Windows - use the Sourceforge link above.
 +
 
 +
[[ReactOS|Get Lazarus for ReactOS]]
 +
 
 +
[[Lazarus release version for Ubuntu|Get Lazarus for Ubuntu]]
 +
 
 +
[[Install_on_Fedora|Get Lazarus for Fedora]]
 +
 
 +
[[Lazarus release version for Suse|Get Lazarus for Suse]]
 +
 
 +
[[Scientific Linux|Get Lazarus for Scientific Linux]]
 +
 
 +
[[Lazarus on Raspberry Pi|Get Lazarus for Raspberry Pi (Raspbian)]]
 +
 
 +
[[Installing Lazarus on macOS|Get Lazarus for Mac]]
 +
 
 +
[[Lazarus on Solaris]]
 +
 
 +
== Getting a Git client ==
 +
 
 +
=== TortoiseGit client ===
 +
 
 +
TortoiseGit Client is for Windows only. You may download it from https://tortoisegit.org/
 +
 
 +
=== Git for Windows ===
 +
 
 +
Command line clients:
 +
 
 +
https://gitforwindows.org/
 +
https://git-scm.com/download/win
 +
 
 +
=== Other clients ===
 +
 
 +
A GIT command line client is available from https://git-scm.com/downloads for many platforms.
 +
 
 +
On Linux, it is recommended to install ''git'' using the package management system offered by your distribution. For example:
 +
 
 +
sudo apt-get install git
 +
 
 +
==Getting Lazarus from the GitLab server==
 +
 
 +
===Development version of Lazarus===
 +
To get Lazarus for the first time, using command line:
 +
  <nowiki>git clone https://gitlab.com/freepascal.org/lazarus/lazarus.git lazarus</nowiki>
 +
A new directory "lazarus" is then created under the current directory.
 +
 
 +
===Fixes branch of latest Lazarus release===
 +
 
 +
Change into the directory created by the above '''git clone''' command and run
 +
  <nowiki>git switch  fixes_2_2</nowiki>
 +
 
 +
Amending the name of the branch according to what fixes version you want.
 +
Get a list with
 +
  <nowiki>git branch --all</nowiki>
 +
The output will contain lines similar to
 +
  <nowiki>remote/origin/fixes_2_2</nowiki>
 +
The name of the branch is just the last part.
 +
 
 +
 
 +
===Update the sources later===
  
 
Open a terminal/command prompt, change to the lazarus directory and type:
 
Open a terminal/command prompt, change to the lazarus directory and type:
   svn update
+
   git switch main
 +
  git pull
 +
 
 +
instead of main, you may want to specify a fixes branch.
 +
 
 +
For compiling see [[#Compiling_and_running_Lazarus|this]].
 +
 
 +
==Scripts==
 +
 
 +
There are scripts for Windows and Linux to automate downloading and building Lazarus: [[LazarusScripts|Scripts for Lazarus]]
 +
 
 +
==Compiling and running Lazarus==
 +
 
 +
See [[Installing Lazarus]] - a detailed installation guide.
 +
 
 +
===Using the command-line===
 +
 
 +
Lazarus is shipped with an autogenerated '''Makefile''' (of the name "Makefile") for the gnu "'''make'''" utility.
 +
{{Warning|If you also have Embarcadero (or Borland) tools installed, their "make" might conflict with gnu "make". In that case you can either delete or rename the conflicting Embarcadero binary, or remove its directory from Windows PATH, or set the path in the console before calling ''make'':
 +
<pre>
 +
set path=c:\pascal\3.2.0\bin\i386-win32;%path%
 +
</pre>
 +
}}
 +
 
 +
{{Warning|"make" may also fail, if you have a shell (such as sh.exe) in your path. It depends on how this shell interprets quotes and backslashes.
 +
}}
 +
 
 +
'''make''' allows you to compile Lazarus from command-line easily. You need to have fpc and fpc-packages installed and configured first.
 +
 
 +
To compile go to Lazarus directory in your terminal and type
 +
  '''make'''
 +
 
 +
This should rebuild LCL and Lazarus IDE with basic packages installed.
 +
 
 +
Another useful command is
 +
  '''make bigide'''
 +
which adds the same packages that the release version has.
 +
 
 +
Then you can run Lazarus from within the same source directory with command "lazarus" (in Unix systems "./lazarus").
 +
 
 +
In case you want to run several versions, you can direct lazarus to use use specific configuration directories via the --pcp option, e.g. :
 +
lazarus --pcp=/home/YOU/myLaz19
 +
 
 +
===Make targets===
 +
====make help====
 +
 
 +
To see a list of available targets for '''''make''''' type [[make help]]. Note: "'''make help'''" exists since 1.0. Here is the output of "'''make help'''":
 +
 
 +
 
 +
<syntaxhighlight  lang="bash">
 +
make help
 +
 
 +
Main targets
 +
                  Without any target, target 'all' will be invoked.
 +
  all            build all needed, i.e. minimal IDE, lazbuild, startlazarus.
 +
  clean          deletes files that 'bigide' creates. It does not clean up all possible
 +
                  targets. Clean other target: make clean LCL_PLATFORM=qt
 +
  distclean      Clean all targets and common leftovers.
 +
  lazbuild      build lazbuild and lcl with nogui widgetset
 +
  bigide        as all, except that the IDE is built with a lot of extra packages
 +
  useride        calls lazbuild to build an IDE with your active profile, requires lazbuild
 +
  install        installs Lazarus under /usr/local/share/lazarus
 +
                  You can change the directory by appending INSTALL_PREFIX=/some/path
 +
 
 +
Sub targets
 +
  registration  build package FCL
 +
  lazutils      build package LazUtils, requires registration
 +
  codetools      build package CodeTools, requires lazutils
 +
  lcl            build package LCLBase and LCL, requires lazutils
 +
  tools          build lazres, svn2revisioninc, updatepofiles, lrstolfm,
 +
                  requires LCL with nogui widgetset
 +
  basecomponents build debuggerintf, lazdebuggergdbmi, lazcontrols, synedit, ideintf
 +
                  for the LCL_PLATFORM, requires lcl
 +
  bigidecomponents build many extra packages for the LCL_PLATFORM, requires basecomponents
 +
  lhelp          build lhelp, requires bigidecomponents
 +
  starter        build startlazarus, requires basecomponents
 +
  examples      build basic examples, requires basecomponents                                                                                                       
 +
                  Note: There are more examples having their own directory                                                                                           
 +
                                                                                                                                                                     
 +
Flags:                                                                                                                                                               
 +
  PP=/path/to/fpc        use another compiler                                                                                                                       
 +
  USESVN2REVISIONINC=0  do not update ide/revision.inc                                                                                                             
 +
  INSTALL_PREFIX=/usr    used by 'install' as path prefix                                                                                                           
 +
  FPC_DIR=/usr/share/fpcsrc/3.0.4  used by fpcmake when regenerating Makefiles                                                                                     
 +
  OPT='-vwnbq -gh'      append these options when calling the compiler                                                                                             
 +
                                                                                                                                                                     
 +
Usage examples:                                                                                                                                                     
 +
                                                                                                                                                                     
 +
Update svn and build a minimal IDE, startlazarus and lazbuild:                                                                                                     
 +
  make clean                                                                                                                                                         
 +
  svn up                                                                                                                                                             
 +
  make clean all                                                                                                                                                     
 +
                                                                                                                                                                     
 +
Note: You can start lazarus with 'startlazarus'                                                                                                                     
 +
Note: Use the IDE or lazbuild to compile your projects/packages.                                                                                                     
 +
                                                                                                                                                                     
 +
Update svn and build an IDE with your last set of packages:                                                                                                       
 +
  make clean                                                                                                                                                         
 +
  svn up                                                                                                                                                             
 +
  make clean lazbuild useride                                                                                                                                       
 +
                                                                                                                                                                     
 +
Clean up:                                                                                                                                                           
 +
  There is no command to clean up a svn repository completely, but                                                                                                   
 +
  you can use the following command under Linux/OS X:                                                                                                                 
 +
  svn status | grep '\?' | sed -e 's/\? *//' | xargs rm -r                                                                                                           
 +
                                                                                                                                                                     
 +
  Another possibility is to create a clean copy via the svn export command.                                                                                           
 +
                                                                                                                                                                     
 +
Install:                                                                                                                                                             
 +
  Note: You can use Lazarus without installing. Just start the lazarus executable.                                                                                   
 +
  1. Build Lazarus as normal user with one of the above commands.                                                                                                   
 +
  2. Install as root into /usr                                                                                                                                       
 +
          sudo make install
 +
      This installs startlazarus, lazarus-ide, lazbuild under /usr/bin
 +
      and copies the whole lazarus source directory to /usr/share/lazarus
 +
 
 +
</syntaxhighlight>
 +
 
 +
===Make parameters===
 +
There are additional parameters which can be used to '''make''' Lazarus. See a fully working example above.
 +
 
 +
* '''OPT'''=%compiler_switches
 +
the %compiler_switches is passed to each fpc call. The option is useful for specifying defines
 +
 
 +
For example:
 +
  make bigide OPT="-dNoGdkPixBufLib -gw2"
 +
makes LCL and ide with NoGdkPixBufLib defined and dwarf2 debug info.
 +
 
 +
* '''LCL_PLATFORM'''=%platform
 +
%platform is the target [[Widgetset|widgetset]]. It can be win32,wince,gtk,gtk2,qt,carbon,cocoa,customdrawn.
  
 +
For example:
 +
  make LCL_PLATFORM=gtk2
 +
Rebuilds LCL and IDE for gtk2 widgetset
  
 +
* '''FPC'''=%compiler_path
 +
or
 +
* '''PP'''=%compiler_path
 +
%compiler_path is the path+filename to a custom compiler binary you want to build the target with.
  
[[user:Lightning|Lightning]]:
+
such as:
Here is a windows batch script that takes care of checking out and updating '''Lazarus''' from '''SVN''' to a subdirectory and even basic error fixing, because i have no way of knowing where Lazarus is installed it cannot compile or copy the files to your working Lazarus instalation.
 
Please save the script as '''getlaz.bat''' or some other name, however there is no warranty of any kind, use at your own risk, put it in a test directory first and make sure there is no subdirectory already called '''lazarus'''.
 
  
  @REM Script for checkout and update Lazarus from SVN
+
  make FPC="~/Pfad/fpc"
@echo.
 
 
@REM Check if lazarus directory exists to update or checkout first
 
@if not exist lazarus goto CheckoutLaz
 
@echo Updating Lazarus, please wait ...
 
@cd lazarus
 
svn update
 
@if not %errorlevel% == 0 goto CleanupLaz
 
@cd..
 
@goto Exit
 
 
:CheckoutLaz
 
@echo Checking out Lazarus for the first time, this might take a while ...
 
svn checkout http://svn.freepascal.org/svn/lazarus/trunk lazarus
 
@goto Exit
 
 
:CleanupLaz
 
@echo.
 
@echo Something went wrong, trying to fix any problems if possible  ...
 
svn cleanup
 
@if not %errorlevel% == 0 goto CleanupFailedLaz
 
@cd..
 
@echo.
 
@echo Cleanup complete please run the script again.
 
goto Exit
 
:CleanupFailedLaz
 
@cd..
 
@echo.
 
@echo Cleanup Failed ! Please check or delete/move/rename the lazarus subdirectory ...
 
 
:Exit
 
  
 +
==Browse the Source Repository with a Web Browser==
  
[[user:Matthijs|Matthijs]]:
+
The contents of the GIT repro can also be browsed with your web-browser through [https://gitlab.com/freepascal.org/lazarus/lazarus/-/tree/main interface].
'''WARNING: This script is still assuming lazarus has its source in a CVS repository'''
 
In Linux I use a script (it is not very sophisticated, but does the trick) to download the latest CVS-version for Lazarus. Before I copy it here I'll explain my system.
 
In my home-directory I have a special cvsroot-directory. In this directory I have a script for downloading Lazarus and other interesting projects. Lazarus is installed in /usr/share/lazarus. Before building a new version from CVS I make a backup, just in case the current cvs is unstable. This is done by moving the /usr/share/lazarus directory to /usr/share/lazarus.bu
 
To adapt the script to your system you only need to alter the constants defined at the start of the script.
 
But without further ado, here is the script. But (big but) it is given without any guarantee. :) If things break you are on your own.
 
  
#!/bin/bash
+
==Lazarus Distributions==
 
#Define some directories
 
BASEDIR=/usr/share/
 
LAZCVSDIR=~/cvsroot/lazarus/
 
LAZDIR=/usr/share/lazarus/
 
LAZBACKUP=/usr/share/lazarus.bu
 
 
#Remove old backup if it exists
 
date +"%T %tStart"
 
if [ -d $LAZBACKUP ]
 
then
 
  date +"%T %tRemoving old backup"
 
  rm $LAZBACKUP -r
 
else
 
  date +"%T %tNo backup to remove"
 
fi
 
 
date +"%T %tCreating copy of lazarus dir"
 
cp -R $LAZDIR $LAZBACKUP
 
 
#Getting stuff from cvs
 
export CVSROOT=:pserver:cvs:cvs@cvs.freepascal.org:/FPC/CVS
 
date +"%T %tLogin to cvs server"
 
cvs login > /dev/null
 
date +"%T %tUpdate lazarus"
 
cvs -z3 update -dP lazarus > ~/cvs_update.log
 
date +"%T %tLogout of cvs-server"
 
cvs logout > /dev/null
 
 
#Copying cvs-files to our laz dir.
 
date +"%T %tcopying files"
 
cp -Rf $LAZCVSDIR $BASEDIR --reply=yes
 
 
#Make and building of lazarus
 
date +"%T %tmake lazarus"
 
cd $LAZDIR
 
make > /dev/null
 
date +"%T %tmake the packages"
 
make idepkg > /dev/null
 
date +"%T %tFinished"
 
  
== Daily Snapshot method ==
+
There are some unofficial sites where you can find Lazarus and Free Pascal too:
  
If you don't want to use svn directly, a daily snapshot of the current cvs is available from the [http://www.de.freepascal.org/lazarus/ lazarus snapshot site] or one of its mirrors.
+
*[http://newpascal.org NewPascal] is a curated distribution for Windows, which doesn't require an installer and implements some new features. (Is very out-of-date)
 +
*The [http://www.getlazarus.org getlazarus] distribution bundles cutting-edge versions of Lazarus with easy-to-use setup scripts for several platforms and additional components.
 +
*[https://freesparta.com/ FreeSparta] is a commercial distribution of Lazarus for Windows.
 +
*You can get a Ubuntu LiveCD from Austrian University of Applied Sciences hosting http://www.sigma-server.com/liveCD/Ubuntu-7.10-NTC-Lazarus.iso and md5sum file is here http://www.sigma-server.com/liveCD/Ubuntu-7.10-NTC-Lazarus.iso.md5.
 +
*The [http://www.pilotlogic.com CodeTyphon] distribution bundles Lazarus with additional packages and components.
 +
*[https://github.com/x2nie/LiteZarus LiteZarus] is a Lazarus distro intended for designing creating non-LCL projects.
 +
*Lazarus is available on CDs and USB sticks from the [http://www.blaisepascal.eu Blaise Pascal Magazine] store.
  
== Downloading releases ==
+
== See also ==
  
Binary releases for various platforms are also available via the [http://sourceforge.net/project/showfiles.php?group_id=89339 Lazarus Sourceforge download area].
+
* [http://forum.lazarus.freepascal.org/index.php/topic,36347.msg242123.html#msg242123 Forum: Explanation of trunk installation in Windows]
  
=Original contributors and changes=
 
  
This page has been converted from the epikwiki [http://lazarus-ccr.sourceforge.net/index.php?wiki=GettingLazarus version].
+
[[Category:Lazarus]]
 +
[[Category:Install]]

Latest revision as of 06:08, 4 August 2021

Deutsch (de) English (en) español (es) français (fr) 日本語 (ja) polski (pl) português (pt) русский (ru) slovenčina (sk)

Download and install Lazarus release version

From SourceForge

Binary releases for various platforms are available via the Lazarus Sourceforge download area.

For people who are blocked by SF, the Lazarus releases from Sourceforge are mirrored at:

Specific for platform

Get Lazarus for Windows - use the Sourceforge link above.

Get Lazarus for ReactOS

Get Lazarus for Ubuntu

Get Lazarus for Fedora

Get Lazarus for Suse

Get Lazarus for Scientific Linux

Get Lazarus for Raspberry Pi (Raspbian)

Get Lazarus for Mac

Lazarus on Solaris

Getting a Git client

TortoiseGit client

TortoiseGit Client is for Windows only. You may download it from https://tortoisegit.org/

Git for Windows

Command line clients:

https://gitforwindows.org/ https://git-scm.com/download/win

Other clients

A GIT command line client is available from https://git-scm.com/downloads for many platforms.

On Linux, it is recommended to install git using the package management system offered by your distribution. For example:

sudo apt-get install git

Getting Lazarus from the GitLab server

Development version of Lazarus

To get Lazarus for the first time, using command line:

 git clone https://gitlab.com/freepascal.org/lazarus/lazarus.git lazarus

A new directory "lazarus" is then created under the current directory.

Fixes branch of latest Lazarus release

Change into the directory created by the above git clone command and run

 git switch  fixes_2_2

Amending the name of the branch according to what fixes version you want. Get a list with

 git branch --all

The output will contain lines similar to

 remote/origin/fixes_2_2

The name of the branch is just the last part.


Update the sources later

Open a terminal/command prompt, change to the lazarus directory and type:

 git switch main
 git pull 

instead of main, you may want to specify a fixes branch.

For compiling see this.

Scripts

There are scripts for Windows and Linux to automate downloading and building Lazarus: Scripts for Lazarus

Compiling and running Lazarus

See Installing Lazarus - a detailed installation guide.

Using the command-line

Lazarus is shipped with an autogenerated Makefile (of the name "Makefile") for the gnu "make" utility.

Warning-icon.png

Warning: If you also have Embarcadero (or Borland) tools installed, their "make" might conflict with gnu "make". In that case you can either delete or rename the conflicting Embarcadero binary, or remove its directory from Windows PATH, or set the path in the console before calling make:

 set path=c:\pascal\3.2.0\bin\i386-win32;%path%

Warning-icon.png

Warning: "make" may also fail, if you have a shell (such as sh.exe) in your path. It depends on how this shell interprets quotes and backslashes.

make allows you to compile Lazarus from command-line easily. You need to have fpc and fpc-packages installed and configured first.

To compile go to Lazarus directory in your terminal and type

 make

This should rebuild LCL and Lazarus IDE with basic packages installed.

Another useful command is

 make bigide

which adds the same packages that the release version has.

Then you can run Lazarus from within the same source directory with command "lazarus" (in Unix systems "./lazarus").

In case you want to run several versions, you can direct lazarus to use use specific configuration directories via the --pcp option, e.g. :

lazarus --pcp=/home/YOU/myLaz19

Make targets

make help

To see a list of available targets for make type make help. Note: "make help" exists since 1.0. Here is the output of "make help":


 
make help 

 Main targets
                  Without any target, target 'all' will be invoked.
   all            build all needed, i.e. minimal IDE, lazbuild, startlazarus.
   clean          deletes files that 'bigide' creates. It does not clean up all possible
                  targets. Clean other target: make clean LCL_PLATFORM=qt
   distclean      Clean all targets and common leftovers.
   lazbuild       build lazbuild and lcl with nogui widgetset
   bigide         as all, except that the IDE is built with a lot of extra packages
   useride        calls lazbuild to build an IDE with your active profile, requires lazbuild
   install        installs Lazarus under /usr/local/share/lazarus
                  You can change the directory by appending INSTALL_PREFIX=/some/path

 Sub targets
   registration   build package FCL
   lazutils       build package LazUtils, requires registration
   codetools      build package CodeTools, requires lazutils
   lcl            build package LCLBase and LCL, requires lazutils
   tools          build lazres, svn2revisioninc, updatepofiles, lrstolfm,
                  requires LCL with nogui widgetset
   basecomponents build debuggerintf, lazdebuggergdbmi, lazcontrols, synedit, ideintf
                  for the LCL_PLATFORM, requires lcl
   bigidecomponents build many extra packages for the LCL_PLATFORM, requires basecomponents
   lhelp          build lhelp, requires bigidecomponents
   starter        build startlazarus, requires basecomponents
   examples       build basic examples, requires basecomponents                                                                                                        
                  Note: There are more examples having their own directory                                                                                             
                                                                                                                                                                       
 Flags:                                                                                                                                                                
   PP=/path/to/fpc        use another compiler                                                                                                                         
   USESVN2REVISIONINC=0   do not update ide/revision.inc                                                                                                               
   INSTALL_PREFIX=/usr    used by 'install' as path prefix                                                                                                             
   FPC_DIR=/usr/share/fpcsrc/3.0.4   used by fpcmake when regenerating Makefiles                                                                                       
   OPT='-vwnbq -gh'       append these options when calling the compiler                                                                                               
                                                                                                                                                                       
 Usage examples:                                                                                                                                                       
                                                                                                                                                                       
 Update svn and build a minimal IDE, startlazarus and lazbuild:                                                                                                      
   make clean                                                                                                                                                          
   svn up                                                                                                                                                               
   make clean all                                                                                                                                                      
                                                                                                                                                                       
 Note: You can start lazarus with 'startlazarus'                                                                                                                       
 Note: Use the IDE or lazbuild to compile your projects/packages.                                                                                                      
                                                                                                                                                                       
 Update svn and build an IDE with your last set of packages:                                                                                                         
   make clean                                                                                                                                                          
   svn up                                                                                                                                                              
   make clean lazbuild useride                                                                                                                                         
                                                                                                                                                                       
 Clean up:                                                                                                                                                             
  There is no command to clean up a svn repository completely, but                                                                                                     
  you can use the following command under Linux/OS X:                                                                                                                  
  svn status | grep '\?' | sed -e 's/\? *//' | xargs rm -r                                                                                                             
                                                                                                                                                                       
  Another possibility is to create a clean copy via the svn export command.                                                                                            
                                                                                                                                                                       
 Install:                                                                                                                                                              
   Note: You can use Lazarus without installing. Just start the lazarus executable.                                                                                    
   1. Build Lazarus as normal user with one of the above commands.                                                                                                     
   2. Install as root into /usr                                                                                                                                        
          sudo make install
      This installs startlazarus, lazarus-ide, lazbuild under /usr/bin
      and copies the whole lazarus source directory to /usr/share/lazarus

Make parameters

There are additional parameters which can be used to make Lazarus. See a fully working example above.

  • OPT=%compiler_switches

the %compiler_switches is passed to each fpc call. The option is useful for specifying defines

For example:

 make bigide OPT="-dNoGdkPixBufLib -gw2" 

makes LCL and ide with NoGdkPixBufLib defined and dwarf2 debug info.

  • LCL_PLATFORM=%platform

%platform is the target widgetset. It can be win32,wince,gtk,gtk2,qt,carbon,cocoa,customdrawn.

For example:

 make LCL_PLATFORM=gtk2

Rebuilds LCL and IDE for gtk2 widgetset

  • FPC=%compiler_path

or

  • PP=%compiler_path

%compiler_path is the path+filename to a custom compiler binary you want to build the target with.

such as:

make FPC="~/Pfad/fpc"

Browse the Source Repository with a Web Browser

The contents of the GIT repro can also be browsed with your web-browser through interface.

Lazarus Distributions

There are some unofficial sites where you can find Lazarus and Free Pascal too:

See also